* [STABLE] stable backport request for 6.1 for io_uring
@ 2023-08-28 21:55 Helge Deller
2023-08-30 16:17 ` Jens Axboe
0 siblings, 1 reply; 8+ messages in thread
From: Helge Deller @ 2023-08-28 21:55 UTC (permalink / raw)
To: stable, Greg Kroah-Hartman, Sasha Levin, linux-parisc, Jens Axboe
Cc: Vidra.Jonas, Sam James, John David Anglin
Hello Greg, Hello Jens, Hello stable team,
would you please accept some backports to v6.1-stable for io_uring()?
io_uring() fails on parisc because of some missing upstream patches.
Since 6.1 is currently used in debian and gentoo as main kernel we
face some build errors due to the missing patches.
Here are the 3 steps I'm asking for (for kernel 6.1-stable only, the others are OK):
1) cherry-pick this upstream commit:
commit 567b35159e76997e95b643b9a8a5d9d2198f2522
Author: John David Anglin <dave@parisc-linux.org>
Date: Sun Feb 26 18:03:33 2023 +0000
parisc: Cleanup mmap implementation regarding color alignment
2) cherry-pick this upstream commit:
commit b5d89408b9fb21258f7c371d6d48a674f60f7181
Author: Helge Deller <deller@gmx.de>
Date: Fri Jun 30 12:36:09 2023 +0200
parisc: sys_parisc: parisc_personality() is called from asm code
3) apply the patch below as manual backport:
I think this is the least invasive change and I wasn't able to otherwise
simply pull in the upstream patches without touching code I don't want
to touch (and keep life easier for Jens if he wants to backport other
patches later).
Thanks!
Helge
From: Helge Deller <deller@gmx.de>
Date: Mon, 28 Aug 2023 23:07:49 +0200
Subject: [PATCH] io_uring/parisc: Adjust pgoff in io_uring mmap() for parisc
Vidra Jonas reported issues on parisc with libuv which then triggers
build errors with cmake. Debugging shows that those issues stem from
io_uring().
I was not able to easily pull in upstream commits directly, so here
is IMHO the least invasive manual backport of the following upstream
commits to fix the cache aliasing issues on parisc on kernel 6.1
with io_uring:
56675f8b9f9b ("io_uring/parisc: Adjust pgoff in io_uring mmap() for parisc")
32832a407a71 ("io_uring: Fix io_uring mmap() by using architecture-provided get_unmapped_area()")
d808459b2e31 ("io_uring: Adjust mapping wrt architecture aliasing requirements")
With this patch kernel 6.1 has all relevant mmap changes and is
identical to kernel 6.5 with regard to mmap() in io_uring.
Signed-off-by: Helge Deller <deller@gmx.de>
Reported-by: Vidra.Jonas@seznam.cz
Link: https://lore.kernel.org/linux-parisc/520.NvTX.6mXZpmfh4Ju.1awpAS@seznam.cz/
Cc: Sam James <sam@gentoo.org>
Cc: John David Anglin <dave.anglin@bell.net>
diff --git a/io_uring/io_uring.c b/io_uring/io_uring.c
index ed8e9deae284..b0e47fe1eb4b 100644
--- a/io_uring/io_uring.c
+++ b/io_uring/io_uring.c
@@ -72,6 +72,7 @@
#include <linux/io_uring.h>
#include <linux/audit.h>
#include <linux/security.h>
+#include <asm/shmparam.h>
#define CREATE_TRACE_POINTS
#include <trace/events/io_uring.h>
@@ -3110,6 +3111,49 @@ static __cold int io_uring_mmap(struct file *file, struct vm_area_struct *vma)
return remap_pfn_range(vma, vma->vm_start, pfn, sz, vma->vm_page_prot);
}
+static unsigned long io_uring_mmu_get_unmapped_area(struct file *filp,
+ unsigned long addr, unsigned long len,
+ unsigned long pgoff, unsigned long flags)
+{
+ void *ptr;
+
+ /*
+ * Do not allow to map to user-provided address to avoid breaking the
+ * aliasing rules. Userspace is not able to guess the offset address of
+ * kernel kmalloc()ed memory area.
+ */
+ if (addr)
+ return -EINVAL;
+
+ ptr = io_uring_validate_mmap_request(filp, pgoff, len);
+ if (IS_ERR(ptr))
+ return -ENOMEM;
+
+ /*
+ * Some architectures have strong cache aliasing requirements.
+ * For such architectures we need a coherent mapping which aliases
+ * kernel memory *and* userspace memory. To achieve that:
+ * - use a NULL file pointer to reference physical memory, and
+ * - use the kernel virtual address of the shared io_uring context
+ * (instead of the userspace-provided address, which has to be 0UL
+ * anyway).
+ * - use the same pgoff which the get_unmapped_area() uses to
+ * calculate the page colouring.
+ * For architectures without such aliasing requirements, the
+ * architecture will return any suitable mapping because addr is 0.
+ */
+ filp = NULL;
+ flags |= MAP_SHARED;
+ pgoff = 0; /* has been translated to ptr above */
+#ifdef SHM_COLOUR
+ addr = (uintptr_t) ptr;
+ pgoff = addr >> PAGE_SHIFT;
+#else
+ addr = 0UL;
+#endif
+ return current->mm->get_unmapped_area(filp, addr, len, pgoff, flags);
+}
+
#else /* !CONFIG_MMU */
static int io_uring_mmap(struct file *file, struct vm_area_struct *vma)
@@ -3324,6 +3368,8 @@ static const struct file_operations io_uring_fops = {
#ifndef CONFIG_MMU
.get_unmapped_area = io_uring_nommu_get_unmapped_area,
.mmap_capabilities = io_uring_nommu_mmap_capabilities,
+#else
+ .get_unmapped_area = io_uring_mmu_get_unmapped_area,
#endif
.poll = io_uring_poll,
#ifdef CONFIG_PROC_FS
^ permalink raw reply related [flat|nested] 8+ messages in thread
* Re: [STABLE] stable backport request for 6.1 for io_uring
2023-08-28 21:55 [STABLE] stable backport request for 6.1 for io_uring Helge Deller
@ 2023-08-30 16:17 ` Jens Axboe
2023-08-31 10:50 ` Greg Kroah-Hartman
2023-09-02 23:04 ` John David Anglin
0 siblings, 2 replies; 8+ messages in thread
From: Jens Axboe @ 2023-08-30 16:17 UTC (permalink / raw)
To: Helge Deller, stable, Greg Kroah-Hartman, Sasha Levin,
linux-parisc
Cc: Vidra.Jonas, Sam James, John David Anglin
On 8/28/23 3:55 PM, Helge Deller wrote:
> Hello Greg, Hello Jens, Hello stable team,
>
> would you please accept some backports to v6.1-stable for io_uring()?
> io_uring() fails on parisc because of some missing upstream patches.
> Since 6.1 is currently used in debian and gentoo as main kernel we
> face some build errors due to the missing patches.
Fine with me.
--
Jens Axboe
^ permalink raw reply [flat|nested] 8+ messages in thread
* Re: [STABLE] stable backport request for 6.1 for io_uring
2023-08-30 16:17 ` Jens Axboe
@ 2023-08-31 10:50 ` Greg Kroah-Hartman
2023-09-02 23:04 ` John David Anglin
1 sibling, 0 replies; 8+ messages in thread
From: Greg Kroah-Hartman @ 2023-08-31 10:50 UTC (permalink / raw)
To: Jens Axboe
Cc: Helge Deller, stable, Sasha Levin, linux-parisc, Vidra.Jonas,
Sam James, John David Anglin
On Wed, Aug 30, 2023 at 10:17:39AM -0600, Jens Axboe wrote:
> On 8/28/23 3:55 PM, Helge Deller wrote:
> > Hello Greg, Hello Jens, Hello stable team,
> >
> > would you please accept some backports to v6.1-stable for io_uring()?
> > io_uring() fails on parisc because of some missing upstream patches.
> > Since 6.1 is currently used in debian and gentoo as main kernel we
> > face some build errors due to the missing patches.
>
> Fine with me.
Now queued up, thanks.
greg k-h
^ permalink raw reply [flat|nested] 8+ messages in thread
* Re: [STABLE] stable backport request for 6.1 for io_uring
2023-08-30 16:17 ` Jens Axboe
2023-08-31 10:50 ` Greg Kroah-Hartman
@ 2023-09-02 23:04 ` John David Anglin
2023-09-03 0:45 ` Jens Axboe
1 sibling, 1 reply; 8+ messages in thread
From: John David Anglin @ 2023-09-02 23:04 UTC (permalink / raw)
To: Jens Axboe, Helge Deller, stable, Greg Kroah-Hartman, Sasha Levin,
linux-parisc
Cc: Vidra.Jonas, Sam James
On 2023-08-30 12:17 p.m., Jens Axboe wrote:
> On 8/28/23 3:55 PM, Helge Deller wrote:
>> Hello Greg, Hello Jens, Hello stable team,
>>
>> would you please accept some backports to v6.1-stable for io_uring()?
>> io_uring() fails on parisc because of some missing upstream patches.
>> Since 6.1 is currently used in debian and gentoo as main kernel we
>> face some build errors due to the missing patches.
> Fine with me.
This is probably not a problem with the backport but I see this fail in liburing tests:
Running test wq-aff.t open: No such file or directory
test sqpoll failed
Test wq-aff.t failed with ret 1
Running test xattr.t 0 sec [0]
Running test statx.t 0 sec [0]
Running test sq-full-cpp.t 0 sec [0]
Tests failed (1): <wq-aff.t>
Dave
--
John David Anglin dave.anglin@bell.net
^ permalink raw reply [flat|nested] 8+ messages in thread
* Re: [STABLE] stable backport request for 6.1 for io_uring
2023-09-02 23:04 ` John David Anglin
@ 2023-09-03 0:45 ` Jens Axboe
2023-09-03 5:32 ` Greg Kroah-Hartman
0 siblings, 1 reply; 8+ messages in thread
From: Jens Axboe @ 2023-09-03 0:45 UTC (permalink / raw)
To: John David Anglin, Helge Deller, stable, Greg Kroah-Hartman,
Sasha Levin, linux-parisc
Cc: Vidra.Jonas, Sam James
On 9/2/23 5:04 PM, John David Anglin wrote:
> On 2023-08-30 12:17 p.m., Jens Axboe wrote:
>> On 8/28/23 3:55 PM, Helge Deller wrote:
>>> Hello Greg, Hello Jens, Hello stable team,
>>>
>>> would you please accept some backports to v6.1-stable for io_uring()?
>>> io_uring() fails on parisc because of some missing upstream patches.
>>> Since 6.1 is currently used in debian and gentoo as main kernel we
>>> face some build errors due to the missing patches.
>> Fine with me.
> This is probably not a problem with the backport but I see this fail in liburing tests:
>
> Running test wq-aff.t open: No such file or directory
> test sqpoll failed
> Test wq-aff.t failed with ret 1
> Running test xattr.t 0 sec [0]
> Running test statx.t 0 sec [0]
> Running test sq-full-cpp.t 0 sec [0]
> Tests failed (1): <wq-aff.t>
That's because 6.1-stable is missing:
commit ebdfefc09c6de7897962769bd3e63a2ff443ebf5
Author: Jens Axboe <axboe@kernel.dk>
Date: Sun Aug 13 11:05:36 2023 -0600
io_uring/sqpoll: fix io-wq affinity when IORING_SETUP_SQPOLL is used
which went in recently and hasn't been backported to stable yet.
--
Jens Axboe
^ permalink raw reply [flat|nested] 8+ messages in thread
* Re: [STABLE] stable backport request for 6.1 for io_uring
2023-09-03 0:45 ` Jens Axboe
@ 2023-09-03 5:32 ` Greg Kroah-Hartman
2023-09-03 13:25 ` Jens Axboe
0 siblings, 1 reply; 8+ messages in thread
From: Greg Kroah-Hartman @ 2023-09-03 5:32 UTC (permalink / raw)
To: Jens Axboe
Cc: John David Anglin, Helge Deller, stable, Sasha Levin,
linux-parisc, Vidra.Jonas, Sam James
On Sat, Sep 02, 2023 at 06:45:56PM -0600, Jens Axboe wrote:
> On 9/2/23 5:04 PM, John David Anglin wrote:
> > On 2023-08-30 12:17 p.m., Jens Axboe wrote:
> >> On 8/28/23 3:55 PM, Helge Deller wrote:
> >>> Hello Greg, Hello Jens, Hello stable team,
> >>>
> >>> would you please accept some backports to v6.1-stable for io_uring()?
> >>> io_uring() fails on parisc because of some missing upstream patches.
> >>> Since 6.1 is currently used in debian and gentoo as main kernel we
> >>> face some build errors due to the missing patches.
> >> Fine with me.
> > This is probably not a problem with the backport but I see this fail in liburing tests:
> >
> > Running test wq-aff.t open: No such file or directory
> > test sqpoll failed
> > Test wq-aff.t failed with ret 1
> > Running test xattr.t 0 sec [0]
> > Running test statx.t 0 sec [0]
> > Running test sq-full-cpp.t 0 sec [0]
> > Tests failed (1): <wq-aff.t>
>
> That's because 6.1-stable is missing:
>
> commit ebdfefc09c6de7897962769bd3e63a2ff443ebf5
> Author: Jens Axboe <axboe@kernel.dk>
> Date: Sun Aug 13 11:05:36 2023 -0600
>
> io_uring/sqpoll: fix io-wq affinity when IORING_SETUP_SQPOLL is used
>
> which went in recently and hasn't been backported to stable yet.
We can add that now to the stable queues if you want, otherwise we are
supposed to wait until -rc1.
thanks,
greg k-h
^ permalink raw reply [flat|nested] 8+ messages in thread
* Re: [STABLE] stable backport request for 6.1 for io_uring
2023-09-03 5:32 ` Greg Kroah-Hartman
@ 2023-09-03 13:25 ` Jens Axboe
2023-09-03 13:50 ` Greg Kroah-Hartman
0 siblings, 1 reply; 8+ messages in thread
From: Jens Axboe @ 2023-09-03 13:25 UTC (permalink / raw)
To: Greg Kroah-Hartman
Cc: John David Anglin, Helge Deller, stable, Sasha Levin,
linux-parisc, Vidra.Jonas, Sam James
On 9/2/23 11:32 PM, Greg Kroah-Hartman wrote:
> On Sat, Sep 02, 2023 at 06:45:56PM -0600, Jens Axboe wrote:
>> On 9/2/23 5:04 PM, John David Anglin wrote:
>>> On 2023-08-30 12:17 p.m., Jens Axboe wrote:
>>>> On 8/28/23 3:55 PM, Helge Deller wrote:
>>>>> Hello Greg, Hello Jens, Hello stable team,
>>>>>
>>>>> would you please accept some backports to v6.1-stable for io_uring()?
>>>>> io_uring() fails on parisc because of some missing upstream patches.
>>>>> Since 6.1 is currently used in debian and gentoo as main kernel we
>>>>> face some build errors due to the missing patches.
>>>> Fine with me.
>>> This is probably not a problem with the backport but I see this fail in liburing tests:
>>>
>>> Running test wq-aff.t open: No such file or directory
>>> test sqpoll failed
>>> Test wq-aff.t failed with ret 1
>>> Running test xattr.t 0 sec [0]
>>> Running test statx.t 0 sec [0]
>>> Running test sq-full-cpp.t 0 sec [0]
>>> Tests failed (1): <wq-aff.t>
>>
>> That's because 6.1-stable is missing:
>>
>> commit ebdfefc09c6de7897962769bd3e63a2ff443ebf5
>> Author: Jens Axboe <axboe@kernel.dk>
>> Date: Sun Aug 13 11:05:36 2023 -0600
>>
>> io_uring/sqpoll: fix io-wq affinity when IORING_SETUP_SQPOLL is used
>>
>> which went in recently and hasn't been backported to stable yet.
>
> We can add that now to the stable queues if you want, otherwise we are
> supposed to wait until -rc1.
It's fine to wait for -rc1, it's not an urgent fix by any stretch. I
just always queue up test cases when a fix is headed upstream. Hence not
unusual that a test or two will fail until the kernel side (and stable
too) catches up.
--
Jens Axboe
^ permalink raw reply [flat|nested] 8+ messages in thread
* Re: [STABLE] stable backport request for 6.1 for io_uring
2023-09-03 13:25 ` Jens Axboe
@ 2023-09-03 13:50 ` Greg Kroah-Hartman
0 siblings, 0 replies; 8+ messages in thread
From: Greg Kroah-Hartman @ 2023-09-03 13:50 UTC (permalink / raw)
To: Jens Axboe
Cc: John David Anglin, Helge Deller, stable, Sasha Levin,
linux-parisc, Vidra.Jonas, Sam James
On Sun, Sep 03, 2023 at 07:25:11AM -0600, Jens Axboe wrote:
> On 9/2/23 11:32 PM, Greg Kroah-Hartman wrote:
> > On Sat, Sep 02, 2023 at 06:45:56PM -0600, Jens Axboe wrote:
> >> On 9/2/23 5:04 PM, John David Anglin wrote:
> >>> On 2023-08-30 12:17 p.m., Jens Axboe wrote:
> >>>> On 8/28/23 3:55 PM, Helge Deller wrote:
> >>>>> Hello Greg, Hello Jens, Hello stable team,
> >>>>>
> >>>>> would you please accept some backports to v6.1-stable for io_uring()?
> >>>>> io_uring() fails on parisc because of some missing upstream patches.
> >>>>> Since 6.1 is currently used in debian and gentoo as main kernel we
> >>>>> face some build errors due to the missing patches.
> >>>> Fine with me.
> >>> This is probably not a problem with the backport but I see this fail in liburing tests:
> >>>
> >>> Running test wq-aff.t open: No such file or directory
> >>> test sqpoll failed
> >>> Test wq-aff.t failed with ret 1
> >>> Running test xattr.t 0 sec [0]
> >>> Running test statx.t 0 sec [0]
> >>> Running test sq-full-cpp.t 0 sec [0]
> >>> Tests failed (1): <wq-aff.t>
> >>
> >> That's because 6.1-stable is missing:
> >>
> >> commit ebdfefc09c6de7897962769bd3e63a2ff443ebf5
> >> Author: Jens Axboe <axboe@kernel.dk>
> >> Date: Sun Aug 13 11:05:36 2023 -0600
> >>
> >> io_uring/sqpoll: fix io-wq affinity when IORING_SETUP_SQPOLL is used
> >>
> >> which went in recently and hasn't been backported to stable yet.
> >
> > We can add that now to the stable queues if you want, otherwise we are
> > supposed to wait until -rc1.
>
> It's fine to wait for -rc1, it's not an urgent fix by any stretch. I
> just always queue up test cases when a fix is headed upstream. Hence not
> unusual that a test or two will fail until the kernel side (and stable
> too) catches up.
Ok, thanks for the info, will wait on these until -rc1 is out.
greg k-h
^ permalink raw reply [flat|nested] 8+ messages in thread
end of thread, other threads:[~2023-09-03 13:50 UTC | newest]
Thread overview: 8+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2023-08-28 21:55 [STABLE] stable backport request for 6.1 for io_uring Helge Deller
2023-08-30 16:17 ` Jens Axboe
2023-08-31 10:50 ` Greg Kroah-Hartman
2023-09-02 23:04 ` John David Anglin
2023-09-03 0:45 ` Jens Axboe
2023-09-03 5:32 ` Greg Kroah-Hartman
2023-09-03 13:25 ` Jens Axboe
2023-09-03 13:50 ` Greg Kroah-Hartman
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox