Message ID | 20240227064821.128-1-zhangfei.gao@linaro.org |
---|---|
State | New |
Headers |
Return-Path: <linux-kernel+bounces-82760-ouuuleilei=gmail.com@vger.kernel.org> Delivered-To: ouuuleilei@gmail.com Received: by 2002:a05:7300:a81b:b0:108:e6aa:91d0 with SMTP id bq27csp2526863dyb; Mon, 26 Feb 2024 22:48:50 -0800 (PST) X-Forwarded-Encrypted: i=3; AJvYcCU4/96FkBMgZEga2rCPDoH59clwnbymFcqqOsFqFF0V2bvy6f0aoFhTPLxDPlIFajq4zalQ3INcQW+VgsQjAxYl4FPcWg== X-Google-Smtp-Source: AGHT+IE1PsqD2juTGIQkTe/MzYepo3tHn2UNWcY8Nr4gWmzYLTI9MIGMuBfhc2GOJtx1E4qe5XwN X-Received: by 2002:ad4:5d42:0:b0:68f:f74f:50fd with SMTP id jk2-20020ad45d42000000b0068ff74f50fdmr2212871qvb.18.1709016530271; Mon, 26 Feb 2024 22:48:50 -0800 (PST) ARC-Seal: i=2; a=rsa-sha256; t=1709016530; cv=pass; d=google.com; s=arc-20160816; b=ElhjzBUXljNda7bqCwrmiyGSLaoXyTUlDgEBpOXJcx8FbMNU/8eglmOSn1aCd+LVsw j2mAISArLAm1ON5eP/XjMyvmBMrUee2LIeYeB4PZYjkeVRLvZ91SKHaw1t9h9ciEaIf4 pYFN6X8feHyaHC9CpSiONLLglAdqGnX8ghGRtErSi/4RtQcm+4rEBJin1r+3+RphIafP RrIjHLQGmSjhkhhnmBZCSp9MvJ2MMcylmrADge4d2Ytylyb037RgtZb/RILyV5MC6wn2 9+sPVi9KfwfVw133yRiuqOwaMAW9kKOEtlSRPruZKT6CE20zS2kw/RX4X/7iURWckXDa VbHQ== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=content-transfer-encoding:mime-version:list-unsubscribe :list-subscribe:list-id:precedence:message-id:date:subject:cc:to :from:dkim-signature; bh=6FBYjN6sLTi7L4W/93/wTWpFgwkV8FUHLIcwh/+Iuvc=; fh=MGTJ/PcDtolugrHu7coRXN6pZpMhXRJ7ByrWc12tNTg=; b=ToX8eEkB83c49fcdFB6BCEGYS7m15Y8QDZTz81jWRjGfBeRxO3l5XNLgwcDBZJ/0Eu 1FiUQYQkCiQ5h8cjRq1i/1utETFIPjDxZ5IiaPSG7zLuIUaUVjXC5QYhWwa9ITLOFc/+ cWBw7j9VwPv4eYrenclTblfp8tTOqjzzwnDCAwNCwvpl4ho84se7LM4klwzBSLaXOE84 2YtsTChzbI/FRxURZdQJ5ysBj5gHcgSckCCGAJ+QPlvmX4PxXserBdphiVkbj4DRkDNH nYfBF6jQipEJC9yIdoNiMKhOOuCCu+7srWsaU89avYn4oD9gtLHIAFAnO0GP5vnqo5IR tSwg==; dara=google.com ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=Dd26fzy1; arc=pass (i=1 spf=pass spfdomain=linaro.org dkim=pass dkdomain=linaro.org dmarc=pass fromdomain=linaro.org); spf=pass (google.com: domain of linux-kernel+bounces-82760-ouuuleilei=gmail.com@vger.kernel.org designates 147.75.199.223 as permitted sender) smtp.mailfrom="linux-kernel+bounces-82760-ouuuleilei=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Received: from ny.mirrors.kernel.org (ny.mirrors.kernel.org. [147.75.199.223]) by mx.google.com with ESMTPS id 15-20020a05621420cf00b0068fdea11be2si6809344qve.608.2024.02.26.22.48.50 for <ouuuleilei@gmail.com> (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 26 Feb 2024 22:48:50 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel+bounces-82760-ouuuleilei=gmail.com@vger.kernel.org designates 147.75.199.223 as permitted sender) client-ip=147.75.199.223; Authentication-Results: mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=Dd26fzy1; arc=pass (i=1 spf=pass spfdomain=linaro.org dkim=pass dkdomain=linaro.org dmarc=pass fromdomain=linaro.org); spf=pass (google.com: domain of linux-kernel+bounces-82760-ouuuleilei=gmail.com@vger.kernel.org designates 147.75.199.223 as permitted sender) smtp.mailfrom="linux-kernel+bounces-82760-ouuuleilei=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.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 ny.mirrors.kernel.org (Postfix) with ESMTPS id 149161C21393 for <ouuuleilei@gmail.com>; Tue, 27 Feb 2024 06:48:50 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id AC913535BD; Tue, 27 Feb 2024 06:48:36 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=linaro.org header.i=@linaro.org header.b="Dd26fzy1" Received: from mail-oi1-f173.google.com (mail-oi1-f173.google.com [209.85.167.173]) (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 8F93353388 for <linux-kernel@vger.kernel.org>; Tue, 27 Feb 2024 06:48:32 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.167.173 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1709016514; cv=none; b=b+c5yb42NQG+BBD0CwPDB1dtTqXeDpVQglHExYzP91vULywLJ7C1XAzcZmaFwbfUww5RRyo8h0DpvQ3NcLwWDIFUsRm2GIuCqRzEwEOJp+Y419iNejWo2oRsrb8Imxs3Y4FPGTJN8DNmjpBecSJ0FA+uhaAWYVSjVZ08ZYEvj4w= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1709016514; c=relaxed/simple; bh=gAZmDrTV3gdyDJKZeIBaeyHPyu+CA7GYjfEYzBnrUmk=; h=From:To:Cc:Subject:Date:Message-Id:MIME-Version; b=uyqFNvzKboJiHYCbdCQxgDs96Pfbm08e77XSN2dMAB5+bzC6AuDpKUhwTNnis8gZ/NhvEVBBXmwiv45KlHuS3/rrW/aViQ36LR1udgpm2QYJQ4izfNKjpMXDHPcHkXdR4+EBbXRN2gzMszn7ojkW9f0s8ki+jYGaWlQnx3YsK7k= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=linaro.org; spf=pass smtp.mailfrom=linaro.org; dkim=pass (2048-bit key) header.d=linaro.org header.i=@linaro.org header.b=Dd26fzy1; arc=none smtp.client-ip=209.85.167.173 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=linaro.org Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=linaro.org Received: by mail-oi1-f173.google.com with SMTP id 5614622812f47-3c19e18470aso1539688b6e.1 for <linux-kernel@vger.kernel.org>; Mon, 26 Feb 2024 22:48:32 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1709016511; x=1709621311; darn=vger.kernel.org; h=content-transfer-encoding:mime-version:message-id:date:subject:cc :to:from:from:to:cc:subject:date:message-id:reply-to; bh=6FBYjN6sLTi7L4W/93/wTWpFgwkV8FUHLIcwh/+Iuvc=; b=Dd26fzy1QUAT4wMOv5svkbmLPrnltN8NjAXGlcQAo2RZJeb31arZ7dzhq/xTvn32vz IXLfo/o+T0WgVWP4NsW/WFx59vcnr6fxrkCm2MvtQBmPvCh/vtXSOJ6CGj385xrIQueN ut+rnpgT+PeouIfYrxfyMdXQC2rcsIyJtqwqdpbhuAQQV7KIYt0WDO4v7l1xQY43UDmT S80RQvfsf4s6EQOTY9aQ51Mi2Z18JUF0+PiMHCRArnIp2NaUSCnZID8x7oE56tTP0/Pg wnkTLVOJsZxCVU3NaY7bDW5qSnVdzpZSkyt9I/NeR2lDUnfTJ+P9UPChEB1Qw+HVC1l9 WlLw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1709016511; x=1709621311; h=content-transfer-encoding:mime-version:message-id:date:subject:cc :to:from:x-gm-message-state:from:to:cc:subject:date:message-id :reply-to; bh=6FBYjN6sLTi7L4W/93/wTWpFgwkV8FUHLIcwh/+Iuvc=; b=HxZgnHMZEee+p2e3s7Ar0SXy38pB9XB2Che4qFORJ8uI9OHL4VIzp73oLsfiwkjXKm eZs+H1zPcXUjNuO0TMJCaAwUtWP7UHBCToW5ObhNGG+8mQrDobVihq3i3I1w7/OVRIrP 6YvgHolO82Nvv5JeD7WeSIouK1GJYD8Pr4fWJmqRmR4OOmmFovAsBmBpx3qOEpDh+1Xl uHck31vBWEphM5TsUeo/00rh/4xX5uJ6h0YgcC0pcCnq4Ro4vfNY3XSYA56pBh9x/GQ7 WTxEWujYCVlA7x4wNrOj1+QkOkvkhynCEFyIR02/Nv1NLCqbklXP1Z/V6aAVOCsSeK1t XGxQ== X-Forwarded-Encrypted: i=1; AJvYcCXoPbxujtri6aszLpFgvptwiyHv35wSLiEfghZzI/vbhhnCsnDtdM+nyTUOX5940wrXkXdqa0jDL8ACV0iXvpiYb9sli2c8ik3ICKGs X-Gm-Message-State: AOJu0YzXx6EceF0V8WW4XC/N2V419oNRTZv3VquUs51ZZZOx5MzXprzA kLYOYnwsVNaaVIUM2z4X3/l6HcD/Y4tCD+zaVsQN947n9Zgz+Fl6/DRDgiVjzHY= X-Received: by 2002:a05:6808:1a1e:b0:3c1:adf7:c169 with SMTP id bk30-20020a0568081a1e00b003c1adf7c169mr1037171oib.4.1709016511725; Mon, 26 Feb 2024 22:48:31 -0800 (PST) Received: from localhost.localdomain ([114.103.193.174]) by smtp.gmail.com with ESMTPSA id k2-20020aa788c2000000b006e13a88d52esm5107113pff.61.2024.02.26.22.48.27 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 26 Feb 2024 22:48:31 -0800 (PST) From: Zhangfei Gao <zhangfei.gao@linaro.org> To: Joerg Roedel <joro@8bytes.org>, Will Deacon <will@kernel.org>, jean-philippe <jean-philippe@linaro.org>, Jason Gunthorpe <jgg@nvidia.com>, baolu.lu@linux.intel.com, "Zhang, Tina" <tina.zhang@intel.com>, kevin.tian@intel.com Cc: iommu@lists.linux.dev, linux-kernel@vger.kernel.org, Zhangfei Gao <zhangfei.gao@linaro.org> Subject: [PATCH rc] iommu/sva: Fix SVA handle sharing in multi device case Date: Tue, 27 Feb 2024 06:48:21 +0000 Message-Id: <20240227064821.128-1-zhangfei.gao@linaro.org> X-Mailer: git-send-email 2.34.1 Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: <linux-kernel.vger.kernel.org> List-Subscribe: <mailto:linux-kernel+subscribe@vger.kernel.org> List-Unsubscribe: <mailto:linux-kernel+unsubscribe@vger.kernel.org> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-getmail-retrieved-from-mailbox: INBOX X-GMAIL-THRID: 1792033716908714946 X-GMAIL-MSGID: 1792033716908714946 |
Series |
[rc] iommu/sva: Fix SVA handle sharing in multi device case
|
|
Commit Message
Zhangfei Gao
Feb. 27, 2024, 6:48 a.m. UTC
iommu_sva_bind_device will directly goto out in multi-device case when found existing domain, ignoring list_add handle, which causes the handle to fail to be shared. Fixes: 65d4418c5002 ("iommu/sva: Restore SVA handle sharing") Signed-off-by: Zhangfei Gao <zhangfei.gao@linaro.org> Reviewed-by: Jason Gunthorpe <jgg@nvidia.com> --- Based on rc6 drivers/iommu/iommu-sva.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-)
Comments
On 2/27/24 2:48 PM, Zhangfei Gao wrote: > iommu_sva_bind_device will directly goto out in multi-device > case when found existing domain, ignoring list_add handle, > which causes the handle to fail to be shared. > > Fixes: 65d4418c5002 ("iommu/sva: Restore SVA handle sharing") > Signed-off-by: Zhangfei Gao<zhangfei.gao@linaro.org> > Reviewed-by: Jason Gunthorpe<jgg@nvidia.com> Reviewed-by: Lu Baolu <baolu.lu@linux.intel.com> Best regards, baolu
> From: Zhangfei Gao <zhangfei.gao@linaro.org> > Sent: Tuesday, February 27, 2024 2:48 PM > > iommu_sva_bind_device will directly goto out in multi-device > case when found existing domain, ignoring list_add handle, > which causes the handle to fail to be shared. > > Fixes: 65d4418c5002 ("iommu/sva: Restore SVA handle sharing") > Signed-off-by: Zhangfei Gao <zhangfei.gao@linaro.org> > Reviewed-by: Jason Gunthorpe <jgg@nvidia.com> Reviewed-by: Kevin Tian <kevin.tian@intel.com>
On Tue, Feb 27, 2024 at 06:48:21AM +0000, Zhangfei Gao wrote: > iommu_sva_bind_device will directly goto out in multi-device > case when found existing domain, ignoring list_add handle, > which causes the handle to fail to be shared. > > Fixes: 65d4418c5002 ("iommu/sva: Restore SVA handle sharing") > Signed-off-by: Zhangfei Gao <zhangfei.gao@linaro.org> > Reviewed-by: Jason Gunthorpe <jgg@nvidia.com> Applied, thanks.
diff --git a/drivers/iommu/iommu-sva.c b/drivers/iommu/iommu-sva.c index 7f91c8d0064b..65814cbc8402 100644 --- a/drivers/iommu/iommu-sva.c +++ b/drivers/iommu/iommu-sva.c @@ -117,11 +117,11 @@ struct iommu_sva *iommu_sva_bind_device(struct device *dev, struct mm_struct *mm if (ret) goto out_free_domain; domain->users = 1; - refcount_set(&handle->users, 1); list_add(&domain->next, &mm->iommu_mm->sva_domains); - list_add(&handle->handle_item, &mm->iommu_mm->sva_handles); out: + refcount_set(&handle->users, 1); + list_add(&handle->handle_item, &mm->iommu_mm->sva_handles); mutex_unlock(&iommu_sva_lock); handle->dev = dev; handle->domain = domain;