Received: by 2002:a25:c205:0:0:0:0:0 with SMTP id s5csp4408209ybf; Wed, 4 Mar 2020 03:22:54 -0800 (PST) X-Google-Smtp-Source: ADFU+vuOqV2fNKKDVDe8VgL2+wegRf9QjNI7CdYuQE//dqbEVCN+iA5BUXP4SvPJ22Q336kOC9wz X-Received: by 2002:a9d:53c4:: with SMTP id i4mr2048809oth.48.1583320974492; Wed, 04 Mar 2020 03:22:54 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1583320974; cv=none; d=google.com; s=arc-20160816; b=NgDr7Ax/nGjj5p+UxwkeqP4N5b9RGC5NZb2pLhXEVBtZPvfnLZaMOWymFCY95p50Iu 7oxl8cLiC9bUuNpyOe8Thfrbab1Ppq3wOec9ldY9hj1/U7E0B+A9eAEsEe6un3ysX6d1 hxi4gVelSttdSBmlS2Mf+JrCc/7g3BoNrxlPcuP3kiCatT1/RHjG/3uSfu+f3W25MB9R GDb4jpjqYKRXu8J+VJ2FpHsaing8nY5sb8NJ09wn2w7wRrnAiTwHOmBffnrfhj89Xnwu Mh5tvQ6spsDNLOboZ+XbqiV5nXIOPHfimsD+VlWGkQx/hZyh2hSs891UUGuGxZdXdbeC 7UsQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:to:in-reply-to:cc:references:message-id :date:subject:mime-version:from:content-transfer-encoding :dkim-signature; bh=0ndoGe5qwdHblj18NHAxI4x/qQzvTwAx0af3Gh2K+1s=; b=p3C0wxi9L48y8CkKLsofUIE+uixaMZ+axBSBCG4tFvIPSg5/Nr33mRFG/hiUbDCqbV Ezhsg7+L7QIxuyD8naKH+J84dYv2HE1ByP5KEAvBxohzem3ffsiraPzQi1TXBTWsRDpT 6ODS9u8kFx169XSE4iGCN4Id2yyC8rId2uBinrdXBpZqV6Ptl4GtW0ZHLpdvInVoozOr nIykYEGirduyrTtV3oNYPbGfN4Ojfw8k8RLYZ+4YMKxfEr87MRRXU8eXZeirEE10gKYi MCFi8UZnzc9kdnQudx2axLzIQLzG2Ko0lNrFThmlKGpIm7hshd9YLK584LTB6E2xl0Cj 53aA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@lca.pw header.s=google header.b=nAZKkTLE; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id g35si1048169otg.32.2020.03.04.03.22.41; Wed, 04 Mar 2020 03:22:54 -0800 (PST) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; dkim=pass header.i=@lca.pw header.s=google header.b=nAZKkTLE; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S2387799AbgCDLVA (ORCPT + 99 others); Wed, 4 Mar 2020 06:21:00 -0500 Received: from mail-qk1-f196.google.com ([209.85.222.196]:37334 "EHLO mail-qk1-f196.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S2387398AbgCDLVA (ORCPT ); Wed, 4 Mar 2020 06:21:00 -0500 Received: by mail-qk1-f196.google.com with SMTP id m9so1162552qke.4 for ; Wed, 04 Mar 2020 03:20:59 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=lca.pw; s=google; h=content-transfer-encoding:from:mime-version:subject:date:message-id :references:cc:in-reply-to:to; bh=0ndoGe5qwdHblj18NHAxI4x/qQzvTwAx0af3Gh2K+1s=; b=nAZKkTLEGDV6MeTXcfkjdC0zbxsF4m5MwH/M7EsMwd9L5jZ5EYp+iXB/e/O5U6uPQc Ump1A1RpxFY5yiaMFXOmKrgcpMcupstJLmzxFVc+RtLJq9Rc0pZvsnQbqu+0wgGt01BU ATvcY2ClY+ON1cLirxeFu9h2lfxVnhRJMbWQpyGOMA7vyKv4opDzGwTAIjrTl3jxOdCB e4mKTIG2Zvl6aNrnSVvUP39wXnGgquSgxZ8g6dV1wTcO5mIrGrLFIM6rO9FBIl5tjmEM XEkT7YqKvIdjw3YqaqUJ8u7YkR6vu/06lgFZdydtvh+S+xH45dkqrQwv8v+wc1U6rXiQ dHFw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:content-transfer-encoding:from:mime-version :subject:date:message-id:references:cc:in-reply-to:to; bh=0ndoGe5qwdHblj18NHAxI4x/qQzvTwAx0af3Gh2K+1s=; b=a5HwTHpEHILcArvIpo3cCXmrFDB312Rxh30qVo9aUL5sJlX2fEt1Wqnp/l74f3+X8V OCkyknIcB7kfmXDyUh8jjJO4FpZyUsZS20Gw0xs05DzVfxfVvmxRAW+Yzv0TWUv9c7od CCS957uhsr1JBswbjHaP+P2SH3s9jFNa8NcZcOAmw2VrhWlQ5y4U94X5dBaqQGSGj8I+ mMBQqcy85+CqOWUgtAf1NIduMjslJbP8ZxCB0XLvyU0ZFyTp2xxuK1fyYyvPAWkXdxKx D9dMNXaq2P0NoNjc1qB98Oq+bA8CF3hLHvR7qD4EhoQl2m4K4hkK460GUiHP+IO8zfDI mQhw== X-Gm-Message-State: ANhLgQ0zNE2mhnyBbW47gHmLcEoQUAUc8dK63KkZOeb/hbtkLAPVpGD8 b9NHClTs/TlAQGiZKubiIADSSA== X-Received: by 2002:a37:4351:: with SMTP id q78mr2360200qka.409.1583320859128; Wed, 04 Mar 2020 03:20:59 -0800 (PST) Received: from [192.168.1.183] (pool-71-184-117-43.bstnma.fios.verizon.net. [71.184.117.43]) by smtp.gmail.com with ESMTPSA id p77sm11244265qke.18.2020.03.04.03.20.58 (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Wed, 04 Mar 2020 03:20:58 -0800 (PST) Content-Type: text/plain; charset=us-ascii Content-Transfer-Encoding: quoted-printable From: Qian Cai Mime-Version: 1.0 (1.0) Subject: Re: [PATCH] tick/sched: fix data races at tick_do_timer_cpu Date: Wed, 4 Mar 2020 06:20:56 -0500 Message-Id: <1C65422C-FFA4-4651-893B-300FAF9C49DE@lca.pw> References: <87tv34laqq.fsf@nanos.tec.linutronix.de> Cc: fweisbec@gmail.com, mingo@kernel.org, elver@google.com, linux-kernel@vger.kernel.org, Peter Zijlstra In-Reply-To: <87tv34laqq.fsf@nanos.tec.linutronix.de> To: Thomas Gleixner X-Mailer: iPhone Mail (17D50) Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org > On Mar 4, 2020, at 4:39 AM, Thomas Gleixner wrote: >=20 > They are reported, but are they actually a real problem? >=20 > This completely lacks analysis why these 8 places need the > READ/WRITE_ONCE() treatment at all and if so why the other 14 places > accessing tick_do_timer_cpu are safe without it. >=20 > I definitely appreciate the work done with KCSAN, but just making the > tool shut up does not cut it. Looks at tick_sched_do_timer(), for example, if (unlikely(tick_do_timer_cpu =3D=3D TICK_DO_TIMER_NONE)) { #ifdef CONFIG_NO_HZ_FULL WARN_ON(tick_nohz_full_running); #endif tick_do_timer_cpu =3D cpu; } #endif /* Check, if the jiffies need an update */ if (tick_do_timer_cpu =3D=3D cpu) tick_do_update_jiffies64(now); Could we rule out all compilers and archs will not optimize it if !CONFIG_NO= _HZ_FULL to, if (unlikely(tick_do_timer_cpu =3D=3D TICK_DO_TIMER_NONE) || tick_do_timer_c= pu =3D=3D cpu) tick_do_update_jiffies64(now); So it could save a branch or/and realized that tick_do_timer_cpu is not used= later in this cpu, so it could discard the store? I am not all that familiar with all other 14 places if it is possible to hap= pen concurrently as well, so I took a pragmatic approach that for now only d= eal with the places that KCSAN confirmed, and then look forward for an incre= mental approach if there are more places needs treatments later once confirm= ed.=