Received: by 2002:ab2:710b:0:b0:1ef:a325:1205 with SMTP id z11csp254352lql; Mon, 11 Mar 2024 01:18:13 -0700 (PDT) X-Forwarded-Encrypted: i=3; AJvYcCVekiGFll6zAyiu6GPdpSG31RnmSX6T/wtIjKx+Pj9A1A6hQ6BvO0AxSbOj5cy1b3rLXvSO4yswcLdDH2pKyLKAoP51lvyKsKue1AHqBA== X-Google-Smtp-Source: AGHT+IEr3znpBf7bGUxOQp9fS4h7jlwXFzlSS3Gep8xRc1nyDPR4NVhT4sJNvSwUa2rHE3ODywM5 X-Received: by 2002:a50:d6c2:0:b0:568:1445:c32b with SMTP id l2-20020a50d6c2000000b005681445c32bmr3771106edj.25.1710145093427; Mon, 11 Mar 2024 01:18:13 -0700 (PDT) ARC-Seal: i=2; a=rsa-sha256; t=1710145093; cv=pass; d=google.com; s=arc-20160816; b=OQ8cuTPdIFhYD5KKkPh9o8vYPNbNwJg7kfDTckjytSKThfRta4rWwWoq3EeDwJe8b4 oV1Kk+Al6hiCI7R8yo78Z5tveiPAc9BKB1uit8UidNGjcpvygW5pwfvSIyC8bPxLcuaO iUwRcKuY1SHRueJ48XqFuXYnDKhHofgN8yp0Bb3ANhdpO+V/5YgdpPO/4bc4BpE2eoeg CaSOl5qC1Fjt9KKnuprIKvZL6jBetD8g6h9K6+DhW7SovV/fwgNlDkyKsDZdlBHveWNS oHFT512thgpcF1a6Bc4u/2MSXlpBP03Zfki1bzVtwMBfqA1CMtv/Pv//7qvyXrl1QJJC 146g== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=content-transfer-encoding:in-reply-to:from:content-language :references:cc:to:subject:mime-version:list-unsubscribe :list-subscribe:list-id:precedence:date:dkim-signature:message-id; bh=m/Gz70WprgLvSEDgpF5x0FUaddqxV0rehd1ZR+aa/us=; fh=Q+/RmnKmDMIjtaGICDCL1jVJHeUsrw+X/nY5j09Mjlo=; b=mVBCBizn0hxbUeMbykGhPdoQH0Nl8iRzSoeCzX56PGPNzz+BY4EMEX4NK/aSYx0RVp 9+P5w80Kn/DKXXKC5dF7NunOS/J/xbzo3EDIIOyMi++ENG716LA/cZUFLVYZyQDDaB9H g9HrJXMSb0P6wcNznLesXXugFrFgdTZhZhLr0GBctNeHIewDpV/D2kDyQr7a0iTs7zuk BRBjs3c4jlS1flf/EUUAxe9XFYuzNER631OPRIqs7s3Jz9oeswvwpCQ6CeYaMtFRkeic K1JvmKOpAqGfPXkbnqPkDbHqcixvSatue66N/fL7lAh671rdAK1gHRHY5OPtkGsXLPyn 7FfA==; dara=google.com ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@linux.dev header.s=key1 header.b=ON9V5FQZ; arc=pass (i=1 spf=pass spfdomain=linux.dev dkim=pass dkdomain=linux.dev dmarc=pass fromdomain=linux.dev); spf=pass (google.com: domain of linux-kernel+bounces-98533-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.80.249 as permitted sender) smtp.mailfrom="linux-kernel+bounces-98533-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linux.dev Return-Path: Received: from am.mirrors.kernel.org (am.mirrors.kernel.org. [147.75.80.249]) by mx.google.com with ESMTPS id b12-20020a056402084c00b0056838f5624bsi2274837edz.97.2024.03.11.01.18.13 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 11 Mar 2024 01:18:13 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel+bounces-98533-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.80.249 as permitted sender) client-ip=147.75.80.249; Authentication-Results: mx.google.com; dkim=pass header.i=@linux.dev header.s=key1 header.b=ON9V5FQZ; arc=pass (i=1 spf=pass spfdomain=linux.dev dkim=pass dkdomain=linux.dev dmarc=pass fromdomain=linux.dev); spf=pass (google.com: domain of linux-kernel+bounces-98533-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.80.249 as permitted sender) smtp.mailfrom="linux-kernel+bounces-98533-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linux.dev Received: from smtp.subspace.kernel.org (wormhole.subspace.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by am.mirrors.kernel.org (Postfix) with ESMTPS id 23CDA1F21BB7 for ; Mon, 11 Mar 2024 08:18:13 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 4B601111AC; Mon, 11 Mar 2024 08:18:03 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=linux.dev header.i=@linux.dev header.b="ON9V5FQZ" Received: from out-187.mta0.migadu.com (out-187.mta0.migadu.com [91.218.175.187]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 01CAD14284 for ; Mon, 11 Mar 2024 08:17:59 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=91.218.175.187 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1710145082; cv=none; b=kVvbfqP+7QuHSRhPWRQvCvIxGnas5lfrOaP4+7O6aTGlwvx4PKxr/IYDl4HdZ65HPqCj1ipV9kSZlkHl72ilW1w0JAYMzBNqS4n2t7AphMa2jh46AQDB4dkwb0mhrqQNMRrSYgsZsq7I9ellEF+txPUchq4gVVf8PsYsdUqZGUA= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1710145082; c=relaxed/simple; bh=jzvSjvVA6Jyy48uWqmfGdrZwBkgTuPLqmjeUVsU/44Q=; h=Message-ID:Date:MIME-Version:Subject:To:Cc:References:From: In-Reply-To:Content-Type; b=GhkK69bJz4oqw01SdPMTQPHr/NjlFhRl8scOIpTR4/xFLf50IQPUCTbEQS4wNKlEWoRtI9DO7fpVx6EaS9bKvDcEObLofo2L33LrPyp51qE+Z0uVm3thyzcEooOGBWa/sJVVp5IeH/QswQV9eR5Bhe2ANOX/ctZqFfYVXIu//Z4= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=linux.dev; spf=pass smtp.mailfrom=linux.dev; dkim=pass (1024-bit key) header.d=linux.dev header.i=@linux.dev header.b=ON9V5FQZ; arc=none smtp.client-ip=91.218.175.187 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=linux.dev Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=linux.dev Message-ID: <7c391960-4406-4089-991e-d54ecc45524f@linux.dev> DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linux.dev; s=key1; t=1710145078; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=m/Gz70WprgLvSEDgpF5x0FUaddqxV0rehd1ZR+aa/us=; b=ON9V5FQZKlAsAbR47O1AsQEFG48m7H6UueIUrYklxzeol9YBF2b2dTvxV9SiOAxZcSAoJW WSbs59ndbxLCvr8yMz9cWGYnuy8FBsXDlo9NF/AEZ9PQGRfSnFP+R4NaIVgMrL7QINVdnN 5nH3L1J3bIa/3mu+w6+ydd+tl/wh2KY= Date: Mon, 11 Mar 2024 09:17:51 +0100 Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Subject: Re: [PATCH] RDMA/siw: Reuse value read using READ_ONCE instead of re-reading it To: linke li , gregsword0@gmail.com Cc: bmt@zurich.ibm.com, jgg@ziepe.ca, leon@kernel.org, linux-kernel@vger.kernel.org, linux-rdma@vger.kernel.org References: Content-Language: en-US X-Report-Abuse: Please report any abuse attempt to abuse@migadu.com and include these headers. From: Zhu Yanjun In-Reply-To: Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 7bit X-Migadu-Flow: FLOW_OUT In the original source code, READ_ONCE(xxx) is in if test. In your commit, you move READ_ONCE out of this if test. So the time slot exists between fetching and using. In the original source code, it does not exist. And the fetching and using are not protected by locks. As is suggested by Leon. This will introduce risks. The binary is based on optimization level and architectures. It is very complicated. Zhu Yanjun On 11.03.24 03:57, linke li wrote: >> This is not a smp problem. Compared with the original source, your >> commit introduces a time slot. > I don't know what do you mean by a time slot. In the binary level, they > have the same code. >