Received: by 2002:a05:6a10:f347:0:0:0:0 with SMTP id d7csp2304238pxu; Mon, 7 Dec 2020 03:08:19 -0800 (PST) X-Google-Smtp-Source: ABdhPJwfyrHaFwyJeA89v66fKn8BGaraM1VId5FB8fS99PpjbL1VJPxYwQjyokjrGthKTz/4gcUE X-Received: by 2002:a17:906:7e43:: with SMTP id z3mr18230891ejr.67.1607339299315; Mon, 07 Dec 2020 03:08:19 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1607339299; cv=none; d=google.com; s=arc-20160816; b=hYFzOfB1vfFnsoOXHzmxUyKxO20YnBYutKo/Cxf3v4c+DyON1/A6oUKSMGHpklXIIU ta5J+n8vtQsS4Gk3XVXASm6DsNazcEMquWbHbg2fjlOZSjkmspO+3XjsA4ASZGpFFGnJ LoOJlAH6KNSYcEfnlD0mB8EoFoj2pkU7a4a6iAiAoEbuEbT519joE3zk1g76EUaLZkCT mzdskxMsmeiftx9KVTOmPnPNyoOD/0N7oy+qsRUEki1q/ORMBV5GlRarJ86geBpcOVck g6WfwtaVPLSYin9faFESy/ZPSUtSxUPqomavS8gDZPkdqdmlZBQWocFoTf/lhvHutXkF 4yww== 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=FJXCIOJkKH6hh2jpxv9ilCGF+BcWVUo0z/wPZmqyr0o=; b=YcO15/MVWarbC8p5jkvhK9PIxOMd90BsIwJf9D85yRVBZGk5whDfduingJVQ2pG5yB Pa4f6qZYbKMHAMlFa1JdNpO8ZKhi+D6fBcezix3uiaCtgUxYF53EwUDf0h/p9fK58vUk u58gBhKFGsvY001UD1WPGvHZ2lRjE3xs2YHFgsTPC7dQSaqzznGTnloR/wfNRP+o13mG NbC2Y4ZsF09pQ705MtwndhUGvsmFYzRM23LrwtKgIsIOZPJR4ppglWItMMtO/7ylvBwx mN8APpYeZQU31aK/FvI1ockuqld7GvIKlQdowrB7hIGT66Ox+DigpqfpvRmo0QikuuCy PiPg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@google.com header.s=20161025 header.b=iCLr+DpH; 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 1si8050794edv.426.2020.12.07.03.07.56; Mon, 07 Dec 2020 03:08:19 -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=iCLr+DpH; 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 S1726417AbgLGLGM (ORCPT + 99 others); Mon, 7 Dec 2020 06:06:12 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:36424 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726244AbgLGLGM (ORCPT ); Mon, 7 Dec 2020 06:06:12 -0500 Received: from mail-oi1-x22c.google.com (mail-oi1-x22c.google.com [IPv6:2607:f8b0:4864:20::22c]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 19ACEC0613D1 for ; Mon, 7 Dec 2020 03:05:32 -0800 (PST) Received: by mail-oi1-x22c.google.com with SMTP id v85so4388023oia.6 for ; Mon, 07 Dec 2020 03:05:32 -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=FJXCIOJkKH6hh2jpxv9ilCGF+BcWVUo0z/wPZmqyr0o=; b=iCLr+DpHSbjjRpluEXnY/MbwwQFSTGIXeRIznSr1aKN8Q4CJ/caeEz7lHYB0v5P83A L5tid+yg5BlkoMMjArpvpuvL0uo3nhulaVvOviMSherdOI0kYeH8qlJc+mA9W77hOlOs m2bWX+mGxPPbAtKwiTfkVppZ+k0Gg5P/jXaEWAdAf1ZXdxiI9wU320g61JOpSGogktR+ K5nhyl9AfLC8pAOyU6pKOnfMArJrYlH1qxZFjBUHJeK4yR/J0HoljQ0oJzYgILBPCgKF +LTDMA4E4T+wzKsVUSzcAEzfeatc97DniIjZI4TjeaP3qfa0NdxSd1Hv0uSzZjn/vDcA dsCg== 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=FJXCIOJkKH6hh2jpxv9ilCGF+BcWVUo0z/wPZmqyr0o=; b=Xl40F3ONo8g/XpTvWJvIF0K3JviQqXEKDzyYLCwugQcv2qy/+8ayq3sTlat3iABBH0 7+UVBu0Wp4DqDhLT/y+TlMtoTIouQJ+DWphdEVnWICt7u2U76OKrpg+3L9IwgFLJfvZE 45/8IpCnLDKEa/0JEdiIGZzlgkDKDQdi4msu6vEdtF13BznP+jF7243eUqtJqvUCba4z gNKvJwVvq56+7BC9Nc15G8/dgG402ThTNoLmfV6bLpgJxkcCkMaua6av02RABK4rJ0Wg Z07HoUCoKxIbLoA91uNyHSPiCY6hsxSr8hOxQAW/A5jICTGUGRELwpGfkkk08pIJdfsK gY6A== X-Gm-Message-State: AOAM532jOTlxG1+qrzXCcb/92wiZuVhyjzfhYA1QWafDo6m9uCAgYuYv erqMl1myOZ2fr79xO7uhpwMR5B/eQB91syurNinUwQ== X-Received: by 2002:a05:6808:313:: with SMTP id i19mr12226310oie.70.1607339130259; Mon, 07 Dec 2020 03:05:30 -0800 (PST) MIME-Version: 1.0 References: <20201206211253.919834182@linutronix.de> In-Reply-To: <20201206211253.919834182@linutronix.de> From: Marco Elver Date: Mon, 7 Dec 2020 12:05:18 +0100 Message-ID: Subject: Re: [patch 0/3] tick: Annotate and document the intentionaly racy tick_do_timer_cpu To: Thomas Gleixner Cc: LKML , kasan-dev , Peter Zijlstra , "Paul E. McKenney" , Ingo Molnar , Frederic Weisbecker , Will Deacon , Naresh Kamboju , Dmitry Vyukov Content-Type: text/plain; charset="UTF-8" Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Sun, 6 Dec 2020 at 22:21, Thomas Gleixner wrote: > There have been several reports about KCSAN complaints vs. the racy access > to tick_do_timer_cpu. The syzbot moderation queue has three different > patterns all related to this. There are a few more... > > As I know that this is intentional and safe, I did not pay much attention > to it, but Marco actually made me feel bad a few days ago as he explained > that these intentional races generate too much noise to get to the > dangerous ones. My strategy so far was to inspect random data races and decide which ones might be more interesting and send those, but I haven't had time to chase data races the past few months. Thus, getting rid of the intentional boring ones will definitely scale better -- relying on a human to do filtering really is suboptimal. :-) > There was an earlier attempt to just silence KCSAN by slapping READ/WRITE > once all over the place without even the faintiest attempt of reasoning, > which is definitely the wrong thing to do. > > The bad thing about tick_do_timer_cpu is that its only barely documented > why it is safe and works at all, which makes it extremly hard for someone > not really familiar with the code to come up with reasoning. > > So Marco made me fast forward that item in my todo list and I have to admit > that it would have been damned helpful if that Gleixner dude would have > added proper comments in the first place. Would have spared a lot of brain > twisting. :) > > Staring at all usage sites unearthed a few silly things which are cleaned > up upfront. The actual annotation uses data_race() with proper comments as > READ/WRITE_ONCE() does not really buy anything under the assumption that > the compiler does not play silly buggers and tears the 32bit stores/loads > into byte wise ones. But even that would cause just potentially shorter > idle sleeps in the worst case and not a complete malfunction. Ack -- thanks for marking the accesses! Thanks, -- Marco