Received: by 2002:a05:6a10:2785:0:0:0:0 with SMTP id ia5csp3251301pxb; Tue, 12 Jan 2021 09:53:36 -0800 (PST) X-Google-Smtp-Source: ABdhPJylv0SZCdXnOVdZnz3ePmG8jYjvYtl2zMWlHlCGqVPn4yG+7DIY4Oq/ENzycwJ3GVhyD8It X-Received: by 2002:aa7:c813:: with SMTP id a19mr248585edt.192.1610474016225; Tue, 12 Jan 2021 09:53:36 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1610474016; cv=none; d=google.com; s=arc-20160816; b=ya3H26EipLU3bp8rO9EzvQP3y3fs5JjfpG4i0KG5c9euWlMLYLTyF1WSPLKcInEx7N TZTXv6PtxjVSAnhc0GCkYQDN68RPsf4ElX8i6ORZ3Zd9/FALDnxAOD3MiBQcosL5YCPq p7wTWUJ0LH3lXjxrm6HZ0TQ4wlCOHVRZ41sVZeLKzB7SbQti3C3Wh+a52UDjLkUE7z7P WN8WtcvIiJ17EQvOwnFCtPdhCwCFSbL8JStGtX0ZK/wiOgwPwjm/yUcIIT8RPjfQ86f9 JSSyv9MJh9Qharb4fxx8O4lC5xGBHkzqqYsxaJhQF47pVpQ2yodQdCu0nK6ms6VP7+PZ TJqA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:user-agent:in-reply-to:content-disposition :mime-version:references:reply-to:message-id:subject:cc:to:from:date :dkim-signature; bh=405EbrqVoL6F0FIhd/SZCel0vcIm7Rk8oFSCnLIb5GM=; b=eyMx/koeJx7bUKy3bPvUMBqgj4qIgLxTc2nq2YvGn0n9sx2Ki/YG2N9Elw/mAabkTq 4leIrDc9IJZzfUoBsd6NhWox15IZwAjNubhs3tVtQB7PBQrL2AlpaRG34e1h4QN3rNp7 Mazq0tCO/wGgOdbSH5N4/U9jl6DweN12yIObhar/uu83qiQuBIY0cCcgLL8EHOeJ63Fb u9NELLqTnVsEGifB2LasX6D8OZ6MA7tyg2sdpmOHnQHml1qTP2OloaTwIo5nlDtFISnx 7HgxvM+rhRPxuGfDG7OACqiCfNChhy7xyeyFApHswy7XMtD+KUNFQpqJDwWtkbWiRA3B UDNA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=EjgINcyt; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id f12si1742270edx.584.2021.01.12.09.53.12; Tue, 12 Jan 2021 09:53:36 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=EjgINcyt; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S2391055AbhALRvh (ORCPT + 99 others); Tue, 12 Jan 2021 12:51:37 -0500 Received: from mail.kernel.org ([198.145.29.99]:51896 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1727622AbhALRvh (ORCPT ); Tue, 12 Jan 2021 12:51:37 -0500 Received: by mail.kernel.org (Postfix) with ESMTPSA id 224CC222F9; Tue, 12 Jan 2021 17:50:56 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1610473856; bh=xdBUPFjlzytUuhyT0O7C8PJlI1bRIAh9KpxfnJ9siDI=; h=Date:From:To:Cc:Subject:Reply-To:References:In-Reply-To:From; b=EjgINcyt9c5d/2opD9jzsy/mprfu0QmtXYcJwYDTbFJrp7VokjEmpvSOQPdXvcjyd TQAMro0dNyX1uFHziLX4WfhNTq687uxvXGZYyab0ryrAb6/j1fMs94BxNKS+8IoanX hHQn/6tJcyOtvFKdlyLR4/1r3QNfDIIP2/17KxdWSy1nUlglLEH5xhulMEl7uTKnMo 1ik7WsbQTDpS5TTpfvwxH63Q/E1G8xtvenP+XGH9JHH8xA/aTfs7rONplfip/XvPae cK1EMZezsEUbyQIxV5SaACWn70eXGdYH32bCGMReBIMu+DlUkrWILou3w5JsbBLTf9 45HbFp6m8N1eg== Received: by paulmck-ThinkPad-P72.home (Postfix, from userid 1000) id E1CAD3522AC3; Tue, 12 Jan 2021 09:50:55 -0800 (PST) Date: Tue, 12 Jan 2021 09:50:55 -0800 From: "Paul E. McKenney" To: Zhouyi Zhou Cc: 340442286@qq.com, josh@joshtriplett.org, rostedt@goodmis.org, mathieu.desnoyers@efficios.com, jiangshanlai@gmail.com, joel@joelfernandes.org, rcu@vger.kernel.org, linux-kernel@vger.kernel.org Subject: Re: [PATCH] rcu: remove surplus instrumentation_end in rcu_nmi_enter Message-ID: <20210112175055.GI2743@paulmck-ThinkPad-P72> Reply-To: paulmck@kernel.org References: <20210111010859.7778-1-zhouzhouyi@gmail.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20210111010859.7778-1-zhouzhouyi@gmail.com> User-Agent: Mutt/1.9.4 (2018-02-28) Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Mon, Jan 11, 2021 at 09:08:59AM +0800, Zhouyi Zhou wrote: > In function rcu_nmi_enter, there is a surplus instrumentation_end > in second branch of if statement, although objtool check -f vmlinux.o will > not complain because of its inability to correctly cover all cases > (objtool will visit the third branch first, which markes > following trace_rcu_dyntick as visited), I think remove the surplus > instrumentation_end will make the code better. > > > Signed-off-by: Zhouyi Zhou Good catch, applied, thank you! As usual, I edited a bit, so please check below to see if I messed anything up. I did add Neeraj Upadhyay's Reported-by because he noted this, though you beat him with a public posting, though mostly because I asked him whether he could make this happen. I also added the Fixes, but could you please do that in the future? You can use "git blame" or either "git log" and "gitk" with appropriate options to find the offending commit. Thanx, Paul ------------------------------------------------------------------------ commit 3f91ff7fd4f76e7eb48bad79666c466bc3530324 Author: Zhouyi Zhou Date: Mon Jan 11 09:08:59 2021 +0800 rcu: Remove spurious instrumentation_end() in rcu_nmi_enter() In rcu_nmi_enter(), there is an erroneous instrumentation_end() in the second branch of the "if" statement. Oddly enough, "objtool check -f vmlinux.o" fails to complain because it is unable to correctly cover all cases. Instead, objtool visits the third branch first, which marks following trace_rcu_dyntick() as visited. This commit therefore removes the spurious instrumentation_end(). Fixes: 04b25a495bd6 ("rcu: Mark rcu_nmi_enter() call to rcu_cleanup_after_idle() noinstr") Reported-by Neeraj Upadhyay Signed-off-by: Zhouyi Zhou Signed-off-by: Paul E. McKenney diff --git a/kernel/rcu/tree.c b/kernel/rcu/tree.c index 63c6dba..e04e336 100644 --- a/kernel/rcu/tree.c +++ b/kernel/rcu/tree.c @@ -1050,7 +1050,6 @@ noinstr void rcu_nmi_enter(void) } else if (!in_nmi()) { instrumentation_begin(); rcu_irq_enter_check_tick(); - instrumentation_end(); } else { instrumentation_begin(); }