Received: by 2002:a05:6358:d09b:b0:dc:cd0c:909e with SMTP id jc27csp1274888rwb; Thu, 8 Dec 2022 08:38:47 -0800 (PST) X-Google-Smtp-Source: AA0mqf453mKHDZ47HqE6fT1qlQeBN+XwbxVHvex/kD41DNqURnOTFmtOX4M6eK/ymaxnS9DhZasR X-Received: by 2002:a05:6402:138f:b0:461:5b75:d3df with SMTP id b15-20020a056402138f00b004615b75d3dfmr85816345edv.367.1670517527583; Thu, 08 Dec 2022 08:38:47 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1670517527; cv=none; d=google.com; s=arc-20160816; b=bbU4qe798m53mjwWpkNlNIjM++UWIgVNjHwPfsxHmladockL01CcUmLTEJFxXU4u3y qTit2PmUE/yfq1ShfOwVGT9fgsq9RhxFpyrgRG6K8XafR8pLwYdJgjGO0elfs4O4MTsf hqw3rjCJsWab3tyHVBXdDjc0TIL59GX4HJ3naQeXMWQHiLi+dafP7fRk2eEnWeYWQYCM SsRTHy/Hm/3qhfiHsQU8pJ0M/Lq60l62PWVLV/xWlNENRYwtnqyk2wR5V9QtbSAOkYEW hZ0IfntkNB5by+ukDPctdffyYZcElM5WwxPB1ENn5Oy0wsMtDK8jox77fxZMe3DStSnk hzqQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :references:in-reply-to:message-id:date:subject:cc:to:from :dkim-signature; bh=WqNv4tTpaYh4KzG5gg2YG+zdkA2FUCBC5yatizYS8Yw=; b=oC8kYJiS49kPqbL0Xt/JYXQHLrZWpVJp1zBd5JueGZRZwuL8awWj3m/Qt4rwadPo/K bjTyKFZ4dAcvbMTZF4hgXXR2yz4sUn+iZqNz2eZpUk38P39i7SwKi5D5j3HdU1D2T/wq aX4d6REC0xgnf/l3cPoncM6aaOUcJQlhtwwfGI0R/UQ0Y8JT7foxpqdqLRdx7BiQpZIl N19+vFKfrYhLVRuqAVyTidzCgeJZqx+dTmmFctZ7eEjiGOU7UZ4I9pGeBKu2DjBK1d6m lttrMlwUKoidYuCW1ouG8CCITcjoMpT+HL0i79CHAX/wNPn2KpwaTHRJV5lDO+eQsQRV xJkA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@crudebyte.com header.s=kylie header.b=urr7usUl; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=QUARANTINE sp=QUARANTINE dis=NONE) header.from=crudebyte.com Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id z1-20020a05640235c100b0044f1b7b8713si8079933edc.281.2022.12.08.08.38.22; Thu, 08 Dec 2022 08:38:47 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@crudebyte.com header.s=kylie header.b=urr7usUl; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=QUARANTINE sp=QUARANTINE dis=NONE) header.from=crudebyte.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S229914AbiLHPvl (ORCPT + 72 others); Thu, 8 Dec 2022 10:51:41 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:39116 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229522AbiLHPvd (ORCPT ); Thu, 8 Dec 2022 10:51:33 -0500 Received: from kylie.crudebyte.com (kylie.crudebyte.com [5.189.157.229]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id C0B2870B9A for ; Thu, 8 Dec 2022 07:51:30 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=crudebyte.com; s=kylie; h=Content-Type:Content-Transfer-Encoding: MIME-Version:References:In-Reply-To:Message-ID:Date:Subject:Cc:To:From: Content-ID:Content-Description; bh=WqNv4tTpaYh4KzG5gg2YG+zdkA2FUCBC5yatizYS8Yw=; b=urr7usUl3uRGmeZW4FVRO+3un8 Gn8NX7uY6rAKOKf5EYN2J+4sHgp8rNRwoij6maPFMaXmFLaniCT/Hkox/qmqqQDtF9D28O2dLiPPv RPNSFrWGaVwd7zzcxnDUKSbQwWFAVBEGpddB9BJFkyDXE3nRjdI8cWU6aQV/FHzWvOlCbns3mPRGd CzgdGBTg4oshuU0H7C/m6ozy12xEP9Nc+T56ELIyKPPrN/NweE8w2RZPdjzzbCdzLUydUMw2FwaxV oWNGA1ZAd2UHOyk8jNn4uBZMadtAOwtd5xYD24pl51hEKEb/J+BeBiUcxRGiZtqaFqE1TX0PwlCkx VIHJ/sZrZkDx8axJKez1tY7RQnNUdj7o+rq2aSVlnNcdi3P5GodqtHA31MyqT3DjZonSKxuEKds+z b7+4ZwPLBPpFWXM/5mCIuW38DYZtoiWDrm6lN9Sy51LIeU6RK1L3T4nHfOLNkr1KfHS+zF1r2RDAl 488JuJeCYrIDTYuSCimTkiLcUluWlIiMSYY0hhAD7LKKU5gqp1kSPGGWHIQFq5nAlDqeIUzTNc6Fm a2TMqgc46KRJjE4Du9ABQEw0uINDa0n4Trf3YQmb4PJu73500mAa5ToKBKRaPTdGEAmZxF7qvbaCE jRLrycmY+2KuQ8IpDNiEvGgxWbtNoNCqGC1XYUV7k=; From: Christian Schoenebeck To: Dominique Martinet Cc: Naresh Kamboju , v9fs-developer@lists.sourceforge.net, linux-kernel@vger.kernel.org, Marco Elver Subject: Re: [PATCH] 9p/client: fix data race on req->status Date: Thu, 08 Dec 2022 16:51:27 +0100 Message-ID: <167052961.MU3OA6Uzks@silver> In-Reply-To: References: <20221205124756.426350-1-asmadeus@codewreck.org> <3368929.hG1Ktuj5m1@silver> MIME-Version: 1.0 Content-Transfer-Encoding: 7Bit Content-Type: text/plain; charset="us-ascii" X-Spam-Status: No, score=-2.1 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,SPF_HELO_NONE,SPF_PASS autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Monday, December 5, 2022 11:27:48 PM CET Dominique Martinet wrote: > Christian Schoenebeck wrote on Mon, Dec 05, 2022 at 04:19:01PM +0100: > > I must have missed the prior discussion, but looking at the suggested > > Good point, I'll add a link to the report as well... > It's this thread: > https://lkml.kernel.org/r/CA+G9fYsK5WUxs6p9NaE4e3p7ew_+s0SdW0+FnBgiLWdYYOvoMg@mail.gmail.com > > > solution: if there is no lock, then adding READ_ONCE() and WRITE_ONCE() would > > not fix cross-CPU issues, as those would not have a memory barrier in that > > case. > > > > Shouldn't that therefore rather be at least smp_load_acquire() and > > smp_store_release() at such places instead? > > The barrier is here -- Right, looks like most of it should be fine. Maybe p9_client_zc_rpc() needs a barrier as well? > I think we're just protecting against compiler > reordering or if on some arch the store isn't actually atomic. And access order within the same thread. > This code path actually was broken before I added the barrier a while > ago (2b6e72ed747f68a03), as I was observing some rare but very real > errors on a big server so I'm fairly confident that for at least x86_64 > the generated code isn't too bad, but if KCSAN helps catching stuff I > won't complain. What about p9_tag_alloc()?