Received: by 2002:a25:8b91:0:0:0:0:0 with SMTP id j17csp2430805ybl; Thu, 9 Jan 2020 12:37:50 -0800 (PST) X-Google-Smtp-Source: APXvYqydAtQHOPLeWkcukoIx+QVSu8Tl2PxLUTkQiPyOE9IGOVBzcoL7lALRA+KMQt3U6NYUidpy X-Received: by 2002:a05:6830:1e09:: with SMTP id s9mr10290262otr.139.1578602270584; Thu, 09 Jan 2020 12:37:50 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1578602270; cv=none; d=google.com; s=arc-20160816; b=THEFUDMUwFYOcSfbqTMySIQLla/KT/0K6WJ/Zj4vGe+jzBUIHdt0RYukK8RHmCWBPa Z4d/aLdPhGThv9XnPxGNik+I1EhVn+gqAU27EoYJiWrZ+OA1uvdWfpTGAdPD8o9haA+1 Gsl4gzTv5pJ7Y08UD43dAHGCjrFgrlgfrQYLnEsRcXqBrGu/939S8GdOon8Bbq9/6Uir zNuyYnP8WSU1ddlEgA6Azf8HH9fwSkCLtOJw2vyIues5btETakVkzj708auA/k2eV8bl HE3vccjWNurHU+C7z8K/xzZBCIAZA8WR6tIM4D3BcgWtQN3BJNIj0+6DjWJcpngWa4E0 fzUg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:user-agent:in-reply-to :content-disposition:mime-version:references:reply-to:message-id :subject:cc:to:from:date:dkim-signature; bh=+sqboeOqspBferF0yBDXgOWkjy1Oizc0fvzsk/EVKMk=; b=aF5vYZ/2XZNcY78xEQoBp16N6kf11L39vTCohKzoEStmhe+r+rL0SoXY1BrvnEqP+1 1NLZLppOJW4guM9OmmD//acOvW5cBjsLK0i6C4m2iSuyTjPOmANez91L6qdMx16yWt5L D/zToDds3Vhwjjusc58VIIpb7fNar0jH20yR01gIZ65MZNPiW/irozwL3OLM9Tu2Utt0 DkNooSpqIhqz0T39EAS4ssSe/jor7F9kHGzt0Qz1JOOxFV2CW82ikcQkzBmOCP/V/p5x Et5TNI8XyIsDvvBB1YVjieECijfizEHA5v3vCaEucSHGAU5eMbiezIaeU6Qcnlc+7AK+ MjLQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b=okV7QnL7; 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; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id n139si4098170oig.121.2020.01.09.12.37.39; Thu, 09 Jan 2020 12:37:50 -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=@kernel.org header.s=default header.b=okV7QnL7; 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; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1731775AbgAIRb3 (ORCPT + 99 others); Thu, 9 Jan 2020 12:31:29 -0500 Received: from mail.kernel.org ([198.145.29.99]:58456 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1725775AbgAIRb2 (ORCPT ); Thu, 9 Jan 2020 12:31:28 -0500 Received: from paulmck-ThinkPad-P72.home (50-39-105-78.bvtn.or.frontiernet.net [50.39.105.78]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPSA id E551D206ED; Thu, 9 Jan 2020 17:31:27 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1578591088; bh=kAELsAus/a9uHAqw2aOdcjqraa5dn308eu6P5pHzB1Q=; h=Date:From:To:Cc:Subject:Reply-To:References:In-Reply-To:From; b=okV7QnL7vCzfcUCT1UIXSsGC75JmDLCt3ZNyzEhGn4w9Keg7+4Q1hgpcF6Rks4Ycn UgEIEo+JoWHgEb0ecWjfGJuWedMJnJlmgZ6PlI8DmayJX9hWIIjcoQ9ELJlKqWnDTW 2dKjJdh3KYMOkxEsKzKwUaYGVoDWJAw3LB1XvYnY= Received: by paulmck-ThinkPad-P72.home (Postfix, from userid 1000) id 94605352272E; Thu, 9 Jan 2020 09:31:27 -0800 (PST) Date: Thu, 9 Jan 2020 09:31:27 -0800 From: "Paul E. McKenney" To: Marco Elver Cc: Andrey Konovalov , Alexander Potapenko , Dmitry Vyukov , kasan-dev , LKML Subject: Re: [PATCH -rcu 0/2] kcsan: Improvements to reporting Message-ID: <20200109173127.GU13449@paulmck-ThinkPad-P72> Reply-To: paulmck@kernel.org References: <20200109152322.104466-1-elver@google.com> <20200109162739.GS13449@paulmck-ThinkPad-P72> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: User-Agent: Mutt/1.9.4 (2018-02-28) Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Thu, Jan 09, 2020 at 06:03:39PM +0100, Marco Elver wrote: > On Thu, 9 Jan 2020 at 17:27, Paul E. McKenney wrote: > > > > On Thu, Jan 09, 2020 at 04:23:20PM +0100, Marco Elver wrote: > > > Improvements to KCSAN data race reporting: > > > 1. Show if access is marked (*_ONCE, atomic, etc.). > > > 2. Rate limit reporting to avoid spamming console. > > > > > > Marco Elver (2): > > > kcsan: Show full access type in report > > > kcsan: Rate-limit reporting per data races > > > > Queued and pushed, thank you! I edited the commit logs a bit, so could > > you please check to make sure that I didn't mess anything up? > > Looks good to me, thank you. > > > At some point, boot-time-allocated per-CPU arrays might be needed to > > avoid contention on large systems, but one step at a time. ;-) > > I certainly hope the rate of fixing/avoiding data races will not be > eclipsed by the rate at which new ones are introduced. :-) Me too! However, on a large system, duplicate reports might happen quite frequently, which might cause slowdowns given the single global array. Or maybe not -- I guess we will find out soon enough. ;-) But I must confess that I am missing how concurrent access to the report_times[] array is handled. I would have expected that rate_limit_report() would choose a random starting entry and search circularly. And I would expect that the code at the end of that function would instead look something like this: if (ktime_before(oldtime, invalid_before) && cmpxchg(&use_entry->time, oldtime, now) == oldtime) { use_entry->frame1 = frame1; use_entry->frame2 = frame2; } else { // Too bad, next duplicate report won't be suppressed. } Where "oldtime" is captured from the entry during the scan, and from the first entry scanned. This cmpxchg() approach is of course vulnerable to the ->frame1 and ->frame2 assignments taking more than three seconds (by default), but if that becomes a problem, a WARN_ON() could be added: if (ktime_before(oldtime, invalid_before) && cmpxchg(&use_entry->time, oldtime, now) == oldtime) { use_entry->frame1 = frame1; use_entry->frame2 = frame2; WARN_ON_ONCE(use_entry->time != now); } else { // Too bad, next duplicate report won't be suppressed. } So what am I missing here? Thanx, Paul > Thanks, > -- Marco > > > Thanx, Paul > > > > > kernel/kcsan/core.c | 15 +++-- > > > kernel/kcsan/kcsan.h | 2 +- > > > kernel/kcsan/report.c | 153 +++++++++++++++++++++++++++++++++++------- > > > lib/Kconfig.kcsan | 10 +++ > > > 4 files changed, 148 insertions(+), 32 deletions(-) > > > > > > -- > > > 2.25.0.rc1.283.g88dfdc4193-goog > > > > > > > -- > > 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/20200109162739.GS13449%40paulmck-ThinkPad-P72.