Pull locking fixes from Ingo Molnar: "Two lockless_dereference() related fixes" * 'locking-urgent-for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/tip/tip: locking/barriers: Suppress sparse warnings in lockless_dereference() Revert "drm/fb-helper: Reduce READ_ONCE(master) to lockless_dereference"
Unified · Split
| @@ -464,7 +464,7 @@ static bool drm_fb_helper_is_bound(struct drm_fb_helper *fb_helper) · 463 unmodified lines | ||
| 464 | 464 | |
| 465 | 465 | /* Sometimes user space wants everything disabled, so don't steal the |
| 466 | 466 | * display if there's a master. */ |
| 467 | − if (lockless_dereference(dev->master)) | |
| 467 | + if (READ_ONCE(dev->master)) | |
| 468 | 468 | return false; |
| 469 | 469 | |
| 470 | 470 | drm_for_each_crtc(crtc, dev) { |
| @@ -527,13 +527,13 @@ static __always_inline void __write_once_size(volatile void *p, void *res, int s · 526 unmodified lines | ||
| 527 | 527 | * object's lifetime is managed by something other than RCU. That |
| 528 | 528 | * "something other" might be reference counting or simple immortality. |
| 529 | 529 | * |
| 530 | − * The seemingly unused void * variable is to validate @p is indeed a pointer | |
| 531 | − * type. All pointer types silently cast to void *. | |
| 530 | + * The seemingly unused size_t variable is to validate @p is indeed a pointer | |
| 531 | + * type by making sure it can be dereferenced. | |
| 532 | 532 | */ |
| 533 | 533 | #define lockless_dereference(p) \ |
| 534 | 534 | ({ \ |
| 535 | 535 | typeof(p) _________p1 = READ_ONCE(p); \ |
| 536 | − __maybe_unused const void * const _________p2 = _________p1; \ | |
| 536 | + size_t __maybe_unused __size_of_ptr = sizeof(*(p)); \ | |
| 537 | 537 | smp_read_barrier_depends(); /* Dependency order vs. p above. */ \ |
| 538 | 538 | (_________p1); \ |
| 539 | 539 | }) |