Received: by 2002:a25:868d:0:0:0:0:0 with SMTP id z13csp1428369ybk; Thu, 21 May 2020 06:43:58 -0700 (PDT) X-Google-Smtp-Source: ABdhPJwi5/zfse/U93GpnUdJQXiz2I24jfJQG+dIIz2NOQfBxGn2ErPebl+/6MUycqQA+aOTi//k X-Received: by 2002:a17:906:2cc2:: with SMTP id r2mr3451933ejr.269.1590068638697; Thu, 21 May 2020 06:43:58 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1590068638; cv=none; d=google.com; s=arc-20160816; b=H8RumhTJBzDN1ww9F75q20qNgYIzU2sqZBrllBFIgvdysmyfZVyQry45fyn59NBZAV u3ELvbQjg2x0sSiZZJYDiC8zz0lUpktmCagPPeMnMVfWQGqKWaruShhgOr6A0xP9p7jb j3oEx5frPgHyjrrFP34uZtfvZ5JKCsUhDl8Bd0vQATjV34Et4+d66FBxOOVZSKw2cWwo XI0WwWhuQ+UsC3VKNxIOLJYOL/VDLMXN5CCETIxTWQ2N1MElT3TqWNjD5heWucgnP437 RSIYHrsTiuwgxh7M5pWX1sfJcqgDMZ35lvzFXYwPoj8zJw3Mkxt3C+/47bPIJiMFKJsO 26ng== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:cc:to:subject:message-id:date:from :in-reply-to:references:mime-version:dkim-signature; bh=L/LyXHTvDj+xHsQkYhu/jnhClGb0G5rs8Coqbegx7nM=; b=qktQpP+XukmAkAgNmrPO1b3wCvYqiv/72oMOZzTJkfZzvKWcyfpbu0O4MoSx3sqB0W oaIRV5yScNcrrzv3O2t/tgxIBq+TCJOSDAOhHFvg1hFfxct1dHeAPEa+W54iYS8v0gTS Rmy+wpPcsKvrLyxcy5Qnb/JyWzvrn7TvR+jY8o2IyHkJaXcAFRhHDiW9T6RERVap5Nhu MdTEDfQfJNXu6qpi5jgg69RDgLG2cAuXICtkndsjXokW6mUvXKVHQ3HqYu/aVgs5m2HI aLBP+w3Cz1KHZp7ggoMoBwMaSWPFsIPLegT3TmzESuh/0fytuMsfXAuPEFrFnSFgcn86 eyJg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@google.com header.s=20161025 header.b=gA+IMnIW; 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=REJECT sp=REJECT dis=NONE) header.from=google.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id n4si3460974eje.295.2020.05.21.06.43.34; Thu, 21 May 2020 06:43:58 -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=@google.com header.s=20161025 header.b=gA+IMnIW; 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=REJECT sp=REJECT dis=NONE) header.from=google.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1729460AbgEUNjw (ORCPT + 99 others); Thu, 21 May 2020 09:39:52 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:47008 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726856AbgEUNjv (ORCPT ); Thu, 21 May 2020 09:39:51 -0400 Received: from mail-ot1-x341.google.com (mail-ot1-x341.google.com [IPv6:2607:f8b0:4864:20::341]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 29E9CC061A0E for ; Thu, 21 May 2020 06:39:51 -0700 (PDT) Received: by mail-ot1-x341.google.com with SMTP id a68so5489553otb.10 for ; Thu, 21 May 2020 06:39:51 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20161025; h=mime-version:references:in-reply-to:from:date:message-id:subject:to :cc; bh=L/LyXHTvDj+xHsQkYhu/jnhClGb0G5rs8Coqbegx7nM=; b=gA+IMnIWefySBK7Y5AOEqA4qyb1T8MlYmmm7P7k0AUZBHz4PDZUxkPPqT2aVl/DMGz 4h79R/h0tBYsUnlxxxy0w5mH/9Q6zCLbQDkoKTHhPfzuGDx2sSr2HJU7WnUdr2DjH0Bq HVTxm4b/OyI+DKssmHuDHNXJbXNr3v9f7IlXhMBbiiPbFElFlAtpVTI1tZLJ8Jaq3rJ4 pEJMLtvm9JzTMbht9dx8r9trHuTZNAesMLYwY6fMH5nHAQl0EnPTBPsxAukl3QbhTGjj lXlF9HNhcIaguqk9ShQjfQCh6ibVIdl5IEEcpiDoSmfcCLvHw4eUZK0kQi6D6WriCW4U bavQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:references:in-reply-to:from:date :message-id:subject:to:cc; bh=L/LyXHTvDj+xHsQkYhu/jnhClGb0G5rs8Coqbegx7nM=; b=mt9HOwbuPjy9uLRjIc3mGFg0hsy9Jiz7dK8cp4WcS+f+5Ofxwpy1vEUGkMgzb74okL a7vCoQdgJa2JXuxi90XuF2Ica0x30L9xU1VcQ48LFaZS9xgp1mxB7pCajiStzrtGXgcm 04KDS90GzHiN9wLFVI2uX3tECTPc3kT1W1xD38x9kt25yQ+oJS+QNcAix8mYuxsPyLYk ma825IOY3QbRYwZ9gAendZbkznTY6CihClpjYoI+AQZCAfBAhntCUpbjFmcwHUQX+Ubp V2o0+MU9OarKfevuviwuii168tYc/GOpZLS9ulMJ5nqVp5Shjzdntr7efgjbentpETN9 0bNw== X-Gm-Message-State: AOAM530Gt/nbM0a9zRn0xObafNqeEGZOJl+1WhiVq0AoAuf8df9zR+rI PN98JIJ9A4SXvaWlvaYKrKDc+kaNRwq5Ix6+LArTcA== X-Received: by 2002:a9d:27a3:: with SMTP id c32mr7608614otb.233.1590068390262; Thu, 21 May 2020 06:39:50 -0700 (PDT) MIME-Version: 1.0 References: <20200521110854.114437-1-elver@google.com> <20200521110854.114437-10-elver@google.com> <20200521133150.GB6608@willie-the-truck> In-Reply-To: <20200521133150.GB6608@willie-the-truck> From: Marco Elver Date: Thu, 21 May 2020 15:39:38 +0200 Message-ID: Subject: Re: [PATCH -tip v2 09/11] data_race: Avoid nested statement expression To: Will Deacon Cc: "Paul E. McKenney" , Dmitry Vyukov , Alexander Potapenko , Andrey Konovalov , kasan-dev , LKML , Thomas Gleixner , Ingo Molnar , Peter Zijlstra , clang-built-linux , Borislav Petkov Content-Type: text/plain; charset="UTF-8" Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Thu, 21 May 2020 at 15:31, Will Deacon wrote: > > On Thu, May 21, 2020 at 01:08:52PM +0200, Marco Elver wrote: > > It appears that compilers have trouble with nested statements > > expressions, as such make the data_race() macro be only a single > > statement expression. This will help us avoid potential problems in > > future as its usage increases. > > > > Link: https://lkml.kernel.org/r/20200520221712.GA21166@zn.tnic > > Signed-off-by: Marco Elver > > --- > > v2: > > * Add patch to series in response to above linked discussion. > > --- > > include/linux/compiler.h | 9 ++++----- > > 1 file changed, 4 insertions(+), 5 deletions(-) > > > > diff --git a/include/linux/compiler.h b/include/linux/compiler.h > > index 7444f026eead..1f9bd9f35368 100644 > > --- a/include/linux/compiler.h > > +++ b/include/linux/compiler.h > > @@ -211,12 +211,11 @@ void ftrace_likely_update(struct ftrace_likely_data *f, int val, > > */ > > #define data_race(expr) \ > > ({ \ > > + __unqual_scalar_typeof(({ expr; })) __v; \ > > __kcsan_disable_current(); \ > > - ({ \ > > - __unqual_scalar_typeof(({ expr; })) __v = ({ expr; }); \ > > - __kcsan_enable_current(); \ > > - __v; \ > > - }); \ > > + __v = ({ expr; }); \ > > + __kcsan_enable_current(); \ > > + __v; \ > > Hopefully it doesn't matter, but this will run into issues with 'const' > non-scalar expressions. Good point. We could move the kcsan_disable_current() into ({ __kcsan_disable_current(); expr; }). Will fix for v3. Thanks, -- Marco > Will > > -- > You received this message because you are subscribed to the Google Groups "kasan-dev" group. > To unsubscribe from this group and stop receiving emails from it, send an email to kasan-dev+unsubscribe@googlegroups.com. > To view this discussion on the web visit https://groups.google.com/d/msgid/kasan-dev/20200521133150.GB6608%40willie-the-truck.