[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <59509fc9-1a19-4162-ac89-559e08b75c06@igalia.com>
Date: Thu, 24 Oct 2024 16:55:03 -0300
From: André Almeida <andrealmeid@...lia.com>
To: Arnd Bergmann <arnd@...db.de>
Cc: Thomas Gleixner <tglx@...utronix.de>, Ingo Molnar <mingo@...hat.com>,
Davidlohr Bueso <dave@...olabs.net>, Darren Hart <dvhart@...radead.org>,
Peter Zijlstra <peterz@...radead.org>, sonicadvance1@...il.com,
linux-kernel@...r.kernel.org, kernel-dev@...lia.com,
linux-api@...r.kernel.org
Subject: Re: [PATCH RFC 1/1] futex: Create set_robust_list2
Em 24/10/2024 15:03, André Almeida escreveu:
> 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.
>>>
[...]
>>> + 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.
Something like this:
#ifdef CONFIG_64BIT
if (unlikely(tsk->robust_list)) {
exit_robust_list_64bit(tsk, tsk->robust_list);
tsk->robust_list = NULL;
}
#else
if (unlikely(tsk->robust_list)) {
exit_robust_list_32bit(tsk, tsk->robust_list);
tsk->robust_list = NULL;
}
#endif
#ifdef CONFIG_COMPAT
if (unlikely(tsk->compat_robust_list)) {
exit_robust_32bit(tsk, tsk->compat_robust_list);
tsk->compat_robust_list = NULL;
}
#endif
/* Simplified */
list_for_each_entry_safe(curr, n, list2, list) {
if (curr->list_type == ROBUST_LIST_64BIT)
exit_robust_list_64bit(tsk, curr->head);
else if (curr->list_type == ROBUST_LIST_32BIT)
exit_robust_list_32bit(tsk, curr->head);
}
Powered by blists - more mailing lists