* [PATCH] cxl/region: Fix cxl_region_rwsem lock held when returning to user space
@ 2023-10-25 8:54 Li Zhijian
2023-10-25 20:55 ` Ira Weiny
2023-10-25 22:04 ` Dan Williams
0 siblings, 2 replies; 3+ messages in thread
From: Li Zhijian @ 2023-10-25 8:54 UTC (permalink / raw)
To: alison.schofield, vishal.l.verma, ira.weiny, bwidawsk,
dan.j.williams, linux-cxl
Cc: dave.jiang, Jonathan.Cameron, fan.ni, linux-kernel, Li Zhijian
goto out to release cxl_region_rwsem. Fix below warning:
================================================
WARNING: lock held when returning to user space!
6.6.0-rc3-lizhijian+ #213 Not tainted
------------------------------------------------
cxl/673 is leaving the kernel with locks still held!
1 lock held by cxl/673:
#0: ffffffffa013b9d0 (cxl_region_rwsem){++++}-{3:3}, at: commit_store+0x7d/0x3e0 [cxl_core]
Fixes: d1257d098a5a ("cxl/region: Move cache invalidation before region teardown, and before setup")
Signed-off-by: Li Zhijian <lizhijian@fujitsu.com>
---
drivers/cxl/core/region.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/drivers/cxl/core/region.c b/drivers/cxl/core/region.c
index 6d63b8798c29..18da77f8f22b 100644
--- a/drivers/cxl/core/region.c
+++ b/drivers/cxl/core/region.c
@@ -294,7 +294,7 @@ static ssize_t commit_store(struct device *dev, struct device_attribute *attr,
*/
rc = cxl_region_invalidate_memregion(cxlr);
if (rc)
- return rc;
+ goto out;
if (commit) {
rc = cxl_region_decode_commit(cxlr);
--
2.29.2
^ permalink raw reply related [flat|nested] 3+ messages in thread
* Re: [PATCH] cxl/region: Fix cxl_region_rwsem lock held when returning to user space
2023-10-25 8:54 [PATCH] cxl/region: Fix cxl_region_rwsem lock held when returning to user space Li Zhijian
@ 2023-10-25 20:55 ` Ira Weiny
2023-10-25 22:04 ` Dan Williams
1 sibling, 0 replies; 3+ messages in thread
From: Ira Weiny @ 2023-10-25 20:55 UTC (permalink / raw)
To: Li Zhijian, alison.schofield, vishal.l.verma, ira.weiny,
bwidawsk, dan.j.williams, linux-cxl
Cc: dave.jiang, Jonathan.Cameron, fan.ni, linux-kernel, Li Zhijian
Li Zhijian wrote:
> goto out to release cxl_region_rwsem. Fix below warning:
> ================================================
> WARNING: lock held when returning to user space!
> 6.6.0-rc3-lizhijian+ #213 Not tainted
> ------------------------------------------------
> cxl/673 is leaving the kernel with locks still held!
> 1 lock held by cxl/673:
> #0: ffffffffa013b9d0 (cxl_region_rwsem){++++}-{3:3}, at: commit_store+0x7d/0x3e0 [cxl_core]
>
> Fixes: d1257d098a5a ("cxl/region: Move cache invalidation before region teardown, and before setup")
> Signed-off-by: Li Zhijian <lizhijian@fujitsu.com>
Reviewed-by: Ira Weiny <ira.weiny@intel.com>
> ---
> drivers/cxl/core/region.c | 2 +-
> 1 file changed, 1 insertion(+), 1 deletion(-)
>
> diff --git a/drivers/cxl/core/region.c b/drivers/cxl/core/region.c
> index 6d63b8798c29..18da77f8f22b 100644
> --- a/drivers/cxl/core/region.c
> +++ b/drivers/cxl/core/region.c
> @@ -294,7 +294,7 @@ static ssize_t commit_store(struct device *dev, struct device_attribute *attr,
> */
> rc = cxl_region_invalidate_memregion(cxlr);
> if (rc)
> - return rc;
> + goto out;
>
> if (commit) {
> rc = cxl_region_decode_commit(cxlr);
> --
> 2.29.2
>
^ permalink raw reply [flat|nested] 3+ messages in thread
* RE: [PATCH] cxl/region: Fix cxl_region_rwsem lock held when returning to user space
2023-10-25 8:54 [PATCH] cxl/region: Fix cxl_region_rwsem lock held when returning to user space Li Zhijian
2023-10-25 20:55 ` Ira Weiny
@ 2023-10-25 22:04 ` Dan Williams
1 sibling, 0 replies; 3+ messages in thread
From: Dan Williams @ 2023-10-25 22:04 UTC (permalink / raw)
To: Li Zhijian, alison.schofield, vishal.l.verma, ira.weiny,
bwidawsk, dan.j.williams, linux-cxl
Cc: dave.jiang, Jonathan.Cameron, fan.ni, linux-kernel, Li Zhijian
Li Zhijian wrote:
> goto out to release cxl_region_rwsem. Fix below warning:
Hi, this change looks good, the changelog would benefit from more
detail so that backporters can determine how important this fix is. I
will add the following:
---
cxl_region_invalidate_memregion() on x86 invokes wbinvd which is a
problematic instruction for virtualized environments. So, on virtualized
x86, cxl_region_invalidate_memregion() returns an error. This failure
case got missed because CXL memory-expander device passthrough is not a
production use case, and emulation of CXL devices is typically limited
to kernel development builds with CONFIG_CXL_REGION_INVALIDATION_TEST=y,
that makes cxl_region_invalidate_memregion() succeed.
In other words, the expected exposure of this bug is limited to CXL
subsystem development environments using QEMU that neglected
CONFIG_CXL_REGION_INVALIDATION_TEST=y.
> ================================================
> WARNING: lock held when returning to user space!
> 6.6.0-rc3-lizhijian+ #213 Not tainted
> ------------------------------------------------
> cxl/673 is leaving the kernel with locks still held!
> 1 lock held by cxl/673:
> #0: ffffffffa013b9d0 (cxl_region_rwsem){++++}-{3:3}, at: commit_store+0x7d/0x3e0 [cxl_core]
>
> Fixes: d1257d098a5a ("cxl/region: Move cache invalidation before region teardown, and before setup")
> Signed-off-by: Li Zhijian <lizhijian@fujitsu.com>
> ---
> drivers/cxl/core/region.c | 2 +-
> 1 file changed, 1 insertion(+), 1 deletion(-)
>
> diff --git a/drivers/cxl/core/region.c b/drivers/cxl/core/region.c
> index 6d63b8798c29..18da77f8f22b 100644
> --- a/drivers/cxl/core/region.c
> +++ b/drivers/cxl/core/region.c
> @@ -294,7 +294,7 @@ static ssize_t commit_store(struct device *dev, struct device_attribute *attr,
> */
> rc = cxl_region_invalidate_memregion(cxlr);
> if (rc)
> - return rc;
> + goto out;
>
> if (commit) {
> rc = cxl_region_decode_commit(cxlr);
> --
> 2.29.2
>
^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2023-10-25 22:05 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2023-10-25 8:54 [PATCH] cxl/region: Fix cxl_region_rwsem lock held when returning to user space Li Zhijian
2023-10-25 20:55 ` Ira Weiny
2023-10-25 22:04 ` Dan Williams
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.