Received: by 2002:a05:7412:d1aa:b0:fc:a2b0:25d7 with SMTP id ba42csp1990061rdb; Wed, 31 Jan 2024 16:04:22 -0800 (PST) X-Google-Smtp-Source: AGHT+IE8Bqv8W/z9BMMKGbHTagb8KZ7KuzIXzoexWepzPjokflQkr2rdOQKxkQN2n9B5rj3RP4EY X-Received: by 2002:a05:6808:11ca:b0:3bd:9ab2:fc5a with SMTP id p10-20020a05680811ca00b003bd9ab2fc5amr3097734oiv.54.1706745862144; Wed, 31 Jan 2024 16:04:22 -0800 (PST) ARC-Seal: i=2; a=rsa-sha256; t=1706745862; cv=pass; d=google.com; s=arc-20160816; b=xRbw1GjJRn7yUUQCwE/chqoZPMFyLIuDQcsMLuNWlJccktWwJsKhGZs4hP8Tz16Mq9 hgqnlbBtA7YTXJ4fwjnmZDWrXvqk+on6aBNFuI7toWgMiv1PEk7Ln4/C2NDOXMR5PpEL JXSXpZO16wYy91kUDP8PH0fY4ZlGD7M4GLjrgyf62l+tH2kAfBSmifeNv00aFrL1giMW QefAFNnMVVz3JsrAXJaRM0cQ1nvrq6bCbxEBfc35C74u/iu8JHqAXG9WFLBu1hLgq7H6 DQSUikl5r4FtI41VRoBN/WdcES3ez8DL9cXrQ2T4u8/abAdH6X+Tcy71RBu/sPXaoMbF xNrQ== 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=4l6ETKY5nfjEgAc/txbnxgEJpKhrIm08EBvT3tli3Fs=; fh=wLVqHbMQIYvJoJG8hrrqO91ZnY+ghDMs0IeqDjfJvRM=; b=KOAqjdW6yUYvx222reVAsRFzCeZDxQCkorXqbAa1LxN6vlAQsAYN5SmG8Y0/k3G4SS MvDlc8BLqLQjgN3ZgeNhweCx2R5ycBQAp/6iC3JktbZhAe2v7Z06eHCo7p+dE5dnCJ0u s3YOXX1eXXewwLG2G8UDBEbvhmKtMnRZu8Yz9+I2YuMrmOsct7F3XgeV503qoRAPIDWs a7hvUeo4e+1QT9U6cC1j7q+dRkUMrnuRxuEeGwgaUYaC67zaMpin6g6oETydzqYyigDi wjwxlCnig36LoMUIs6c3I9qkZa6Ylf0dkYS19PQ9f7zeLqdTCXU2U7LQ5peSvEjdTTxT hDYQ==; dara=google.com ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@ziepe.ca header.s=google header.b=iuvSVo4N; arc=pass (i=1 spf=pass spfdomain=ziepe.ca dkim=pass dkdomain=ziepe.ca); spf=pass (google.com: domain of linux-kernel+bounces-47408-linux.lists.archive=gmail.com@vger.kernel.org designates 139.178.88.99 as permitted sender) smtp.mailfrom="linux-kernel+bounces-47408-linux.lists.archive=gmail.com@vger.kernel.org" X-Forwarded-Encrypted: i=1; AJvYcCVirET1HjIQizp9uDOA4MOd5MEkpnhV3JsMpFU3ZczDQAPm0ws1jYj3Js/NQ2Qz2jM9KG90R3JZpcHR62y3YmQGf6eRCsHh+UvmBZ6S7g== Return-Path: Received: from sv.mirrors.kernel.org (sv.mirrors.kernel.org. [139.178.88.99]) by mx.google.com with ESMTPS id m26-20020aa78a1a000000b006de04df03e3si9962439pfa.114.2024.01.31.16.04.21 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 31 Jan 2024 16:04:22 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel+bounces-47408-linux.lists.archive=gmail.com@vger.kernel.org designates 139.178.88.99 as permitted sender) client-ip=139.178.88.99; Authentication-Results: mx.google.com; dkim=pass header.i=@ziepe.ca header.s=google header.b=iuvSVo4N; arc=pass (i=1 spf=pass spfdomain=ziepe.ca dkim=pass dkdomain=ziepe.ca); spf=pass (google.com: domain of linux-kernel+bounces-47408-linux.lists.archive=gmail.com@vger.kernel.org designates 139.178.88.99 as permitted sender) smtp.mailfrom="linux-kernel+bounces-47408-linux.lists.archive=gmail.com@vger.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 sv.mirrors.kernel.org (Postfix) with ESMTPS id C5847284234 for ; Thu, 1 Feb 2024 00:04:21 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 5FDCA811; Thu, 1 Feb 2024 00:04:13 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=ziepe.ca header.i=@ziepe.ca header.b="iuvSVo4N" Received: from mail-qt1-f177.google.com (mail-qt1-f177.google.com [209.85.160.177]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id B4F9837A for ; Thu, 1 Feb 2024 00:04:10 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.160.177 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1706745852; cv=none; b=S7YUNtWAe1moo1l6OuNEy34IpHAtU6AME0faDuui1hgvSyADDNrSPkeKuPkq1dY927tk4r7tumNOOCmicw51SfkzN8rtrb41J954DnzyaiyVm4MG7nFwbqchzOFuX0iOjt/8bqrgAElr9wZO4OE2Zy3bFIuEDP5PXMMeMTKEsHY= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1706745852; c=relaxed/simple; bh=ZTQfjlfKZWpsko9yin8I+YupCTzyBniQOMshlfPT7kY=; h=Date:From:To:Cc:Subject:Message-ID:References:MIME-Version: Content-Type:Content-Disposition:In-Reply-To; b=RsV6DKEeSZYcGhJD2VioSZkrMS3exGhTCTHP3jE9JAsFdwDmnfnHVBhxmjnlAmNATjdn/joI/vF6gBepakUgsrc1qOnup7bsdR+fNciCqC6UmixN8F7/YFMTKhGozSCdQ2b3QNNWagfMdr0BHEs0vdAfjRDN9DR5YiJvPZapF+k= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=none (p=none dis=none) header.from=ziepe.ca; spf=pass smtp.mailfrom=ziepe.ca; dkim=pass (2048-bit key) header.d=ziepe.ca header.i=@ziepe.ca header.b=iuvSVo4N; arc=none smtp.client-ip=209.85.160.177 Authentication-Results: smtp.subspace.kernel.org; dmarc=none (p=none dis=none) header.from=ziepe.ca Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=ziepe.ca Received: by mail-qt1-f177.google.com with SMTP id d75a77b69052e-42adb5f806fso3604081cf.3 for ; Wed, 31 Jan 2024 16:04:10 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=ziepe.ca; s=google; t=1706745849; x=1707350649; darn=vger.kernel.org; h=in-reply-to:content-disposition:mime-version:references:message-id :subject:cc:to:from:date:from:to:cc:subject:date:message-id:reply-to; bh=4l6ETKY5nfjEgAc/txbnxgEJpKhrIm08EBvT3tli3Fs=; b=iuvSVo4NkfbiUsfvlovftPoS/Sd2p0VROXV/Lg3NidmqDjYdjC4nK/br0NIVN55Yf5 8gbk++XxPJWVwDN1gIuue5uup/+h1DrmTQFlsQwPnA22NADSQSvhN06qbgWCXlmFIkF6 ZBwq0ErRKzful/0mfTogaMfv9S8j4IuZLscKVt7x6zyOEkVEJThunexVoZ0JthAJb3cV j2zCqub/OGSXHyAjH1LdAXduTeIVH3KirSG/51fc5sDd62+SqGqmQHQcfi8bOUlc2Mhu zxmeeE9O79wBO90qKIS34kNlcKMxSaEUu5CUaxs/kzVmrpMJESTk5eEKvXu0vyCF9hZA +Aww== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1706745849; x=1707350649; h=in-reply-to:content-disposition:mime-version:references:message-id :subject:cc:to:from:date:x-gm-message-state:from:to:cc:subject:date :message-id:reply-to; bh=4l6ETKY5nfjEgAc/txbnxgEJpKhrIm08EBvT3tli3Fs=; b=FFk67nCcStxfz14rAGQtLBJcoqzFRij3uWmXEEgIMpdGQWtm9/gEVQsqLYVepkzrMH xqhmdRMi9tfNoubrc+gDv6MdHBf1ankg3asHG2xSqkPkwJ6g8S95uDRHr/JbTHfbEdBF ggZRTEt0rhoz0HuFtv1wPr2cpU0ASc/hwpyCC9myszD7un/mx0lTYR5iLGb/rbzrAV7Y sJTAZjJSUcEAqZ2AwoCYNE6t2Vd8mTmyAbQ8rVkhkb8gU8HDRF33jwdtiH3151tDq46T Syhh7rHrTwXrYPc+pAQZpUiHq9m+BpbNSJlxtkGfIUfzhNPDN+dc5nEuCvym5p1a4Av1 28sA== X-Gm-Message-State: AOJu0YxI0UwnLOYuVOkeZObg7McApjbOMoVcRmrZ7XM8EQtLe0HShFaZ 3mdo3Ges1lWOXwyO/umkoDRA4hbXTpEJJw3qGg4GtNA++xUv0+yj4HrSFijJbmU= X-Received: by 2002:a05:6214:1314:b0:68c:4f54:5bd8 with SMTP id pn20-20020a056214131400b0068c4f545bd8mr3525534qvb.32.1706745849534; Wed, 31 Jan 2024 16:04:09 -0800 (PST) Received: from ziepe.ca (hlfxns017vw-142-68-80-239.dhcp-dynamic.fibreop.ns.bellaliant.net. [142.68.80.239]) by smtp.gmail.com with ESMTPSA id ly4-20020a0562145c0400b0068c4d69936bsm475181qvb.119.2024.01.31.16.04.08 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 31 Jan 2024 16:04:08 -0800 (PST) Received: from jgg by wakko with local (Exim 4.95) (envelope-from ) id 1rVKYq-00AhVc-1D; Wed, 31 Jan 2024 20:04:08 -0400 Date: Wed, 31 Jan 2024 20:04:08 -0400 From: Jason Gunthorpe To: Shifeng Li Cc: Ding Hui , leon@kernel.org, wenglianfa@huawei.com, gustavoars@kernel.org, linux-rdma@vger.kernel.org, linux-kernel@vger.kernel.org, Shifeng Li Subject: Re: [PATCH] RDMA/device: Fix a race between mad_client and cm_client init Message-ID: <20240201000408.GG50608@ziepe.ca> References: <20240102034335.34842-1-lishifeng@sangfor.com.cn> <20240103184804.GB50608@ziepe.ca> <80cac9fd-7fed-403e-8889-78e2fc7a49b0@sangfor.com.cn> <20240104123728.GC50608@ziepe.ca> <20240115134707.GZ50608@ziepe.ca> <354e2bf7-a8b4-629d-3d2d-35951a52e8bd@sangfor.com.cn> <5bc6ed6d-31e9-4b44-aa91-5f9d0f3d92c8@sangfor.com.cn> 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: <5bc6ed6d-31e9-4b44-aa91-5f9d0f3d92c8@sangfor.com.cn> On Fri, Jan 26, 2024 at 10:25:01AM +0800, Shifeng Li wrote: > > I believe this modification is effective, rather than expanding the clients_rwsem range, > > the key point is down_write(&devices_rwsem), which prevents ib_register_client() from > > being executed in the gap of ib_register_device(). > > > > However, this may cause a little confusion, as ib_register_client() does not modify > > anything related to devices, but it is protected by a write lock. > > > Do you have any differing opinions about above? I'd rather see the client side have a comment explaining the confusing lock then disturb the locking on the devices side.. I think the write/read lock scheme there was done for a reason I just haven't had time to recall exactly why.. Please send a patch with this arrangement Jason