Commit bd3fd451 authored by Linus Torvalds's avatar Linus Torvalds

Merge branch 'locking-urgent-for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/tip/tip

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"
parents f28535c1 112dc0c8
...@@ -464,7 +464,7 @@ static bool drm_fb_helper_is_bound(struct drm_fb_helper *fb_helper) ...@@ -464,7 +464,7 @@ static bool drm_fb_helper_is_bound(struct drm_fb_helper *fb_helper)
/* Sometimes user space wants everything disabled, so don't steal the /* Sometimes user space wants everything disabled, so don't steal the
* display if there's a master. */ * display if there's a master. */
if (lockless_dereference(dev->master)) if (READ_ONCE(dev->master))
return false; return false;
drm_for_each_crtc(crtc, dev) { drm_for_each_crtc(crtc, dev) {
......
...@@ -527,13 +527,13 @@ static __always_inline void __write_once_size(volatile void *p, void *res, int s ...@@ -527,13 +527,13 @@ static __always_inline void __write_once_size(volatile void *p, void *res, int s
* object's lifetime is managed by something other than RCU. That * object's lifetime is managed by something other than RCU. That
* "something other" might be reference counting or simple immortality. * "something other" might be reference counting or simple immortality.
* *
* The seemingly unused void * variable is to validate @p is indeed a pointer * The seemingly unused size_t variable is to validate @p is indeed a pointer
* type. All pointer types silently cast to void *. * type by making sure it can be dereferenced.
*/ */
#define lockless_dereference(p) \ #define lockless_dereference(p) \
({ \ ({ \
typeof(p) _________p1 = READ_ONCE(p); \ typeof(p) _________p1 = READ_ONCE(p); \
__maybe_unused const void * const _________p2 = _________p1; \ size_t __maybe_unused __size_of_ptr = sizeof(*(p)); \
smp_read_barrier_depends(); /* Dependency order vs. p above. */ \ smp_read_barrier_depends(); /* Dependency order vs. p above. */ \
(_________p1); \ (_________p1); \
}) })
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment