Received: by 2002:a05:6a10:9afc:0:0:0:0 with SMTP id t28csp282543pxm; Wed, 2 Mar 2022 15:21:47 -0800 (PST) X-Google-Smtp-Source: ABdhPJyPvw+qhe8mnx4Ya45X1IIvJHM33KQuhyqWGIp4L1q3eN9JiiyzQwfxIwz2S8iTViwXmiD4 X-Received: by 2002:a17:902:9348:b0:14f:c715:2a94 with SMTP id g8-20020a170902934800b0014fc7152a94mr33483362plp.66.1646263307143; Wed, 02 Mar 2022 15:21:47 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1646263307; cv=none; d=google.com; s=arc-20160816; b=xbf200WM7rjvDuTrvwgXB/EpCr7kLAdwMUUZLRrYJwxLPci1hXr/U3f4+8xtu5KTUb bBWz4cbWKWPzYwGYjDrdOm8/zHofu64f95mE7DtURmZVe14zDsT4XeifXm3RC1cQe74w ohghY1gZ7MEoW7ZjgsGG74f04sMsXKSxtMraMflX8fYQgIdBotMOhlryYVNETvh+ytmB +1vca6Z/XGiK+5ZbNGva3ZsMqBp8W0hVyAvk9EDpa1czx1cN5WU9ZpsTACx9mdQOaUhl K03ZHlNlZ5QA5kx0r68IE2kM5rxgGvQ2ImpTgJ5b8vXOw1Se8jyCfIAzCmgCSvmxwOl4 AGyg== 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=PRQG6g+MUHSU/R8yPTlf3nRoJJmafVT52l/ZxTMw4nY=; b=AsvnYdGdHcBmaaqlp+vSV2m/fkRFuRZWwmos+0mdZQfX03wF2PvcXTQM0+sUbqbwX0 QxJ8om0bUP7P0PlpM4ZwMP6jp7Cy4unRvDdALFiXSh5/WsApFzcfmrRoap3Mna7mbB+o Arlu6f0vUoZPhvOpAx/wm/Fk2iEvt1p9Qt8ZVz+3GgbT1pVybk2Fdj/mhM9AOX5XBlzc 55HPnYMX9Y2G71j38O9tVoM911hbp/WGya4pWVQwPue/mN1o1jiA9tDUT9+wKmohJ3hi R4AMYmrkNMj3fBgUGpZ12TYhB1pzsGXjqrRFmcP/MIUF/gH8z0oHGZAc36Wv/ukswXQq +ZAA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@infradead.org header.s=casper.20170209 header.b=Wc86twxb; spf=softfail (google.com: domain of transitioning linux-kernel-owner@vger.kernel.org does not designate 23.128.96.19 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from lindbergh.monkeyblade.net (lindbergh.monkeyblade.net. [23.128.96.19]) by mx.google.com with ESMTPS id d131-20020a636889000000b0036c5b41b5c2si376442pgc.42.2022.03.02.15.21.46 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 02 Mar 2022 15:21:47 -0800 (PST) Received-SPF: softfail (google.com: domain of transitioning linux-kernel-owner@vger.kernel.org does not designate 23.128.96.19 as permitted sender) client-ip=23.128.96.19; Authentication-Results: mx.google.com; dkim=pass header.i=@infradead.org header.s=casper.20170209 header.b=Wc86twxb; spf=softfail (google.com: domain of transitioning linux-kernel-owner@vger.kernel.org does not designate 23.128.96.19 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by lindbergh.monkeyblade.net (Postfix) with ESMTP id B435B11AA08; Wed, 2 Mar 2022 14:57:56 -0800 (PST) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S238275AbiCBTTG (ORCPT + 99 others); Wed, 2 Mar 2022 14:19:06 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:46382 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S235020AbiCBTTE (ORCPT ); Wed, 2 Mar 2022 14:19:04 -0500 Received: from casper.infradead.org (casper.infradead.org [IPv6:2001:8b0:10b:1236::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 130F2220D5 for ; Wed, 2 Mar 2022 11:18:21 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=infradead.org; s=casper.20170209; h=In-Reply-To:Content-Type:MIME-Version: References:Message-ID:Subject:Cc:To:From:Date:Sender:Reply-To: Content-Transfer-Encoding:Content-ID:Content-Description; bh=PRQG6g+MUHSU/R8yPTlf3nRoJJmafVT52l/ZxTMw4nY=; b=Wc86twxb+Os6GNB2WIpAWPL9q2 KN7AKUPUJpRYYsgwSJj4x391dRruhCrrD6fyR4+RNpxF9cPoIrbfW92C9bvvK52aBOt4mB08d+IN6 vmxuvTATFik5BwFqPKuOVDfUPnv2nGAV4yRahqoLiA2Ud06ugiAMDOdvigNjroqcV2ahDdvucIuho GCzHWMmIw4NIrwnHAfRUGc8JX1Uap2X8l0K3jFKdapEhu+OxH7BuZzESVrv/v6qm3luanFz9W9Jxi xMEaY5m1VGB96asTvQ6JNjtj4pCngVoLDNvfm+UvKOHANs79TfcbYyCMY3/Bacv2Oj4+tMOaB9/dy WkzCsV4A==; Received: from j217100.upc-j.chello.nl ([24.132.217.100] helo=noisy.programming.kicks-ass.net) by casper.infradead.org with esmtpsa (Exim 4.94.2 #2 (Red Hat Linux)) id 1nPUUC-00AubU-Tk; Wed, 02 Mar 2022 19:18:09 +0000 Received: from hirez.programming.kicks-ass.net (hirez.programming.kicks-ass.net [192.168.1.225]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by noisy.programming.kicks-ass.net (Postfix) with ESMTPS id 51BCA30018E; Wed, 2 Mar 2022 20:18:06 +0100 (CET) Received: by hirez.programming.kicks-ass.net (Postfix, from userid 1000) id 14B733086C902; Wed, 2 Mar 2022 20:18:06 +0100 (CET) Date: Wed, 2 Mar 2022 20:18:06 +0100 From: Peter Zijlstra To: Matthew Wilcox Cc: Kees Cook , Ingo Molnar , Juri Lelli , Vincent Guittot , Dietmar Eggemann , Steven Rostedt , Ben Segall , Mel Gorman , Daniel Bristot de Oliveira , Linus Torvalds , linux-kernel@vger.kernel.org Subject: Re: [PATCH 00/19] Enable -Wshadow=local for kernel/sched Message-ID: References: <20220302043451.2441320-1-willy@infradead.org> <202203021030.EEEF58C2@keescook> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: X-Spam-Status: No, score=-2.0 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,HEADER_FROM_DIFFERENT_DOMAINS, MAILING_LIST_MULTI,RDNS_NONE,SPF_HELO_NONE,T_SCC_BODY_TEXT_LINE autolearn=no 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 Wed, Mar 02, 2022 at 06:43:57PM +0000, Matthew Wilcox wrote: > ie "__ret = freezable_schedule_timeout(__ret)" is supposed to refer to > the inner __ret, not the outer __ret. Which was the opposite of what > I thought was supposed to happen. > > We can fix this, of course. Something like ... > > #define ___wait_event_freezable_timeout(wq_head, condition, timeout, ret) \ > ___wait_event(wq_head, ___wait_cond_timeout(condition, ret), \ > TASK_INTERRUPTIBLE, 0, timeout, \ > ret = freezable_schedule_timeout(ret), ret) > > #define __wait_event_freezable_timeout(wq_head, condition, timeout) \ > ___wait_event_freezable_timeout(wq_head, condition, timeout, UNIQUE_ID) > > ... and now all the 'ret' refer to the thing that they look like they're > referring to. Right; so the trick is to make sure all ___wait_event() users will have a ret and then the inner ret can go away. The interruptible/timeout variants all already have a ret variable, but the unconditional things like wait_event() do not (which is where all the trouble started). By simply adding a ret variable, even to the variants without return value, the inner variable can go away and the shadowing goes away.