* [PATCH] parisc: Fix mask used to select futex spinlock
@ 2021-12-21 18:33 John David Anglin
2021-12-21 18:45 ` Rolf Eike Beer
0 siblings, 1 reply; 4+ messages in thread
From: John David Anglin @ 2021-12-21 18:33 UTC (permalink / raw)
To: linux-parisc; +Cc: Helge Deller, Deller, James Bottomley
Fix mask used to select futex spinlock.
The address bits used to select the futex spinlock need to match those used in the LWS code in
syscall.S. The mask 0x3f8 only selects 7 bits. It should select 8 bits.
This change fixes the glibc nptl/tst-cond24 and nptl/tst-cond25 tests.
Signed-off-by: John David Anglin <dave.anglin@bell.net>
---
diff --git a/arch/parisc/include/asm/futex.h b/arch/parisc/include/asm/futex.h
index 70cf8f0a7617..9cd4dd6e63ad 100644
--- a/arch/parisc/include/asm/futex.h
+++ b/arch/parisc/include/asm/futex.h
@@ -14,7 +14,7 @@ static inline void
_futex_spin_lock(u32 __user *uaddr)
{
extern u32 lws_lock_start[];
- long index = ((long)uaddr & 0x3f8) >> 1;
+ long index = ((long)uaddr & 0x7f8) >> 1;
arch_spinlock_t *s = (arch_spinlock_t *)&lws_lock_start[index];
preempt_disable();
arch_spin_lock(s);
@@ -24,7 +24,7 @@ static inline void
_futex_spin_unlock(u32 __user *uaddr)
{
extern u32 lws_lock_start[];
- long index = ((long)uaddr & 0x3f8) >> 1;
+ long index = ((long)uaddr & 0x7f8) >> 1;
arch_spinlock_t *s = (arch_spinlock_t *)&lws_lock_start[index];
arch_spin_unlock(s);
preempt_enable();
^ permalink raw reply related [flat|nested] 4+ messages in thread* Re: [PATCH] parisc: Fix mask used to select futex spinlock
2021-12-21 18:33 [PATCH] parisc: Fix mask used to select futex spinlock John David Anglin
@ 2021-12-21 18:45 ` Rolf Eike Beer
2021-12-21 19:27 ` John David Anglin
0 siblings, 1 reply; 4+ messages in thread
From: Rolf Eike Beer @ 2021-12-21 18:45 UTC (permalink / raw)
To: linux-parisc, John David Anglin; +Cc: Helge Deller, Deller, James Bottomley
[-- Attachment #1: Type: text/plain, Size: 509 bytes --]
Am Dienstag, 21. Dezember 2021, 19:33:16 CET schrieb John David Anglin:
> Fix mask used to select futex spinlock.
>
> The address bits used to select the futex spinlock need to match those used
> in the LWS code in syscall.S. The mask 0x3f8 only selects 7 bits. It
> should select 8 bits.
This change looks like this should become a helper macro or something like
that so the code will stay in sync. Can the mask be shared with the LWS code
with a constant while at it so it will also include that?
Eike
[-- Attachment #2: This is a digitally signed message part. --]
[-- Type: application/pgp-signature, Size: 195 bytes --]
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: [PATCH] parisc: Fix mask used to select futex spinlock
2021-12-21 18:45 ` Rolf Eike Beer
@ 2021-12-21 19:27 ` John David Anglin
2021-12-21 19:33 ` Helge Deller
0 siblings, 1 reply; 4+ messages in thread
From: John David Anglin @ 2021-12-21 19:27 UTC (permalink / raw)
To: Rolf Eike Beer, linux-parisc; +Cc: Helge Deller, Deller, James Bottomley
On 2021-12-21 1:45 p.m., Rolf Eike Beer wrote:
> Am Dienstag, 21. Dezember 2021, 19:33:16 CET schrieb John David Anglin:
>> Fix mask used to select futex spinlock.
>>
>> The address bits used to select the futex spinlock need to match those used
>> in the LWS code in syscall.S. The mask 0x3f8 only selects 7 bits. It
>> should select 8 bits.
> This change looks like this should become a helper macro or something like
> that so the code will stay in sync. Can the mask be shared with the LWS code
> with a constant while at it so it will also include that?
I understand the point but it's rather convoluted. We would need a macro for the assembly
code. Then the macro would need to be embedded in an asm for C. Then, there's the shift
for the int* type in the C code.
I am proposing to rewrite this code so the spinlock pointer is only computed once, but Helge
wanted a change that could be easily back ported.
Dave
--
John David Anglin dave.anglin@bell.net
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: [PATCH] parisc: Fix mask used to select futex spinlock
2021-12-21 19:27 ` John David Anglin
@ 2021-12-21 19:33 ` Helge Deller
0 siblings, 0 replies; 4+ messages in thread
From: Helge Deller @ 2021-12-21 19:33 UTC (permalink / raw)
To: John David Anglin, Rolf Eike Beer, linux-parisc; +Cc: Deller, James Bottomley
On 12/21/21 20:27, John David Anglin wrote:
> On 2021-12-21 1:45 p.m., Rolf Eike Beer wrote:
>> Am Dienstag, 21. Dezember 2021, 19:33:16 CET schrieb John David Anglin:
>>> Fix mask used to select futex spinlock.
>>>
>>> The address bits used to select the futex spinlock need to match those used
>>> in the LWS code in syscall.S. The mask 0x3f8 only selects 7 bits. It
>>> should select 8 bits.
>> This change looks like this should become a helper macro or something like
>> that so the code will stay in sync. Can the mask be shared with the LWS code
>> with a constant while at it so it will also include that?
> I understand the point but it's rather convoluted. We would need a macro for the assembly
> code. Then the macro would need to be embedded in an asm for C. Then, there's the shift
> for the int* type in the C code.
>
> I am proposing to rewrite this code so the spinlock pointer is only computed once, but Helge
> wanted a change that could be easily back ported.
Right.
I think this is a small but important fix, which I can easily push back into older kernels.
See Dave's other patch ("[PATCH v1] parisc: Rewrite light-weight syscall and futex code").
There he rewrote the code anyway.
Helge
^ permalink raw reply [flat|nested] 4+ messages in thread
end of thread, other threads:[~2021-12-21 19:34 UTC | newest]
Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2021-12-21 18:33 [PATCH] parisc: Fix mask used to select futex spinlock John David Anglin
2021-12-21 18:45 ` Rolf Eike Beer
2021-12-21 19:27 ` John David Anglin
2021-12-21 19:33 ` Helge Deller
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox