From: "André Almeida" <andrealmeid@igalia.com>
To: Arnd Bergmann <arnd@arndb.de>
Cc: Thomas Gleixner <tglx@linutronix.de>,
Ingo Molnar <mingo@redhat.com>,
Davidlohr Bueso <dave@stgolabs.net>,
Darren Hart <dvhart@infradead.org>,
Peter Zijlstra <peterz@infradead.org>,
sonicadvance1@gmail.com, linux-kernel@vger.kernel.org,
kernel-dev@igalia.com, linux-api@vger.kernel.org
Subject: Re: [PATCH RFC 1/1] futex: Create set_robust_list2
Date: Thu, 24 Oct 2024 15:03:12 -0300 [thread overview]
Message-ID: <1e62e083-f97c-4157-8d50-c3655edda97b@igalia.com> (raw)
In-Reply-To: <bde852ec-8e2f-4957-9368-00d8e5a422c4@app.fastmail.com>
Hi Arnd,
Em 24/10/2024 12:57, Arnd Bergmann escreveu:
> On Thu, Oct 24, 2024, at 14:57, André Almeida wrote:
>> This new syscall allows to set multiple list to the same process. There
>> are two list types: 32 and 64 bit lists.
>>
>> It supports up to 10 lists per process (see ROBUST_LISTS_PER_TASK). The
>> lists are dynamically allocated on demand, as part of a linked list.
>> This is the proposed interface:
>>
>> long set_robust_list2(void *head, int index, unsigned int flags)
>>
>> Userspace can ask to set the head of a new list using (index = -1).
>> Kernel will allocate a new list, place in the linked list and return the
>> new index to userspace.
>>
>> Userspace can modify an existing head by using an index >= 0. If the
>> requested list doesn't exist, an error is returned.
>>
>> Userspace cannot remove a robust list.
>>
>> For now, flag is for the list type:
>>
>> enum robust_list_type {
>> ROBUST_LIST_32BIT,
>> ROBUST_LIST_64BIT,
>> };
>>
>> Signed-off-by: André Almeida <andrealmeid@igalia.com>
>
> Hi André,
>
> I have no opinion on the syscall itself, but I'll comment on
> the way you hook it up:
>
>> arch/arm/tools/syscall.tbl | 1 +
>> arch/x86/entry/syscalls/syscall_64.tbl | 1 +
>
> If we agree on the number, this should be added to all
> architectures at the same time. In particular, when
> you add it to 32-bit arm, it also needs to be in the
> corresponding arch/arm64/tools/syscall_32.tbl for
> compat mode.
Ok
>
>> include/uapi/asm-generic/unistd.h | 5 +-
>
> This reminds me that I need to send the patch to remove this
> file, nothing should use it any more, though we still have
> the copy in tools/include/uapi/asm-generic/unistd.h that
> still gets referenced until the scripts are changed to
> use the syscall.tbl format.
>
>> + if (unlikely(!list_empty(list2))) {
>> + list_for_each_entry_safe(curr, n, list2, list) {
>> + if (curr->head != NULL) {
>> + if (curr->list_type == ROBUST_LIST_64BIT)
>> + exit_robust_list(tsk, curr->head);
>> + else if (curr->list_type == ROBUST_LIST_32BIT)
>> + compat_exit_robust_list(tsk, curr->head);
>> + curr->head = NULL;
>> + }
>
> This looks like the behavior of a 32-bit task using
> ROBUST_LIST_64BIT is different on native 32-bit kernels
> compared to running on compat mode.
>
> Assuming we want them to behave the same way, did you intend
> ROBUST_LIST_64BIT to refer to 64-bit pointers on 32-bit
> tasks, or should they use normal word-size pointers?
Oh right, I haven't covered that indeed. I think I would need to have
something like:
static void exit_robust_list_64()
static void exit_robust_list_32()
And then each function would use explicit sizes for pointers. Also, I
would rewrite the conditions to make that every combination of 64/32bit
kernel/app calls the appropriated function.
Alternatively, we could just disable 32bit kernel/app to use the
ROBUST_LIST_64BIT option.
Thank you for your feedback!
André
next prev parent reply other threads:[~2024-10-24 18:03 UTC|newest]
Thread overview: 7+ messages / expand[flat|nested] mbox.gz Atom feed top
2024-10-24 14:57 [PATCH RFC 0/1] futex: Add a new robust list syscall André Almeida
2024-10-24 14:57 ` [PATCH RFC 1/1] futex: Create set_robust_list2 André Almeida
2024-10-24 15:57 ` Arnd Bergmann
2024-10-24 18:03 ` André Almeida [this message]
2024-10-24 18:08 ` Randy Dunlap
2024-10-24 19:55 ` André Almeida
2024-10-25 6:33 ` Arnd Bergmann
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=1e62e083-f97c-4157-8d50-c3655edda97b@igalia.com \
--to=andrealmeid@igalia.com \
--cc=arnd@arndb.de \
--cc=dave@stgolabs.net \
--cc=dvhart@infradead.org \
--cc=kernel-dev@igalia.com \
--cc=linux-api@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=mingo@redhat.com \
--cc=peterz@infradead.org \
--cc=sonicadvance1@gmail.com \
--cc=tglx@linutronix.de \
/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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox
all inboxes | Powered by JetHome®