Received: by 2002:a05:6a10:f347:0:0:0:0 with SMTP id d7csp2597949pxu; Mon, 7 Dec 2020 10:25:02 -0800 (PST) X-Google-Smtp-Source: ABdhPJwOMLapFr5hn05zAVr0YAiC3ubpyz5BeRZXYnZBCq4IJoVOg1Xizh4nqhpMsTz2j234us4Y X-Received: by 2002:a05:6402:1a2f:: with SMTP id be15mr21223909edb.209.1607365502480; Mon, 07 Dec 2020 10:25:02 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1607365502; cv=none; d=google.com; s=arc-20160816; b=hun2ISeZs4hFKhUp8FKtoYdSLLCnXseiI3qimzcOyTuGrjJMZxBI+nl+AAbrg25bGU 7cZeTrK4JKHUdq/mRYPU00OGEvheDuMdqtWZA0OAzjXgHFcQYZWDLyrwPXkyNCCdta+R CXA/FP6tI/I44AinpyRrvFGum2TO2veTE8fR7QvLLld7ne2i53bkYxaSX3oWkLWewc6y t6QHQzWaSPtw7gGW8RHSlVCh2huxAzZ5ojk7nH41gk2E2QImu2TmBKEcBypBu++O2lh8 WWgs47BBc9TzCiLPAsCjTu+1ddYUIs95hERTM1MOAq+QFvxK2giwOa/dgne7VvhUK3/F +W2w== 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=/cDWtNYa74vRqhGITCqKQSyTcWEEsS+Eii6uHXqsS8E=; b=jJ1fiff75+8ulRw//HkqFXFYbO38Gv9MujNkC/cKf6cLD8svNL59DV+1ZIKboJB6UU h6OgnLLnxGbHo828Aw2w1nQrH2XBjOa59iSuJAk1WLyELGMSIqesP4mJpPSgiCsochgp eSLxwSQqD2/wfU8ep6/tT5mGy0nn+0BzwlVc/zoPnQPWlZ6p5481C+kRonoVXTkIj+88 rBf72hqyDJSo02XqdlhYDG1w0OYiNaKcj8mTf+XhrORYlpE2Y0SStyim+LumCB5Itf9u cVxEhVr/765MIsmlOv/LsfIz7EDGXqfWuOwjdX15dIfT3sjEoZo6c2VyjBJ8pUkZesNV Zc3g== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@google.com header.s=20161025 header.b=AL3RDltq; 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 a42si10197223edf.129.2020.12.07.10.24.33; Mon, 07 Dec 2020 10:25:02 -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=@google.com header.s=20161025 header.b=AL3RDltq; 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 S1726337AbgLGSUo (ORCPT + 99 others); Mon, 7 Dec 2020 13:20:44 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:47964 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1725822AbgLGSUo (ORCPT ); Mon, 7 Dec 2020 13:20:44 -0500 Received: from mail-ot1-x343.google.com (mail-ot1-x343.google.com [IPv6:2607:f8b0:4864:20::343]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id DD120C061794 for ; Mon, 7 Dec 2020 10:20:03 -0800 (PST) Received: by mail-ot1-x343.google.com with SMTP id b62so13375979otc.5 for ; Mon, 07 Dec 2020 10:20:03 -0800 (PST) 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=/cDWtNYa74vRqhGITCqKQSyTcWEEsS+Eii6uHXqsS8E=; b=AL3RDltqpqgmduIWDHjvNYyzEa+ZPRYadSyB0h4WdZo3xluwhakDvp1cQmCT48hkub yBkbrzlKWD6ejXvNg6L4lm4h3B2h7Mf66PqmJQenszMaZ06XRi+ulpNZSd+dTJwdTBZc hbU4fqB4z6UxnGzOWeEJMRaCrOUvhyxXcjjKjARndpNKrHg6oKy89IIBevbkdVeAxHcU gW+/lUx5PKDqj57v2Si3YaTpQf5GU634VgW8RCtdum4plJTkCAl+jMU/0Eh3jtASqxJV afhrT3rJzF3n3jVJmLB9VQ+KOS1E4T1aFvFyUp2v7VEhdSAp0n4oVuUX0CKy5J9Euenu dY2g== 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=/cDWtNYa74vRqhGITCqKQSyTcWEEsS+Eii6uHXqsS8E=; b=njUUcjBh0/1y12VLzmWKhC/C2trT7DWrXpr26NGGa0qJlTpssE6AoPrYGppFLArXwH p6U1HNnOZ+Fc4WxYuMLJiJgTFhyS2Ydq2Yeh4NHSdOJ54UzIO0MzDyJK+xxf7clOykvc Ht4orWtM3BtJ4p3FocQp1WpxZc98v6ZOcDBZm6u5wiFT0st+Hq+uda1ln8ScSxvVs5wb fxEOQk1xwuORGhr8kxkL/iDDi4LZz6SwHPU2IDkOh1/M+PlIBrj7wMCF7jy7ntadGC5O hsnNRmCwt11uJFQ9LNLheeMv9O2d6PIVIaOKUvA/Xv4IeXnDeyatrYW1x9tozW5xP2Av smEg== X-Gm-Message-State: AOAM530XdDiHaLgcEAH0phbXxTai96YRj8CarQru/FuRSZTTQXDvpR8m fxXo3XFUhqpkmH7FQz2tA6hNjZHGPBL4X72BxCleYA== X-Received: by 2002:a9d:7cc8:: with SMTP id r8mr14105256otn.233.1607365203049; Mon, 07 Dec 2020 10:20:03 -0800 (PST) MIME-Version: 1.0 References: <20201206211253.919834182@linutronix.de> <20201206212002.876987748@linutronix.de> <20201207120943.GS3021@hirez.programming.kicks-ass.net> <87y2i94igo.fsf@nanos.tec.linutronix.de> In-Reply-To: <87y2i94igo.fsf@nanos.tec.linutronix.de> From: Marco Elver Date: Mon, 7 Dec 2020 19:19:51 +0100 Message-ID: Subject: Re: [patch 3/3] tick: Annotate tick_do_timer_cpu data races To: Thomas Gleixner Cc: Peter Zijlstra , LKML , kasan-dev , "Paul E. McKenney" , Ingo Molnar , Frederic Weisbecker , Will Deacon , Naresh Kamboju , syzbot+23a256029191772c2f02@syzkaller.appspotmail.com, syzbot+56078ac0b9071335a745@syzkaller.appspotmail.com, syzbot+867130cb240c41f15164@syzkaller.appspotmail.com Content-Type: text/plain; charset="UTF-8" Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Mon, 7 Dec 2020 at 18:46, Thomas Gleixner wrote: > On Mon, Dec 07 2020 at 13:09, Peter Zijlstra wrote: > > On Sun, Dec 06, 2020 at 10:12:56PM +0100, Thomas Gleixner wrote: > >> + if (data_race(tick_do_timer_cpu) == TICK_DO_TIMER_BOOT) { > > > > I prefer the form: > > > > if (data_race(tick_do_timer_cpu == TICK_DO_TIMER_BOOT)) { > > > > But there doesn't yet seem to be sufficient data_race() usage in the > > kernel to see which of the forms is preferred. Do we want to bike-shed > > this now and document the outcome somewhere? > > Yes please before we get a gazillion of patches changing half of them > half a year from now. That rule should be as simple as possible. The simplest would be: "Only enclose the smallest required expression in data_race(); keep the number of required data_race() expressions to a minimum." (=> want least amount of code inside data_race() with the least number of data_race()s). In the case here, that'd be the "if (data_race(tick_do_timer_cpu) == ..." variant. Otherwise there's the possibility that we'll end up with accesses inside data_race() that we hadn't planned for. For example, somebody refactors some code replacing constants with variables. I currently don't know what the rule for Peter's preferred variant would be, without running the risk of some accidentally data_race()'d accesses. Thoughts? Thanks, -- Marco