Received: by 2002:a25:e74b:0:0:0:0:0 with SMTP id e72csp766937ybh; Tue, 21 Jul 2020 07:29:45 -0700 (PDT) X-Google-Smtp-Source: ABdhPJxiHVBBntKBqnjW18l6vvjDHUY0fC/FRJ7JZnP7+AudTUmW9GvODpm/qoYUdTPTNtkS+GRs X-Received: by 2002:a17:906:8417:: with SMTP id n23mr22562538ejx.192.1595341784871; Tue, 21 Jul 2020 07:29:44 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1595341784; cv=none; d=google.com; s=arc-20160816; b=aEyn1Lnfy6xIXH+Fw6eypzzIMEw43IQi0Bv4FPR5FuvWXD18oEN+uBT1AV8fxYnbx5 gn5oOizicpEVyrbaY/7igqE6jeqcXOte8tCjUDEFiRofH6IANhelKP51j/CmxRO9hGrD pKuOfdIiF4aIv4CZk/b5/VKnPb0oZvPpgKWz4FTPS3SHJ4uc/l+lOdYwTMwIAIQ9iOey gG0JDSrh+LRKSLb+rZN7EODcS7/FYKTBN3H5sddvrbUefwWo4qA9Iv+DVPsTPFeoHRz2 hwg0inOBTGIbJ+Xi7uFcBHlFkaG4OW1qt55u98L9L6ZDNx8oa72KNDzCXAg6qJrdSP/2 NB7Q== 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:message-id:subject:cc :to:from:date:dkim-signature; bh=kvJLCEgw2Y91sCTQ6JSG1TMyYmzQtuSE0ssBK5vqs5A=; b=lB5+0vTxc18w72lRTQAUVplO8TDIc9815bOshCmkdz8Opm+8NgWps57VCYrduw7qQ9 E2JIZT4qtQWoe/sT0BKoggpxouqBy3vPO+Hr3Sh8OiM7bHYCYJHdnDLNPolf1wUs33Ss ualD9xMAPLR2Mu/ZdcwZnmsIg+VZczbRbZPdMpHYJFS3A9KKifzM6JBiY+sbiuUI/Hu6 8yhygR2uVvu9ViwLN9qc4mo/Zrh3KohreDYNSvjjtoFcQQQRDGUuZno6YT0PwWeBFvzZ qz6kZk3ps09WyH2UMxQ/qkgaXHMBF6YvAqT7ANVtHgbFzJMKb2oSbi3h5xCLtEn9+6qS /wVg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@google.com header.s=20161025 header.b=Tn+r0hMi; 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 v18si12986238edy.249.2020.07.21.07.29.22; Tue, 21 Jul 2020 07:29:44 -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=Tn+r0hMi; 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 S1728839AbgGUO1E (ORCPT + 99 others); Tue, 21 Jul 2020 10:27:04 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:53932 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1728547AbgGUO1D (ORCPT ); Tue, 21 Jul 2020 10:27:03 -0400 Received: from mail-wr1-x441.google.com (mail-wr1-x441.google.com [IPv6:2a00:1450:4864:20::441]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 37C5DC0619DA for ; Tue, 21 Jul 2020 07:27:03 -0700 (PDT) Received: by mail-wr1-x441.google.com with SMTP id z2so21455309wrp.2 for ; Tue, 21 Jul 2020 07:27:03 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20161025; h=date:from:to:cc:subject:message-id:references:mime-version :content-disposition:in-reply-to:user-agent; bh=kvJLCEgw2Y91sCTQ6JSG1TMyYmzQtuSE0ssBK5vqs5A=; b=Tn+r0hMiMyEfGIJmZgmo6wJEFjb2HH6GCrM+njCb9LqnllYAU1jL/tRFHVOeISf8V0 cUgzOv7/XLu0fcSl8pd3MBTDTZY4dB7Vj4ztR+pUk27T4bLEaDmQjd870ztfZE0Kh12K 4qq1hYirQGcUBcFBjWPZSZhsCbhkLRbJfpQswZDiNdzKd7iwJfENFFapWeWcielyE7x8 zoi0q6a4YYf2XTduTfPeWTq3gUNdYH24cM0O/EmtkUk2u7/Fq5B8/oEPdSSJJ8E2fXK8 1PxAqg5uOIoTDm453qNw/rmJn2Qqgv6kUu99tXCA1QdwzumYYSbR+0M+eaovBe/b9MlF cNlA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:date:from:to:cc:subject:message-id:references :mime-version:content-disposition:in-reply-to:user-agent; bh=kvJLCEgw2Y91sCTQ6JSG1TMyYmzQtuSE0ssBK5vqs5A=; b=cpbjrT+r9eeGZ6wf3tflFq7p1VQcwGPvJsLKtVg0yLSJFy+cNApFsfI8FWGH/3lbKN fkpQtC7cF8UKPC+lh58FvgiXOhU8pv6D2ICcSTfg5kwjtSTfXxpUi9fjU5Qw979fOALZ qPDm70g8d5L9PUlOX0+wB1hF3koIdmG6MHFAa2g6oVtxixE/Yi3Qei25+ShIr/BWqhd8 C5voTntHFvdsUX9Lt5r9QzO5eiE+HOl6/fZIik51Fmf9hfY1QgKLt2dZGUtlebec6UTT xM0d3L7RKe3VdVshyO9+OTEiX2idDSm0OplGFOB0nox1ET13voUbeziNtqKO8xSkdmdK nFzQ== X-Gm-Message-State: AOAM533DGj0KFbvJwz2/eJTKMCA2YhL6Si0doE7bC384CVjw2JfuJ4+W kPC2PryiZaQjsD1uyOQnKfVkdg== X-Received: by 2002:adf:dfd1:: with SMTP id q17mr25505561wrn.94.1595341620825; Tue, 21 Jul 2020 07:27:00 -0700 (PDT) Received: from elver.google.com ([100.105.32.75]) by smtp.gmail.com with ESMTPSA id b18sm36258317wrs.46.2020.07.21.07.26.59 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 21 Jul 2020 07:27:00 -0700 (PDT) Date: Tue, 21 Jul 2020 16:26:54 +0200 From: Marco Elver To: Peter Zijlstra Cc: paulmck@kernel.org, will@kernel.org, arnd@arndb.de, mark.rutland@arm.com, dvyukov@google.com, glider@google.com, kasan-dev@googlegroups.com, linux-kernel@vger.kernel.org, linux-arch@vger.kernel.org Subject: Re: [PATCH 3/8] kcsan: Skew delay to be longer for certain access types Message-ID: <20200721142654.GA3396394@elver.google.com> References: <20200721103016.3287832-1-elver@google.com> <20200721103016.3287832-4-elver@google.com> <20200721140523.GA10769@hirez.programming.kicks-ass.net> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20200721140523.GA10769@hirez.programming.kicks-ass.net> User-Agent: Mutt/1.14.4 (2020-06-18) Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Tue, Jul 21, 2020 at 04:05PM +0200, Peter Zijlstra wrote: > On Tue, Jul 21, 2020 at 12:30:11PM +0200, Marco Elver wrote: > > For compound instrumentation and assert accesses, skew the watchpoint > > delay to be longer. We still shouldn't exceed the maximum delays, but it > > is safe to skew the delay for these accesses. > > Complete lack of actual justification.. *why* are you doing this, and > *why* is it safe etc.. CONFIG_KCSAN_UDELAY_{TASK,INTERRUPT} define the upper bound. When randomized, the delays aggregate around a mean of KCSAN_UDELAY/2. We're not breaking the promise of not exceeding the max by skewing the delay if randomized. That's all this was meant to say. I'll rewrite the commit message: For compound instrumentation and assert accesses, skew the watchpoint delay to be longer if randomized. This is useful to improve race detection for such accesses. For compound accesses we should increase the delay as we've aggregated both read and write instrumentation. By giving up 1 call into the runtime, we're less likely to set up a watchpoint and thus less likely to detect a race. We can balance this by increasing the watchpoint delay. For assert accesses, we know these are of increased interest, and we wish to increase our chances of detecting races for such checks. Note that, CONFIG_KCSAN_UDELAY_{TASK,INTERRUPT} define the upper bound delays. Skewing the delay does not break this promise as long as the defined upper bounds are still adhered to. Thanks, -- Marco