From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id B26F2C433FE for ; Wed, 27 Oct 2021 02:56:00 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id 9BEB2610CB for ; Wed, 27 Oct 2021 02:56:00 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S238799AbhJ0C6W convert rfc822-to-8bit (ORCPT ); Tue, 26 Oct 2021 22:58:22 -0400 Received: from mail.kernel.org ([198.145.29.99]:39980 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S238780AbhJ0C6V (ORCPT ); Tue, 26 Oct 2021 22:58:21 -0400 Received: from rorschach.local.home (cpe-66-24-58-225.stny.res.rr.com [66.24.58.225]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPSA id 03365610C7; Wed, 27 Oct 2021 02:55:53 +0000 (UTC) Date: Tue, 26 Oct 2021 22:55:52 -0400 From: Steven Rostedt To: =?UTF-8?B?546L6LSH?= Cc: Guo Ren , Ingo Molnar , "James E.J. Bottomley" , Helge Deller , Michael Ellerman , Benjamin Herrenschmidt , Paul Mackerras , Paul Walmsley , Palmer Dabbelt , Albert Ou , Thomas Gleixner , Borislav Petkov , x86@kernel.org, "H. Peter Anvin" , Josh Poimboeuf , Jiri Kosina , Miroslav Benes , Petr Mladek , Joe Lawrence , Masami Hiramatsu , "Peter Zijlstra (Intel)" , Nicholas Piggin , Jisheng Zhang , linux-csky@vger.kernel.org, linux-kernel@vger.kernel.org, linux-parisc@vger.kernel.org, linuxppc-dev@lists.ozlabs.org, linux-riscv@lists.infradead.org, live-patching@vger.kernel.org Subject: Re: [PATCH v6 1/2] ftrace: disable preemption when recursion locked Message-ID: <20211026225552.72a7ee79@rorschach.local.home> In-Reply-To: <78c95844-16b7-8904-b48d-3b2ccd76a352@linux.alibaba.com> References: <78c95844-16b7-8904-b48d-3b2ccd76a352@linux.alibaba.com> X-Mailer: Claws Mail 3.17.8 (GTK+ 2.24.33; x86_64-pc-linux-gnu) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8BIT Precedence: bulk List-ID: X-Mailing-List: linux-parisc@vger.kernel.org On Wed, 27 Oct 2021 10:34:13 +0800 王贇 wrote: > +/* > + * Preemption will be enabled (if it was previously enabled). > + */ > static __always_inline void trace_clear_recursion(int bit) > { > + WARN_ON_ONCE(bit < 0); Can you send a v7 without the WARN_ON. This is an extremely hot path, and this will cause noticeable overhead. If something were to call this with bit < 0, then it would crash and burn rather quickly. -- Steve > + > + preempt_enable_notrace(); > barrier(); > trace_recursion_clear(bit); > } From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 037CCC433EF for ; Wed, 27 Oct 2021 02:56:09 +0000 (UTC) Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.133]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id 9A125610C7 for ; Wed, 27 Oct 2021 02:56:08 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.4.1 mail.kernel.org 9A125610C7 Authentication-Results: mail.kernel.org; dmarc=none (p=none dis=none) header.from=goodmis.org Authentication-Results: mail.kernel.org; spf=none smtp.mailfrom=lists.infradead.org DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20210309; h=Sender: Content-Transfer-Encoding:Content-Type:List-Subscribe:List-Help:List-Post: List-Archive:List-Unsubscribe:List-Id:MIME-Version:References:In-Reply-To: Message-ID:Subject:Cc:To:From:Date:Reply-To:Content-ID:Content-Description: Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID: List-Owner; bh=Sd3oJ/WMFkPVVxAyiSJT+PdRpVtwt4vhXVlTJXddiCQ=; b=x3HeAHyl8cQtJg boRaSTJildKj8G8M/SENYlkHRJ0Tl/LvU+qOeL1UXmki9PyCU6Ld0o8f7fKB6i0PhsYt/HH+axk0J TFfvXVJonHoiqncbm2NU6a1JT8pO2xoMEW1kBd5KP5KDFDVzO3XoDRu4LzB21Ko0FkPQwL30qCv6z HvTpKo6odvl4ysDPdF1H1JftxaUuuV2FkeyG7MtDHoMEDySv4CSh92iFRgBRHOOeJH5747elZrbxW z8BMoueCbNdpBGCPnG9uaJbN8OlFck5KX8/cgPhnVHyO5FcfE/hqBNyuVs0iiwbmo/e9SE95sG6/E FvwaHu0Df9dVjuobpFog==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.94.2 #2 (Red Hat Linux)) id 1mfZ6d-003hCq-Ku; Wed, 27 Oct 2021 02:55:59 +0000 Received: from mail.kernel.org ([198.145.29.99]) by bombadil.infradead.org with esmtps (Exim 4.94.2 #2 (Red Hat Linux)) id 1mfZ6b-003hB9-30 for linux-riscv@lists.infradead.org; Wed, 27 Oct 2021 02:55:58 +0000 Received: from rorschach.local.home (cpe-66-24-58-225.stny.res.rr.com [66.24.58.225]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPSA id 03365610C7; Wed, 27 Oct 2021 02:55:53 +0000 (UTC) Date: Tue, 26 Oct 2021 22:55:52 -0400 From: Steven Rostedt To: =?UTF-8?B?546L6LSH?= Cc: Guo Ren , Ingo Molnar , "James E.J. Bottomley" , Helge Deller , Michael Ellerman , Benjamin Herrenschmidt , Paul Mackerras , Paul Walmsley , Palmer Dabbelt , Albert Ou , Thomas Gleixner , Borislav Petkov , x86@kernel.org, "H. Peter Anvin" , Josh Poimboeuf , Jiri Kosina , Miroslav Benes , Petr Mladek , Joe Lawrence , Masami Hiramatsu , "Peter Zijlstra (Intel)" , Nicholas Piggin , Jisheng Zhang , linux-csky@vger.kernel.org, linux-kernel@vger.kernel.org, linux-parisc@vger.kernel.org, linuxppc-dev@lists.ozlabs.org, linux-riscv@lists.infradead.org, live-patching@vger.kernel.org Subject: Re: [PATCH v6 1/2] ftrace: disable preemption when recursion locked Message-ID: <20211026225552.72a7ee79@rorschach.local.home> In-Reply-To: <78c95844-16b7-8904-b48d-3b2ccd76a352@linux.alibaba.com> References: <78c95844-16b7-8904-b48d-3b2ccd76a352@linux.alibaba.com> X-Mailer: Claws Mail 3.17.8 (GTK+ 2.24.33; x86_64-pc-linux-gnu) MIME-Version: 1.0 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20211026_195557_176974_4C88532D X-CRM114-Status: GOOD ( 10.55 ) X-BeenThere: linux-riscv@lists.infradead.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: base64 Sender: "linux-riscv" Errors-To: linux-riscv-bounces+linux-riscv=archiver.kernel.org@lists.infradead.org T24gV2VkLCAyNyBPY3QgMjAyMSAxMDozNDoxMyArMDgwMArnjovotIcgPHl1bi53YW5nQGxpbnV4 LmFsaWJhYmEuY29tPiB3cm90ZToKCj4gKy8qCj4gKyAqIFByZWVtcHRpb24gd2lsbCBiZSBlbmFi bGVkIChpZiBpdCB3YXMgcHJldmlvdXNseSBlbmFibGVkKS4KPiArICovCj4gIHN0YXRpYyBfX2Fs d2F5c19pbmxpbmUgdm9pZCB0cmFjZV9jbGVhcl9yZWN1cnNpb24oaW50IGJpdCkKPiAgewo+ICsJ V0FSTl9PTl9PTkNFKGJpdCA8IDApOwoKQ2FuIHlvdSBzZW5kIGEgdjcgd2l0aG91dCB0aGUgV0FS Tl9PTi4KClRoaXMgaXMgYW4gZXh0cmVtZWx5IGhvdCBwYXRoLCBhbmQgdGhpcyB3aWxsIGNhdXNl IG5vdGljZWFibGUgb3ZlcmhlYWQuCgpJZiBzb21ldGhpbmcgd2VyZSB0byBjYWxsIHRoaXMgd2l0 aCBiaXQgPCAwLCB0aGVuIGl0IHdvdWxkIGNyYXNoIGFuZApidXJuIHJhdGhlciBxdWlja2x5LgoK LS0gU3RldmUKCgo+ICsKPiArCXByZWVtcHRfZW5hYmxlX25vdHJhY2UoKTsKPiAgCWJhcnJpZXIo KTsKPiAgCXRyYWNlX3JlY3Vyc2lvbl9jbGVhcihiaXQpOwo+ICB9CgpfX19fX19fX19fX19fX19f X19fX19fX19fX19fX19fX19fX19fX19fX19fX19fXwpsaW51eC1yaXNjdiBtYWlsaW5nIGxpc3QK bGludXgtcmlzY3ZAbGlzdHMuaW5mcmFkZWFkLm9yZwpodHRwOi8vbGlzdHMuaW5mcmFkZWFkLm9y Zy9tYWlsbWFuL2xpc3RpbmZvL2xpbnV4LXJpc2N2Cg== From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 5B0CEC433F5 for ; Wed, 27 Oct 2021 02:56:25 +0000 (UTC) Received: from lists.ozlabs.org (lists.ozlabs.org [112.213.38.117]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id B35F06103B for ; Wed, 27 Oct 2021 02:56:24 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.4.1 mail.kernel.org B35F06103B Authentication-Results: mail.kernel.org; dmarc=none (p=none dis=none) header.from=goodmis.org Authentication-Results: mail.kernel.org; spf=pass smtp.mailfrom=lists.ozlabs.org Received: from boromir.ozlabs.org (localhost [IPv6:::1]) by lists.ozlabs.org (Postfix) with ESMTP id 4HfCxz0gVGz3c5B for ; Wed, 27 Oct 2021 13:56:23 +1100 (AEDT) Authentication-Results: lists.ozlabs.org; spf=pass (sender SPF authorized) smtp.mailfrom=kernel.org (client-ip=198.145.29.99; helo=mail.kernel.org; envelope-from=srs0=up5n=pp=goodmis.org=rostedt@kernel.org; receiver=) Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by lists.ozlabs.org (Postfix) with ESMTPS id 4HfCxV6d2Kz2xB0 for ; Wed, 27 Oct 2021 13:55:58 +1100 (AEDT) Received: from rorschach.local.home (cpe-66-24-58-225.stny.res.rr.com [66.24.58.225]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPSA id 03365610C7; Wed, 27 Oct 2021 02:55:53 +0000 (UTC) Date: Tue, 26 Oct 2021 22:55:52 -0400 From: Steven Rostedt To: =?UTF-8?B?546L6LSH?= Subject: Re: [PATCH v6 1/2] ftrace: disable preemption when recursion locked Message-ID: <20211026225552.72a7ee79@rorschach.local.home> In-Reply-To: <78c95844-16b7-8904-b48d-3b2ccd76a352@linux.alibaba.com> References: <78c95844-16b7-8904-b48d-3b2ccd76a352@linux.alibaba.com> X-Mailer: Claws Mail 3.17.8 (GTK+ 2.24.33; x86_64-pc-linux-gnu) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: quoted-printable X-BeenThere: linuxppc-dev@lists.ozlabs.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Linux on PowerPC Developers Mail List List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: "Peter Zijlstra \(Intel\)" , Paul Walmsley , "James E.J. Bottomley" , Guo Ren , Jisheng Zhang , "H. Peter Anvin" , live-patching@vger.kernel.org, linux-riscv@lists.infradead.org, Miroslav Benes , Joe Lawrence , Helge Deller , x86@kernel.org, linux-csky@vger.kernel.org, Ingo Molnar , Petr Mladek , Albert Ou , Jiri Kosina , Nicholas Piggin , Borislav Petkov , Josh Poimboeuf , Thomas Gleixner , linux-parisc@vger.kernel.org, linux-kernel@vger.kernel.org, Palmer Dabbelt , Masami Hiramatsu , Paul Mackerras , linuxppc-dev@lists.ozlabs.org Errors-To: linuxppc-dev-bounces+linuxppc-dev=archiver.kernel.org@lists.ozlabs.org Sender: "Linuxppc-dev" On Wed, 27 Oct 2021 10:34:13 +0800 =E7=8E=8B=E8=B4=87 wrote: > +/* > + * Preemption will be enabled (if it was previously enabled). > + */ > static __always_inline void trace_clear_recursion(int bit) > { > + WARN_ON_ONCE(bit < 0); Can you send a v7 without the WARN_ON. This is an extremely hot path, and this will cause noticeable overhead. If something were to call this with bit < 0, then it would crash and burn rather quickly. -- Steve > + > + preempt_enable_notrace(); > barrier(); > trace_recursion_clear(bit); > }