Received: by 2002:a05:7412:bbc7:b0:fc:a2b0:25d7 with SMTP id kh7csp3248373rdb; Tue, 6 Feb 2024 11:24:03 -0800 (PST) X-Google-Smtp-Source: AGHT+IGZ2/2DPmowbQx5+FqMbNNADSJxqsvzi5N6EUZweGUPtlfstQNzCe5f7UEFPPCC3wswZ9iT X-Received: by 2002:a17:902:c946:b0:1d9:a6ce:6c54 with SMTP id i6-20020a170902c94600b001d9a6ce6c54mr3231170pla.67.1707247442863; Tue, 06 Feb 2024 11:24:02 -0800 (PST) ARC-Seal: i=2; a=rsa-sha256; t=1707247442; cv=pass; d=google.com; s=arc-20160816; b=eZjte66cZiERmmwVsXl7ersPxkBNhpqD3bDERtHblywvBpEpDHEwXYLB8j1k6H2sDx wLjIhiL2U/U0R/VR1paiMkPRU8cRRXf3wTwt7z7WdB4PbbORS8RYPciWgjxeQXoUZy1s eialnixxzmZAmI13S2FnxCS/Uud7GGMlOF9bD/DdJZ5yj48TrD0kj/oa8K5DZm+4zfsv Ffc035ImIXVUMPQR6hpkVvLEFgx6IjfYaHBnW8zi4mD1BLVQua2qWEbIs99oJRNTl3kl 8qbUtV65tV7gV7Kf28frlxoT3T0r0a5nY3WUAToXZCqwzZo9rdRTNzHyR/moFiToQupa 7WoA== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=in-reply-to:content-disposition:mime-version:list-unsubscribe :list-subscribe:list-id:precedence:references:message-id:subject:cc :to:from:date:dkim-signature; bh=T0OuNGLRF05OKJz38bFXjramee4jIHZcWQFvCNYxaZc=; fh=1v585JOmvFPrh+ti8H0XJkNigNYC0thQQTDm+4EtGvc=; b=oAj1zTGHsDaM4SvlNq2S/nhMsTUQnP5IIIqGSwp3YivMruzpdt7obzJUZaEb34jtRT 2mqcWXmrNymTpc48pU2EYIpoph+W0BXRz8P75rswUPwYBw7OxSNyfX6fCubtuZF1pniI bnsmq5KC1dy3aUzIWueP3WBUJjYLZLu1eSxROWbV5sJcTsmvozE3QY5wfCfzVqh6WMMt M+DIycxxq3q6V82iW15cN0x9tqd5BKRwI2siBZRtCZp5/dRhaIOuu7qwjyhT5+W+/ZUb 2rbU8pikU6gx8F5nvNAJ4NWQefhnK3nrznEhM9dvS+gVzrC6NiMyYWeBvMVXZQamUTje wv7g==; dara=google.com ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=XqpYUSnf; arc=pass (i=1 dkim=pass dkdomain=kernel.org); spf=pass (google.com: domain of linux-kernel+bounces-55551-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.48.161 as permitted sender) smtp.mailfrom="linux-kernel+bounces-55551-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org X-Forwarded-Encrypted: i=1; AJvYcCWiytwlkkf2MSuK4TJqtmlKgEJESm5vNtmP9kzS9o0CYbZQBZMGqcSWhAl993beJp0byVHrRVGEupH4/PmI/bVIguRvfvS6pdnrITNBUA== Return-Path: Received: from sy.mirrors.kernel.org (sy.mirrors.kernel.org. [147.75.48.161]) by mx.google.com with ESMTPS id l18-20020a170903121200b001d95a6b0b54si2110315plh.252.2024.02.06.11.24.02 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 06 Feb 2024 11:24:02 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel+bounces-55551-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.48.161 as permitted sender) client-ip=147.75.48.161; Authentication-Results: mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=XqpYUSnf; arc=pass (i=1 dkim=pass dkdomain=kernel.org); spf=pass (google.com: domain of linux-kernel+bounces-55551-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.48.161 as permitted sender) smtp.mailfrom="linux-kernel+bounces-55551-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org 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 sy.mirrors.kernel.org (Postfix) with ESMTPS id 7F166B22F7F for ; Tue, 6 Feb 2024 19:22:59 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 1B83A17BC4; Tue, 6 Feb 2024 19:22:52 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b="XqpYUSnf" Received: from smtp.kernel.org (aws-us-west-2-korg-mail-1.web.codeaurora.org [10.30.226.201]) (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 3575E17BA3 for ; Tue, 6 Feb 2024 19:22:51 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=10.30.226.201 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1707247371; cv=none; b=bNscjh4ItjcH8QdgpuqmsWrAYAh8/Mdf9kf6UfXmpLjBZ2c2VEtCeL7bvTjxQcz1ETCKlUn51f9mC7zwmpAiI/HDYprMZJOFOmwg89H3bSdbb2l3Z+d13fQRVHZnIZgAb6YzzVMkNBiKFZtarnFiUKBRQchO4GrAGUjD027wDXs= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1707247371; c=relaxed/simple; bh=jVV0CP0FliUSGdBrGlooYVmXbC4mj/PMikc4Dao6qR0=; h=Date:From:To:Cc:Subject:Message-ID:References:MIME-Version: Content-Type:Content-Disposition:In-Reply-To; b=CgfzASUlZNz+mAQrMzDKAAaOhD2nKFa8qifjqJhrADeFWOZf09vH+K9AEC+v8aQbOZG93mldbswqu4FO3ocpbJyUhmTZhDfsBA7UDOq4J3Hz7Tq7fa+LEVDU5wjDRsT4AsPUpLVPfut+zOQBMNQK6QTvIKfV/y/LidX7B1AGZ9o= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b=XqpYUSnf; arc=none smtp.client-ip=10.30.226.201 Received: by smtp.kernel.org (Postfix) with ESMTPSA id CB5B3C433F1; Tue, 6 Feb 2024 19:22:50 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1707247371; bh=jVV0CP0FliUSGdBrGlooYVmXbC4mj/PMikc4Dao6qR0=; h=Date:From:To:Cc:Subject:References:In-Reply-To:From; b=XqpYUSnfgzky2tauWjCiKs2wtAODdZJvwiEBQpORZgUg5vznECJbsAZAV8hilPOxb lo4a6Zs55r5Y4bUcn1gImPQSrSfWIAaSpFOORHiP/Qlg080Yc4xyj77oXsnNz6o/Xt 4sWG0pTxDBFPWqE7Vj8ldNl4TxF9iOOq8CTiJluiSGwd3HhVAejfM4r+GTPdQEN1Zc 8MVqWMWrPmFsKj2hOSXOtluEQnY/bheiZOqrACjh+WgHUeFr7L8adHJie08/2tjTLD E9EI9fBwrqP6IB51z9p5XuIac1/q2mt3GRT94yxMii7nq1OC1a+vVzB6Bqm2VLE95o XVO+/oqp9t1vg== Date: Tue, 6 Feb 2024 11:22:49 -0800 From: Keith Busch To: Hannes Reinecke Cc: Daniel Wagner , James Smart , Christoph Hellwig , linux-nvme@lists.infradead.org, linux-kernel@vger.kernel.org Subject: Re: [PATCH v5 12/12] nvmet-fc: use RCU list iterator for assoc_list Message-ID: References: <20240131085112.21668-1-dwagner@suse.de> <20240131085112.21668-13-dwagner@suse.de> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: On Tue, Feb 06, 2024 at 02:51:24PM +0900, Hannes Reinecke wrote: > On 1/31/24 16:51, Daniel Wagner wrote: > > + rcu_read_lock(); > > + if (!nvmet_fc_assoc_exits(tgtport, ran)) { > > assoc->association_id = ran; > > list_add_tail_rcu(&assoc->a_list, &tgtport->assoc_list); > > + done = true; > > } > > + rcu_read_unlock(); > > spin_unlock_irqrestore(&tgtport->lock, flags); > > Odd. You already take the tgtport lock, so there really is no point in using > rcu_read_lock() here. That's a interesting point, but I think it's harmless since there's no rcu sync within the read section. https://www.kernel.org/doc/Documentation/RCU/Design/Requirements/Requirements.html#Guaranteed%20Read-to-Write%20Upgrade That said, the rcu_read_lock() seems like it should be moved to nvmet_fc_assoc_exits() since that's the only part reading rcu protected structures.