* [PATCH] xen/common: Constify the parameter of _spin_is_locked()
@ 2023-01-27 19:05 Julien Grall
2023-01-28 3:34 ` Henry Wang
2023-01-30 8:11 ` Jan Beulich
0 siblings, 2 replies; 4+ messages in thread
From: Julien Grall @ 2023-01-27 19:05 UTC (permalink / raw)
To: xen-devel
Cc: julien, Julien Grall, Andrew Cooper, George Dunlap, Jan Beulich,
Stefano Stabellini, Wei Liu
From: Julien Grall <jgrall@amazon.com>
The lock is not meant to be modified by _spin_is_locked(). So constify
it.
This is helpful to be able to assert the locked is taken when the
underlying structure is const.
Signed-off-by: Julien Grall <jgrall@amazon.com>
---
xen/common/spinlock.c | 2 +-
xen/include/xen/spinlock.h | 2 +-
2 files changed, 2 insertions(+), 2 deletions(-)
diff --git a/xen/common/spinlock.c b/xen/common/spinlock.c
index 84996c3fbc1f..a15f0a2eb667 100644
--- a/xen/common/spinlock.c
+++ b/xen/common/spinlock.c
@@ -368,7 +368,7 @@ void _spin_unlock_irqrestore(spinlock_t *lock, unsigned long flags)
local_irq_restore(flags);
}
-int _spin_is_locked(spinlock_t *lock)
+int _spin_is_locked(const spinlock_t *lock)
{
/*
* Recursive locks may be locked by another CPU, yet we return
diff --git a/xen/include/xen/spinlock.h b/xen/include/xen/spinlock.h
index 2fa6ba36548e..ca40c71c88f9 100644
--- a/xen/include/xen/spinlock.h
+++ b/xen/include/xen/spinlock.h
@@ -185,7 +185,7 @@ void _spin_unlock(spinlock_t *lock);
void _spin_unlock_irq(spinlock_t *lock);
void _spin_unlock_irqrestore(spinlock_t *lock, unsigned long flags);
-int _spin_is_locked(spinlock_t *lock);
+int _spin_is_locked(const spinlock_t *lock);
int _spin_trylock(spinlock_t *lock);
void _spin_barrier(spinlock_t *lock);
--
2.38.1
^ permalink raw reply related [flat|nested] 4+ messages in thread
* RE: [PATCH] xen/common: Constify the parameter of _spin_is_locked()
2023-01-27 19:05 [PATCH] xen/common: Constify the parameter of _spin_is_locked() Julien Grall
@ 2023-01-28 3:34 ` Henry Wang
2023-01-30 8:11 ` Jan Beulich
1 sibling, 0 replies; 4+ messages in thread
From: Henry Wang @ 2023-01-28 3:34 UTC (permalink / raw)
To: Julien Grall, xen-devel
Cc: Julien Grall, Andrew Cooper, George Dunlap, Jan Beulich,
Stefano Stabellini, Wei Liu
Hi Julien,
> -----Original Message-----
> Subject: [PATCH] xen/common: Constify the parameter of _spin_is_locked()
>
> From: Julien Grall <jgrall@amazon.com>
>
> The lock is not meant to be modified by _spin_is_locked(). So constify
> it.
>
> This is helpful to be able to assert the locked is taken when the
Nit: s/locked/lock/
This definitely can be fixed on commit.
> underlying structure is const.
>
> Signed-off-by: Julien Grall <jgrall@amazon.com>
I tried to test this patch on FVP (both Arm32 and Arm64) to play safe.
This patch is good (as expected of course :)), so:
Reviewed-by: Henry Wang <Henry.Wang@arm.com>
Tested-by: Henry Wang <Henry.Wang@arm.com> #Arm
Kind regards,
Henry
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: [PATCH] xen/common: Constify the parameter of _spin_is_locked()
2023-01-27 19:05 [PATCH] xen/common: Constify the parameter of _spin_is_locked() Julien Grall
2023-01-28 3:34 ` Henry Wang
@ 2023-01-30 8:11 ` Jan Beulich
2023-01-30 10:04 ` Julien Grall
1 sibling, 1 reply; 4+ messages in thread
From: Jan Beulich @ 2023-01-30 8:11 UTC (permalink / raw)
To: Julien Grall
Cc: Julien Grall, Andrew Cooper, George Dunlap, Stefano Stabellini,
Wei Liu, xen-devel
On 27.01.2023 20:05, Julien Grall wrote:
> From: Julien Grall <jgrall@amazon.com>
>
> The lock is not meant to be modified by _spin_is_locked(). So constify
> it.
>
> This is helpful to be able to assert the locked is taken when the
> underlying structure is const.
>
> Signed-off-by: Julien Grall <jgrall@amazon.com>
Reviewed-by: Jan Beulich <jbeulich@suse.com>
But: Could I talk you into doing the same for _rw_is{,_write}_locked() for
consistency?
Jan
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: [PATCH] xen/common: Constify the parameter of _spin_is_locked()
2023-01-30 8:11 ` Jan Beulich
@ 2023-01-30 10:04 ` Julien Grall
0 siblings, 0 replies; 4+ messages in thread
From: Julien Grall @ 2023-01-30 10:04 UTC (permalink / raw)
To: Jan Beulich
Cc: Julien Grall, Andrew Cooper, George Dunlap, Stefano Stabellini,
Wei Liu, xen-devel
On 30/01/2023 08:11, Jan Beulich wrote:
> On 27.01.2023 20:05, Julien Grall wrote:
>> From: Julien Grall <jgrall@amazon.com>
>>
>> The lock is not meant to be modified by _spin_is_locked(). So constify
>> it.
>>
>> This is helpful to be able to assert the locked is taken when the
>> underlying structure is const.
>>
>> Signed-off-by: Julien Grall <jgrall@amazon.com>
>
> Reviewed-by: Jan Beulich <jbeulich@suse.com>
>
> But: Could I talk you into doing the same for _rw_is{,_write}_locked() for
> consistency?
Sure. Although, I would prefer to do it in a separate patch.
Cheers,
--
Julien Grall
^ permalink raw reply [flat|nested] 4+ messages in thread
end of thread, other threads:[~2023-01-30 10:04 UTC | newest]
Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2023-01-27 19:05 [PATCH] xen/common: Constify the parameter of _spin_is_locked() Julien Grall
2023-01-28 3:34 ` Henry Wang
2023-01-30 8:11 ` Jan Beulich
2023-01-30 10:04 ` Julien Grall
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.