Skip to content

Commit 7cb1b46

Browse files
committed
Merge tag 'locking_urgent_for_v6.13_rc3' of git://git.kernel.org/pub/scm/linux/kernel/git/tip/tip
Pull locking fixes from Borislav Petkov: - Remove if_not_guard() as it is generating incorrect code - Fix the initialization of the fake lockdep_map for the first locked ww_mutex * tag 'locking_urgent_for_v6.13_rc3' of git://git.kernel.org/pub/scm/linux/kernel/git/tip/tip: headers/cleanup.h: Remove the if_not_guard() facility locking/ww_mutex: Fix ww_mutex dummy lockdep map selftest warnings
2 parents e4c995f + b4d83c8 commit 7cb1b46

File tree

3 files changed

+4
-18
lines changed

3 files changed

+4
-18
lines changed

include/linux/cleanup.h

Lines changed: 0 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -273,12 +273,6 @@ static inline class_##_name##_t class_##_name##ext##_constructor(_init_args) \
273273
* an anonymous instance of the (guard) class, not recommended for
274274
* conditional locks.
275275
*
276-
* if_not_guard(name, args...) { <error handling> }:
277-
* convenience macro for conditional guards that calls the statement that
278-
* follows only if the lock was not acquired (typically an error return).
279-
*
280-
* Only for conditional locks.
281-
*
282276
* scoped_guard (name, args...) { }:
283277
* similar to CLASS(name, scope)(args), except the variable (with the
284278
* explicit name 'scope') is declard in a for-loop such that its scope is
@@ -350,14 +344,6 @@ _label: \
350344
#define scoped_cond_guard(_name, _fail, args...) \
351345
__scoped_cond_guard(_name, _fail, __UNIQUE_ID(label), args)
352346

353-
#define __if_not_guard(_name, _id, args...) \
354-
BUILD_BUG_ON(!__is_cond_ptr(_name)); \
355-
CLASS(_name, _id)(args); \
356-
if (!__guard_ptr(_name)(&_id))
357-
358-
#define if_not_guard(_name, args...) \
359-
__if_not_guard(_name, __UNIQUE_ID(guard), args)
360-
361347
/*
362348
* Additional helper macros for generating lock guards with types, either for
363349
* locks that don't have a native type (eg. RCU, preempt) or those that need a

include/linux/ww_mutex.h

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -156,8 +156,8 @@ static inline void ww_acquire_init(struct ww_acquire_ctx *ctx,
156156
debug_check_no_locks_freed((void *)ctx, sizeof(*ctx));
157157
lockdep_init_map(&ctx->dep_map, ww_class->acquire_name,
158158
&ww_class->acquire_key, 0);
159-
lockdep_init_map(&ctx->first_lock_dep_map, ww_class->mutex_name,
160-
&ww_class->mutex_key, 0);
159+
lockdep_init_map_wait(&ctx->first_lock_dep_map, ww_class->mutex_name,
160+
&ww_class->mutex_key, 0, LD_WAIT_SLEEP);
161161
mutex_acquire(&ctx->dep_map, 0, 0, _RET_IP_);
162162
mutex_acquire_nest(&ctx->first_lock_dep_map, 0, 0, &ctx->dep_map, _RET_IP_);
163163
#endif

lib/locking-selftest.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1720,8 +1720,6 @@ static void ww_test_normal(void)
17201720
{
17211721
int ret;
17221722

1723-
WWAI(&t);
1724-
17251723
/*
17261724
* None of the ww_mutex codepaths should be taken in the 'normal'
17271725
* mutex calls. The easiest way to verify this is by using the
@@ -1770,6 +1768,8 @@ static void ww_test_normal(void)
17701768
ww_mutex_base_unlock(&o.base);
17711769
WARN_ON(o.ctx != (void *)~0UL);
17721770

1771+
WWAI(&t);
1772+
17731773
/* nest_lock */
17741774
o.ctx = (void *)~0UL;
17751775
ww_mutex_base_lock_nest_lock(&o.base, &t);

0 commit comments

Comments
 (0)