Received: by 2002:a05:6a10:9e8c:0:0:0:0 with SMTP id y12csp693317pxx; Wed, 28 Oct 2020 14:42:06 -0700 (PDT) X-Google-Smtp-Source: ABdhPJwIFJjISG5m8EIrduDCpF4z6bi0xIYfx+L4XyPGFqYX9MNTzmQKCYt+M1lSJNDHh1YzjYau X-Received: by 2002:a17:906:3899:: with SMTP id q25mr1189436ejd.0.1603921325755; Wed, 28 Oct 2020 14:42:05 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1603921325; cv=none; d=google.com; s=arc-20160816; b=AALqZ1dPHAX3R+OBm4AtXh3mgZF+TXML6LpwID/pCcT5NS5cO2MfFcDQkMJbCrj26h h/05j715XVnc2IRp7EIAFNSFrrkAv2ua5enJOw71b+ZtMHjyCZ68zLbfLOvwcodsMxH5 EmqBgjdL9qUSIKL5Y+0lhtg3gH7Q5RLTI1iKNHy2oRmWGVWliZ+y22/GCB8kQJ1hUgz/ J8CyHzn1SbG8BkSTFPFRhiFraPZdYagLNfP33fGajyuY/pU9OrnGicLHLpx6I+pCqpnV LDy6hx+urpDPlVtqW7aG5VR4iDVn2jSma5I4CFabynFMZi3Tkyd3QwGu0vpbDjdIojmr P9+A== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:cc:to:subject:message-id:date:from:in-reply-to :references:mime-version:dkim-signature; bh=TRaR6JWZb5scMwVfgCY4cugXQxIxtVUuz/hWzL2fGtw=; b=VaBy+J0bVi0yw8FeGfksXHYCd/uVlrGFUY/1N2h4Bevh/xb9Yb42Hfpu+cbMTYx9UW zcqg1pr/4dyZRxZpIv2RKW1T2/+f3/lt5t6xwoIr3tNNEhI0ZRUJac4nj4SIlKTPBVQD JRGB7QgjWrSas0Osnsv/AnAthONMiTgBbDe/KDF3X/+quvtp31yHdHjEvLZpjE8OWT9z dC/M7irWaAul76Idbbd19V7YMhJjHhi2YCg6OJe9GtkHjzgl2Mc1bE4tpH/iGtU3cFM8 3b3y0KP+WOSCLkrBNLB1wmYS0cxpHbnthU1b8d8o+4ZiU4B8/nmkQj3lbl0ZMIUfJEyK t46Q== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b=GQrhz4iC; 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 cy8si532222edb.527.2020.10.28.14.41.43; Wed, 28 Oct 2020 14:42:05 -0700 (PDT) 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=default header.b=GQrhz4iC; 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 S1726172AbgJ1Bii (ORCPT + 99 others); Tue, 27 Oct 2020 21:38:38 -0400 Received: from mail.kernel.org ([198.145.29.99]:54452 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1833019AbgJ0Xe2 (ORCPT ); Tue, 27 Oct 2020 19:34:28 -0400 Received: from mail-qk1-f178.google.com (mail-qk1-f178.google.com [209.85.222.178]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPSA id 89DCE2223C for ; Tue, 27 Oct 2020 23:34:27 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1603841667; bh=RJE//DOx71HHeDbmWqHEDCCZ1JmcRm3imz22F8k1pfE=; h=References:In-Reply-To:From:Date:Subject:To:Cc:From; b=GQrhz4iCo0j56Nr0YQFZ/2CvT+gzp7FG1lAovFekCdG+r8TDN8tOmCRN+QO2jObN1 NbdTeUXvdFQTyZ3f2N9eTJ57mwm2R9sX+1FpJsRTjhDSg7YEgKtxOi/DDHf8rx2SY7 QEDFNwV/t0YqaG/voFyY/XFr53DPDQcDeGBwNxVA= Received: by mail-qk1-f178.google.com with SMTP id x20so2995800qkn.1 for ; Tue, 27 Oct 2020 16:34:27 -0700 (PDT) X-Gm-Message-State: AOAM530BRZW/J7lLI2QeVtQh/Qhd0mCfTVjvNVS7YOaeqR5GhYNScojT P+gmFPqh8Jyz8VO1h2XKpPOOi/0hko5IqZfc0ZA= X-Received: by 2002:a05:620a:22c9:: with SMTP id o9mr4873444qki.286.1603841666683; Tue, 27 Oct 2020 16:34:26 -0700 (PDT) MIME-Version: 1.0 References: <20201026165044.3722931-1-arnd@kernel.org> <20201026165805.GS2594@hirez.programming.kicks-ass.net> In-Reply-To: <20201026165805.GS2594@hirez.programming.kicks-ass.net> From: Arnd Bergmann Date: Wed, 28 Oct 2020 00:34:10 +0100 X-Gmail-Original-Message-ID: Message-ID: Subject: Re: [PATCH] seqlock: avoid -Wshadow warnings To: Peter Zijlstra Cc: Ingo Molnar , Will Deacon , "Ahmed S. Darwish" , "Paul E. McKenney" , Marco Elver , "linux-kernel@vger.kernel.org" Content-Type: text/plain; charset="UTF-8" Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Mon, Oct 26, 2020 at 5:58 PM Peter Zijlstra wrote: > > On Mon, Oct 26, 2020 at 05:50:38PM +0100, Arnd Bergmann wrote: > > > - unsigned seq; \ > > + unsigned __seq; \ > > > - unsigned seq = __read_seqcount_begin(s); \ > > + unsigned _seq = __read_seqcount_begin(s); \ > > > - unsigned seq = __seqcount_sequence(s); \ > > + unsigned __seq = __seqcount_sequence(s); \ > > Can we have a consistent number of leading '_' ? Not really ;-) The warning comes from raw_read_seqcount_begin() calling __read_seqcount_begin() and both using the same variable name. I could rename one of them and use double-underscores for both, but I haven't come up with a good alternative name that wouldn't make it less consistent in the process. > Also, I suppose you're going to find the explicit shadow in > ___wait_event(), that one's not going to be trivial to fix. I have this patch in my tree at the moment but did not send that yet because that caused a regression on powerpc: diff --git a/include/linux/wait.h b/include/linux/wait.h index 57ccf26d3b96..5d00a6fb7154 100644 --- a/include/linux/wait.h +++ b/include/linux/wait.h @@ -265,7 +265,11 @@ extern void init_wait_entry(struct wait_queue_entry *wq_entry, int flags); ({ \ __label__ __out; \ struct wait_queue_entry __wq_entry; \ - long __ret = ret; /* explicit shadow */ \ + __diag_push() \ + __diag_ignore(GCC, 8, "-Wshadow", "explicit shadow") \ + __diag_ignore(CLANG, 9, "-Wshadow", "explicit shadow") \ + long __ret = ret; \ + __diag_pop(); \ \ init_wait_entry(&__wq_entry, exclusive ? WQ_FLAG_EXCLUSIVE : 0); \ for (;;) { \ Still looking at alternative approaches. Arnd