All of lore.kernel.org
 help / color / mirror / Atom feed
From: Jason Gunthorpe <jgg@nvidia.com>
To: Marek Szyprowski <m.szyprowski@samsung.com>
Cc: Baolin Wang <baolin.wang@linux.alibaba.com>,
	David Woodhouse <dwmw2@infradead.org>,
	Heiko Stuebner <heiko@sntech.de>,
	iommu@lists.linux.dev, Jernej Skrabec <jernej.skrabec@gmail.com>,
	Joerg Roedel <joro@8bytes.org>,
	linux-arm-kernel@lists.infradead.org,
	linux-rockchip@lists.infradead.org, linux-sunxi@lists.linux.dev,
	Orson Zhai <orsonzhai@gmail.com>,
	Robin Murphy <robin.murphy@arm.com>,
	Samuel Holland <samuel@sholland.org>,
	Chen-Yu Tsai <wens@csie.org>, Will Deacon <will@kernel.org>,
	Chunyan Zhang <zhang.lyra@gmail.com>,
	Alex Williamson <alex.williamson@redhat.com>,
	Lu Baolu <baolu.lu@linux.intel.com>
Subject: Re: [PATCH v2 06/10] iommu/rockchip: Convert to generic_single_device_group()
Date: Wed, 9 Aug 2023 10:51:12 -0300	[thread overview]
Message-ID: <ZNOZ0M48+DAhDBWZ@nvidia.com> (raw)
In-Reply-To: <e5e75222-13a9-ee01-0c25-8311b622fe0d@samsung.com>

On Wed, Aug 09, 2023 at 03:19:34PM +0200, Marek Szyprowski wrote:
> Hi Jason,
> 
> On 31.07.2023 19:50, Jason Gunthorpe wrote:
> > Use the new helper.
> >
> > Signed-off-by: Jason Gunthorpe <jgg@nvidia.com>
> > ---
> >   drivers/iommu/rockchip-iommu.c | 22 ++--------------------
> >   1 file changed, 2 insertions(+), 20 deletions(-)
> 
> After applying your recent fixes from "[PATCH 0/3] Fix device_lock 
> deadlock on two probe() paths" thread I've decided to run more tests on 
> all boards I have. This way I found that this patch breaks booting of 
> Odroid-M1 board, which is ARM64 system based on Rockchip RK3568 
> (arch/arm64/boot/dts/rockchip/rk3568-odroid-m1.dts). Here is the log:

Is this why?

diff --git a/drivers/iommu/iommu.c b/drivers/iommu/iommu.c
index 8842f4975ec4a8..8677d3ace47bbe 100644
--- a/drivers/iommu/iommu.c
+++ b/drivers/iommu/iommu.c
@@ -366,6 +366,7 @@ static int iommu_init_device(struct device *dev, const struct iommu_ops *ops)
 		ret = PTR_ERR(iommu_dev);
 		goto err_module_put;
 	}
+	dev->iommu->iommu_dev = iommu_dev;
 
 	ret = iommu_device_link(iommu_dev, dev);
 	if (ret)
@@ -383,7 +384,6 @@ static int iommu_init_device(struct device *dev, const struct iommu_ops *ops)
 	dev->iommu_group = group;
 	mutex_unlock(&dev_iommu_group_lock);
 
-	dev->iommu->iommu_dev = iommu_dev;
 	dev->iommu->max_pasids = dev_iommu_get_max_pasids(dev);
 	if (ops->is_attach_deferred)
 		dev->iommu->attach_deferred = ops->is_attach_deferred(dev);
@@ -397,6 +397,7 @@ static int iommu_init_device(struct device *dev, const struct iommu_ops *ops)
 err_module_put:
 	module_put(ops->owner);
 err_free:
+	dev->iommu->iommu_dev = NULL;
 	dev_iommu_free(dev);
 	return ret;
 }

Thanks,
Jason

WARNING: multiple messages have this Message-ID (diff)
From: Jason Gunthorpe <jgg@nvidia.com>
To: Marek Szyprowski <m.szyprowski@samsung.com>
Cc: Baolin Wang <baolin.wang@linux.alibaba.com>,
	David Woodhouse <dwmw2@infradead.org>,
	Heiko Stuebner <heiko@sntech.de>,
	iommu@lists.linux.dev, Jernej Skrabec <jernej.skrabec@gmail.com>,
	Joerg Roedel <joro@8bytes.org>,
	linux-arm-kernel@lists.infradead.org,
	linux-rockchip@lists.infradead.org, linux-sunxi@lists.linux.dev,
	Orson Zhai <orsonzhai@gmail.com>,
	Robin Murphy <robin.murphy@arm.com>,
	Samuel Holland <samuel@sholland.org>,
	Chen-Yu Tsai <wens@csie.org>, Will Deacon <will@kernel.org>,
	Chunyan Zhang <zhang.lyra@gmail.com>,
	Alex Williamson <alex.williamson@redhat.com>,
	Lu Baolu <baolu.lu@linux.intel.com>
Subject: Re: [PATCH v2 06/10] iommu/rockchip: Convert to generic_single_device_group()
Date: Wed, 9 Aug 2023 10:51:12 -0300	[thread overview]
Message-ID: <ZNOZ0M48+DAhDBWZ@nvidia.com> (raw)
In-Reply-To: <e5e75222-13a9-ee01-0c25-8311b622fe0d@samsung.com>

On Wed, Aug 09, 2023 at 03:19:34PM +0200, Marek Szyprowski wrote:
> Hi Jason,
> 
> On 31.07.2023 19:50, Jason Gunthorpe wrote:
> > Use the new helper.
> >
> > Signed-off-by: Jason Gunthorpe <jgg@nvidia.com>
> > ---
> >   drivers/iommu/rockchip-iommu.c | 22 ++--------------------
> >   1 file changed, 2 insertions(+), 20 deletions(-)
> 
> After applying your recent fixes from "[PATCH 0/3] Fix device_lock 
> deadlock on two probe() paths" thread I've decided to run more tests on 
> all boards I have. This way I found that this patch breaks booting of 
> Odroid-M1 board, which is ARM64 system based on Rockchip RK3568 
> (arch/arm64/boot/dts/rockchip/rk3568-odroid-m1.dts). Here is the log:

Is this why?

diff --git a/drivers/iommu/iommu.c b/drivers/iommu/iommu.c
index 8842f4975ec4a8..8677d3ace47bbe 100644
--- a/drivers/iommu/iommu.c
+++ b/drivers/iommu/iommu.c
@@ -366,6 +366,7 @@ static int iommu_init_device(struct device *dev, const struct iommu_ops *ops)
 		ret = PTR_ERR(iommu_dev);
 		goto err_module_put;
 	}
+	dev->iommu->iommu_dev = iommu_dev;
 
 	ret = iommu_device_link(iommu_dev, dev);
 	if (ret)
@@ -383,7 +384,6 @@ static int iommu_init_device(struct device *dev, const struct iommu_ops *ops)
 	dev->iommu_group = group;
 	mutex_unlock(&dev_iommu_group_lock);
 
-	dev->iommu->iommu_dev = iommu_dev;
 	dev->iommu->max_pasids = dev_iommu_get_max_pasids(dev);
 	if (ops->is_attach_deferred)
 		dev->iommu->attach_deferred = ops->is_attach_deferred(dev);
@@ -397,6 +397,7 @@ static int iommu_init_device(struct device *dev, const struct iommu_ops *ops)
 err_module_put:
 	module_put(ops->owner);
 err_free:
+	dev->iommu->iommu_dev = NULL;
 	dev_iommu_free(dev);
 	return ret;
 }

Thanks,
Jason

_______________________________________________
Linux-rockchip mailing list
Linux-rockchip@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-rockchip

WARNING: multiple messages have this Message-ID (diff)
From: Jason Gunthorpe <jgg@nvidia.com>
To: Marek Szyprowski <m.szyprowski@samsung.com>
Cc: Baolin Wang <baolin.wang@linux.alibaba.com>,
	David Woodhouse <dwmw2@infradead.org>,
	Heiko Stuebner <heiko@sntech.de>,
	iommu@lists.linux.dev, Jernej Skrabec <jernej.skrabec@gmail.com>,
	Joerg Roedel <joro@8bytes.org>,
	linux-arm-kernel@lists.infradead.org,
	linux-rockchip@lists.infradead.org, linux-sunxi@lists.linux.dev,
	Orson Zhai <orsonzhai@gmail.com>,
	Robin Murphy <robin.murphy@arm.com>,
	Samuel Holland <samuel@sholland.org>,
	Chen-Yu Tsai <wens@csie.org>, Will Deacon <will@kernel.org>,
	Chunyan Zhang <zhang.lyra@gmail.com>,
	Alex Williamson <alex.williamson@redhat.com>,
	Lu Baolu <baolu.lu@linux.intel.com>
Subject: Re: [PATCH v2 06/10] iommu/rockchip: Convert to generic_single_device_group()
Date: Wed, 9 Aug 2023 10:51:12 -0300	[thread overview]
Message-ID: <ZNOZ0M48+DAhDBWZ@nvidia.com> (raw)
In-Reply-To: <e5e75222-13a9-ee01-0c25-8311b622fe0d@samsung.com>

On Wed, Aug 09, 2023 at 03:19:34PM +0200, Marek Szyprowski wrote:
> Hi Jason,
> 
> On 31.07.2023 19:50, Jason Gunthorpe wrote:
> > Use the new helper.
> >
> > Signed-off-by: Jason Gunthorpe <jgg@nvidia.com>
> > ---
> >   drivers/iommu/rockchip-iommu.c | 22 ++--------------------
> >   1 file changed, 2 insertions(+), 20 deletions(-)
> 
> After applying your recent fixes from "[PATCH 0/3] Fix device_lock 
> deadlock on two probe() paths" thread I've decided to run more tests on 
> all boards I have. This way I found that this patch breaks booting of 
> Odroid-M1 board, which is ARM64 system based on Rockchip RK3568 
> (arch/arm64/boot/dts/rockchip/rk3568-odroid-m1.dts). Here is the log:

Is this why?

diff --git a/drivers/iommu/iommu.c b/drivers/iommu/iommu.c
index 8842f4975ec4a8..8677d3ace47bbe 100644
--- a/drivers/iommu/iommu.c
+++ b/drivers/iommu/iommu.c
@@ -366,6 +366,7 @@ static int iommu_init_device(struct device *dev, const struct iommu_ops *ops)
 		ret = PTR_ERR(iommu_dev);
 		goto err_module_put;
 	}
+	dev->iommu->iommu_dev = iommu_dev;
 
 	ret = iommu_device_link(iommu_dev, dev);
 	if (ret)
@@ -383,7 +384,6 @@ static int iommu_init_device(struct device *dev, const struct iommu_ops *ops)
 	dev->iommu_group = group;
 	mutex_unlock(&dev_iommu_group_lock);
 
-	dev->iommu->iommu_dev = iommu_dev;
 	dev->iommu->max_pasids = dev_iommu_get_max_pasids(dev);
 	if (ops->is_attach_deferred)
 		dev->iommu->attach_deferred = ops->is_attach_deferred(dev);
@@ -397,6 +397,7 @@ static int iommu_init_device(struct device *dev, const struct iommu_ops *ops)
 err_module_put:
 	module_put(ops->owner);
 err_free:
+	dev->iommu->iommu_dev = NULL;
 	dev_iommu_free(dev);
 	return ret;
 }

Thanks,
Jason

_______________________________________________
linux-arm-kernel mailing list
linux-arm-kernel@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel

  reply	other threads:[~2023-08-09 13:51 UTC|newest]

Thread overview: 102+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-07-31 17:50 [PATCH v2 00/10] Refine the locking for dev->iommu_group Jason Gunthorpe
2023-07-31 17:50 ` Jason Gunthorpe
2023-07-31 17:50 ` Jason Gunthorpe
2023-07-31 17:50 ` [PATCH v2 01/10] iommu: Remove useless group refcounting Jason Gunthorpe
2023-07-31 17:50   ` Jason Gunthorpe
2023-07-31 17:50   ` Jason Gunthorpe
2023-08-02  1:33   ` Tian, Kevin
2023-08-02  1:33     ` Tian, Kevin
2023-08-02  1:33     ` Tian, Kevin
2023-07-31 17:50 ` [PATCH v2 02/10] iommu: Add a lockdep assertion for remaining dev->iommu_group reads Jason Gunthorpe
2023-07-31 17:50   ` Jason Gunthorpe
2023-07-31 17:50   ` Jason Gunthorpe
2023-08-02  1:34   ` Tian, Kevin
2023-08-02  1:34     ` Tian, Kevin
2023-08-02  1:34     ` Tian, Kevin
2023-08-08 16:22   ` Robin Murphy
2023-08-08 16:22     ` Robin Murphy
2023-08-08 16:22     ` Robin Murphy
2023-08-08 16:54     ` Jason Gunthorpe
2023-08-08 16:54       ` Jason Gunthorpe
2023-08-08 16:54       ` Jason Gunthorpe
2023-07-31 17:50 ` [PATCH v2 03/10] iommu: Add generic_single_device_group() Jason Gunthorpe
2023-07-31 17:50   ` Jason Gunthorpe
2023-07-31 17:50   ` Jason Gunthorpe
2023-08-02  1:35   ` Tian, Kevin
2023-08-02  1:35     ` Tian, Kevin
2023-08-02  1:35     ` Tian, Kevin
2023-07-31 17:50 ` [PATCH v2 04/10] iommu/sun50i: Convert to generic_single_device_group() Jason Gunthorpe
2023-07-31 17:50   ` Jason Gunthorpe
2023-07-31 17:50   ` Jason Gunthorpe
2023-07-31 17:50 ` [PATCH v2 05/10] iommu/sprd: " Jason Gunthorpe
2023-07-31 17:50   ` Jason Gunthorpe
2023-07-31 17:50   ` Jason Gunthorpe
2023-07-31 17:50 ` [PATCH v2 06/10] iommu/rockchip: " Jason Gunthorpe
2023-07-31 17:50   ` Jason Gunthorpe
2023-07-31 17:50   ` Jason Gunthorpe
2023-08-09 13:19   ` Marek Szyprowski
2023-08-09 13:19     ` Marek Szyprowski
2023-08-09 13:19     ` Marek Szyprowski
2023-08-09 13:51     ` Jason Gunthorpe [this message]
2023-08-09 13:51       ` Jason Gunthorpe
2023-08-09 13:51       ` Jason Gunthorpe
2023-08-09 14:02       ` Marek Szyprowski
2023-08-09 14:02         ` Marek Szyprowski
2023-08-09 14:02         ` Marek Szyprowski
2023-07-31 17:50 ` [PATCH v2 07/10] iommu/ipmmu-vmsa: " Jason Gunthorpe
2023-07-31 17:50   ` Jason Gunthorpe
2023-07-31 17:50   ` Jason Gunthorpe
2023-07-31 17:50 ` [PATCH v2 08/10] iommu/omap: " Jason Gunthorpe
2023-07-31 17:50   ` Jason Gunthorpe
2023-07-31 17:50   ` Jason Gunthorpe
2023-07-31 17:50 ` [PATCH v2 09/10] iommu: Complete the locking for dev->iommu_group Jason Gunthorpe
2023-07-31 17:50   ` Jason Gunthorpe
2023-07-31 17:50   ` Jason Gunthorpe
2023-08-02  1:36   ` Tian, Kevin
2023-08-02  1:36     ` Tian, Kevin
2023-08-02  1:36     ` Tian, Kevin
2023-08-09 12:55   ` [PATCH v2 9/10] " Konrad Dybcio
2023-08-09 12:55     ` Konrad Dybcio
2023-08-09 12:55     ` Konrad Dybcio
2023-07-31 17:50 ` [PATCH v2 10/10] iommu/intel: Fix missing locking for show_device_domain_translation() Jason Gunthorpe
2023-07-31 17:50   ` Jason Gunthorpe
2023-07-31 17:50   ` Jason Gunthorpe
2023-08-02  1:37   ` Tian, Kevin
2023-08-02  1:37     ` Tian, Kevin
2023-08-02  1:37     ` Tian, Kevin
2023-08-07 12:54 ` [PATCH v2 00/10] Refine the locking for dev->iommu_group Joerg Roedel
2023-08-07 12:54   ` Joerg Roedel
2023-08-07 12:54   ` Joerg Roedel
2023-08-08 10:31   ` Chen-Yu Tsai
2023-08-08 10:31     ` Chen-Yu Tsai
2023-08-08 10:31     ` Chen-Yu Tsai
2023-08-08 12:24     ` Jason Gunthorpe
2023-08-08 12:24       ` Jason Gunthorpe
2023-08-08 12:24       ` Jason Gunthorpe
2023-08-08 12:32     ` Marek Szyprowski
2023-08-08 12:32       ` Marek Szyprowski
2023-08-08 12:32       ` Marek Szyprowski
2023-08-08 13:00       ` Jason Gunthorpe
2023-08-08 13:00         ` Jason Gunthorpe
2023-08-08 13:00         ` Jason Gunthorpe
2023-08-08 13:08         ` Marek Szyprowski
2023-08-08 13:08           ` Marek Szyprowski
2023-08-08 13:08           ` Marek Szyprowski
2023-08-08 13:25           ` Jason Gunthorpe
2023-08-08 13:25             ` Jason Gunthorpe
2023-08-08 13:25             ` Jason Gunthorpe
2023-08-08 14:02             ` Marek Szyprowski
2023-08-08 14:02               ` Marek Szyprowski
2023-08-08 14:02               ` Marek Szyprowski
2023-08-08 14:30               ` Jason Gunthorpe
2023-08-08 14:30                 ` Jason Gunthorpe
2023-08-08 14:30                 ` Jason Gunthorpe
2023-08-08 14:51                 ` Marek Szyprowski
2023-08-08 14:51                   ` Marek Szyprowski
2023-08-08 14:51                   ` Marek Szyprowski
2023-08-09  6:23                 ` Chen-Yu Tsai
2023-08-09  6:23                   ` Chen-Yu Tsai
2023-08-09  6:23                   ` Chen-Yu Tsai
2023-08-08 13:00       ` Marek Szyprowski
2023-08-08 13:00         ` Marek Szyprowski
2023-08-08 13:00         ` Marek Szyprowski

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=ZNOZ0M48+DAhDBWZ@nvidia.com \
    --to=jgg@nvidia.com \
    --cc=alex.williamson@redhat.com \
    --cc=baolin.wang@linux.alibaba.com \
    --cc=baolu.lu@linux.intel.com \
    --cc=dwmw2@infradead.org \
    --cc=heiko@sntech.de \
    --cc=iommu@lists.linux.dev \
    --cc=jernej.skrabec@gmail.com \
    --cc=joro@8bytes.org \
    --cc=linux-arm-kernel@lists.infradead.org \
    --cc=linux-rockchip@lists.infradead.org \
    --cc=linux-sunxi@lists.linux.dev \
    --cc=m.szyprowski@samsung.com \
    --cc=orsonzhai@gmail.com \
    --cc=robin.murphy@arm.com \
    --cc=samuel@sholland.org \
    --cc=wens@csie.org \
    --cc=will@kernel.org \
    --cc=zhang.lyra@gmail.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.