Received: by 2002:a05:6358:11c7:b0:104:8066:f915 with SMTP id i7csp2574078rwl; Thu, 13 Apr 2023 08:10:37 -0700 (PDT) X-Google-Smtp-Source: AKy350YnGbUZPufxLTGS9gco9IO3eRyu58WCIBmSv5JeVpQp0ETfW087M7cDf+VLka6nOqVCt5tn X-Received: by 2002:a25:1c04:0:b0:b8f:2047:181a with SMTP id c4-20020a251c04000000b00b8f2047181amr2117608ybc.24.1681398637125; Thu, 13 Apr 2023 08:10:37 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1681398637; cv=none; d=google.com; s=arc-20160816; b=PEDf2ZVI4AV57OT2SEvy3TLDTxW34KQJD5C2z9PtrJVr5UlpO2mEnpvrhvo+bLehpf D3G8zzZU8Hzc3Sfok/fdLRHnrhLXGuX6K3Dl5YZnFTRVCnSWiXJl1uTuuvmOhq0yKX1x CJDRFnEJYjV2wtSojIRLK9PUZg18TReKEvNKh0aAg2y2JIQffaXAyK0rZ6Xw621lpFeD WvyGaqFg093MssmC2dnLTupmiZUliDTm3XxAKZXiR2Vkd4W7HiCPL37IsHQkPZ2x5WEV nBncy6PiR2x7rUXTmhca69ejeViNsYl1YEcFr9BufCEHrX7ptt0ZA6mE+qipZ7uBiNFw pvMQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:in-reply-to:content-disposition:mime-version :references:message-id:subject:cc:to:from:date:dkim-signature; bh=goVoERH71GThXlEQ6fzi6eYOZNo8jZJQc8mmJ7Z/TqI=; b=QbAeGCKjmvK39X8L3avKlS0xogWY0W9CH46YhiZvz2NIEzYeBWp+e9y8MWf6wDQ08r v9ga7g44p+9gsMDfcEqUHJjcN4jLmNkqhH81YDh5VPM29w2rZjW2DBy0XXmPGL4LSvdF ZnGHxT7PmoaoNc7wNKTC3ZGm3vLte9djEYb1IiU3nQVZRyY9SHutfjxxAYrl810gD5Io PKLUKc/LGsi6mtqyw27mpOuj7eNgxVmUSwEoDF38JaKEBDj3GxKSU96nECpWePNfDspP MJNeTJUOoC67nz9vawGlstN4SBwNsEQfNdGZxkkiz0Tboa6Nxy607RepXkzVwplefjGd QgPg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=HQAGJwNO; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 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 out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id ci23-20020a056130201700b00764345b762bsi385620uab.53.2023.04.13.08.10.22; Thu, 13 Apr 2023 08:10:37 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=HQAGJwNO; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 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 S230099AbjDMPD1 (ORCPT + 99 others); Thu, 13 Apr 2023 11:03:27 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:55142 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229660AbjDMPD0 (ORCPT ); Thu, 13 Apr 2023 11:03:26 -0400 Received: from dfw.source.kernel.org (dfw.source.kernel.org [IPv6:2604:1380:4641:c500::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 041187280 for ; Thu, 13 Apr 2023 08:03:25 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by dfw.source.kernel.org (Postfix) with ESMTPS id 9458E63D2A for ; Thu, 13 Apr 2023 15:03:24 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id B818AC433EF; Thu, 13 Apr 2023 15:03:23 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1681398204; bh=QPUkqPgRKaIjDDW1YwhxzO3PAAr+2+moV8zN1iwvllg=; h=Date:From:To:Cc:Subject:References:In-Reply-To:From; b=HQAGJwNO0w5KlMuOrcjxHZuk9mA+AC5HCk4bI+Wt3JgMDYhj4PCe53meaSNxTDoHL p6FuEJk+v6BbCdPaCNEJpuJqw1FcelOfIT9B9e2+uykXHOmjXTJhs+K5jTxNII9kQ2 rGSlipknR4nnkahyMMh1+5WijYS/8YGVuQP8peFnFldXFEdVjFKganVbBGmehvCrIj mNqAKCVP7MJ7l492562p4cFrUZFl9dp/Bn9yte1grKye/mJMkxCMQ4W20Si3rMOXYN 5pbKAQWXTaYF7C46umjhFQQ74lOvFmMuZ7KL6dVRKxME1QBJPQ5BxmBO7vYLZAcIov UIXK9SgsUy6uw== Date: Thu, 13 Apr 2023 08:03:21 -0700 From: Josh Poimboeuf To: Peter Zijlstra Cc: x86@kernel.org, linux-kernel@vger.kernel.org, Miroslav Benes Subject: Re: [PATCH v2 3/9] objtool: Limit unreachable warnings to once per function Message-ID: <20230413150321.6hd4m3vlnonom3qo@treble> References: <81ed0b8e5218ac6ecae49af901bf5e0fb3687cef.1681325924.git.jpoimboe@kernel.org> <20230413080112.GF4253@hirez.programming.kicks-ass.net> MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Disposition: inline In-Reply-To: <20230413080112.GF4253@hirez.programming.kicks-ass.net> X-Spam-Status: No, score=-4.4 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_MED, SPF_HELO_NONE,SPF_PASS autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Thu, Apr 13, 2023 at 10:01:12AM +0200, Peter Zijlstra wrote: > On Wed, Apr 12, 2023 at 12:03:18PM -0700, Josh Poimboeuf wrote: > > > diff --git a/tools/objtool/include/objtool/warn.h b/tools/objtool/include/objtool/warn.h > > index b1c920dc9516..4ef9b278e5fd 100644 > > --- a/tools/objtool/include/objtool/warn.h > > +++ b/tools/objtool/include/objtool/warn.h > > @@ -55,7 +55,10 @@ static inline char *offstr(struct section *sec, unsigned long offset) > > > > #define WARN_INSN(insn, format, ...) \ > > ({ \ > > - WARN_FUNC(format, insn->sec, insn->offset, ##__VA_ARGS__); \ > > + if (!insn->sym || !insn->sym->warned) \ > > + WARN_FUNC(format, insn->sec, insn->offset, ##__VA_ARGS__);\ > > + if (insn->sym) \ > > + insn->sym->warned = 1; \ > > }) > > Do we want to write that like: > > #define WARN_INSN(insn, format, ...) \ > ({ \ > struct instruction *_insn = (insn); \ > if (!_insn->sym || !_insn->sym->warned) \ > WARN_FUNC(format, _insn->sec, _insn->offset, ##__VA_ARGS__);\ > if (_insn->sym) \ > _insn->sym->warned = 1; \ > }) > > instead ? Yes indeed. -- Josh