lkml.org 
[lkml]   [2023]   [Sep]   [28]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
Date
From
SubjectRe: [RFC PATCH] srcu: Use try-lock lockdep annotation for NMI-safe access.
On Wed, Sep 27, 2023 at 11:06:09PM -0700, Boqun Feng wrote:

> diff --git a/kernel/locking/lockdep.c b/kernel/locking/lockdep.c
> index e85b5ad3e206..1af8d44e5eb4 100644
> --- a/kernel/locking/lockdep.c
> +++ b/kernel/locking/lockdep.c
> @@ -5727,8 +5727,9 @@ void lock_acquire(struct lockdep_map *lock, unsigned int subclass,
> return;
>
> if (unlikely(!lockdep_enabled())) {
> + /* Only do NMI context checking if it's a check lock */
> /* XXX allow trylock from NMI ?!? */
> - if (lockdep_nmi() && !trylock) {
> + if (check && lockdep_nmi() && !trylock) {
> struct held_lock hlock;
>
> hlock.acquire_ip = ip;
>
> Peter, thoughts?
>

I think I prefer the trylock one. Fundamentally trylock conveys the 'we
wont block' thing. Making 'lock' sometimes work for NMI is just
confusing.

\
 
 \ /
  Last update: 2023-09-28 10:07    [W:0.060 / U:0.660 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site