Skip to content

Commit 8dcdfb7

Browse files
committed
Merge branches 'doc.2019.10.29a', 'fixes.2019.10.30a', 'nohz.2019.10.28a', 'replace.2019.10.30a', 'torture.2019.10.05a' and 'lkmm.2019.10.05a' into HEAD
doc.2019.10.29a: RCU documentation updates. fixes.2019.10.30a: RCU miscellaneous fixes. nohz.2019.10.28a: RCU NO_HZ and NO_HZ_FULL updates. replace.2019.10.30a: Replace rcu_swap_protected() with rcu_replace(). torture.2019.10.05a: RCU torture-test updates. lkmm.2019.10.05a: Linux kernel memory model updates.
6 parents b1ec18e + 36b5dae + dd7dafd + a60a574 + 67d6491 + c58a801 commit 8dcdfb7

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

50 files changed

+785
-207
lines changed

arch/x86/kvm/pmu.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -416,8 +416,8 @@ int kvm_vm_ioctl_set_pmu_event_filter(struct kvm *kvm, void __user *argp)
416416
*filter = tmp;
417417

418418
mutex_lock(&kvm->lock);
419-
rcu_swap_protected(kvm->arch.pmu_event_filter, filter,
420-
mutex_is_locked(&kvm->lock));
419+
filter = rcu_replace_pointer(kvm->arch.pmu_event_filter, filter,
420+
mutex_is_locked(&kvm->lock));
421421
mutex_unlock(&kvm->lock);
422422

423423
synchronize_srcu_expedited(&kvm->srcu);

drivers/gpu/drm/i915/gem/i915_gem_context.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1629,7 +1629,7 @@ set_engines(struct i915_gem_context *ctx,
16291629
i915_gem_context_set_user_engines(ctx);
16301630
else
16311631
i915_gem_context_clear_user_engines(ctx);
1632-
rcu_swap_protected(ctx->engines, set.engines, 1);
1632+
set.engines = rcu_replace_pointer(ctx->engines, set.engines, 1);
16331633
mutex_unlock(&ctx->engines_mutex);
16341634

16351635
call_rcu(&set.engines->rcu, free_engines_rcu);

drivers/scsi/scsi.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -434,8 +434,8 @@ static void scsi_update_vpd_page(struct scsi_device *sdev, u8 page,
434434
return;
435435

436436
mutex_lock(&sdev->inquiry_mutex);
437-
rcu_swap_protected(*sdev_vpd_buf, vpd_buf,
438-
lockdep_is_held(&sdev->inquiry_mutex));
437+
vpd_buf = rcu_replace_pointer(*sdev_vpd_buf, vpd_buf,
438+
lockdep_is_held(&sdev->inquiry_mutex));
439439
mutex_unlock(&sdev->inquiry_mutex);
440440

441441
if (vpd_buf)

drivers/scsi/scsi_sysfs.c

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -466,10 +466,10 @@ static void scsi_device_dev_release_usercontext(struct work_struct *work)
466466
sdev->request_queue = NULL;
467467

468468
mutex_lock(&sdev->inquiry_mutex);
469-
rcu_swap_protected(sdev->vpd_pg80, vpd_pg80,
470-
lockdep_is_held(&sdev->inquiry_mutex));
471-
rcu_swap_protected(sdev->vpd_pg83, vpd_pg83,
472-
lockdep_is_held(&sdev->inquiry_mutex));
469+
vpd_pg80 = rcu_replace_pointer(sdev->vpd_pg80, vpd_pg80,
470+
lockdep_is_held(&sdev->inquiry_mutex));
471+
vpd_pg83 = rcu_replace_pointer(sdev->vpd_pg83, vpd_pg83,
472+
lockdep_is_held(&sdev->inquiry_mutex));
473473
mutex_unlock(&sdev->inquiry_mutex);
474474

475475
if (vpd_pg83)

fs/afs/vl_list.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -279,8 +279,8 @@ struct afs_vlserver_list *afs_extract_vlserver_list(struct afs_cell *cell,
279279
struct afs_addr_list *old = addrs;
280280

281281
write_lock(&server->lock);
282-
rcu_swap_protected(server->addresses, old,
283-
lockdep_is_held(&server->lock));
282+
old = rcu_replace_pointer(server->addresses, old,
283+
lockdep_is_held(&server->lock));
284284
write_unlock(&server->lock);
285285
afs_put_addrlist(old);
286286
}

include/linux/rculist_bl.h

Lines changed: 0 additions & 28 deletions
Original file line numberDiff line numberDiff line change
@@ -24,34 +24,6 @@ static inline struct hlist_bl_node *hlist_bl_first_rcu(struct hlist_bl_head *h)
2424
((unsigned long)rcu_dereference_check(h->first, hlist_bl_is_locked(h)) & ~LIST_BL_LOCKMASK);
2525
}
2626

27-
/**
28-
* hlist_bl_del_init_rcu - deletes entry from hash list with re-initialization
29-
* @n: the element to delete from the hash list.
30-
*
31-
* Note: hlist_bl_unhashed() on the node returns true after this. It is
32-
* useful for RCU based read lockfree traversal if the writer side
33-
* must know if the list entry is still hashed or already unhashed.
34-
*
35-
* In particular, it means that we can not poison the forward pointers
36-
* that may still be used for walking the hash list and we can only
37-
* zero the pprev pointer so list_unhashed() will return true after
38-
* this.
39-
*
40-
* The caller must take whatever precautions are necessary (such as
41-
* holding appropriate locks) to avoid racing with another
42-
* list-mutation primitive, such as hlist_bl_add_head_rcu() or
43-
* hlist_bl_del_rcu(), running on this same list. However, it is
44-
* perfectly legal to run concurrently with the _rcu list-traversal
45-
* primitives, such as hlist_bl_for_each_entry_rcu().
46-
*/
47-
static inline void hlist_bl_del_init_rcu(struct hlist_bl_node *n)
48-
{
49-
if (!hlist_bl_unhashed(n)) {
50-
__hlist_bl_del(n);
51-
n->pprev = NULL;
52-
}
53-
}
54-
5527
/**
5628
* hlist_bl_del_rcu - deletes entry from hash list without re-initialization
5729
* @n: the element to delete from the hash list.

include/linux/rcupdate.h

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -382,6 +382,24 @@ do { \
382382
smp_store_release(&p, RCU_INITIALIZER((typeof(p))_r_a_p__v)); \
383383
} while (0)
384384

385+
/**
386+
* rcu_replace_pointer() - replace an RCU pointer, returning its old value
387+
* @rcu_ptr: RCU pointer, whose old value is returned
388+
* @ptr: regular pointer
389+
* @c: the lockdep conditions under which the dereference will take place
390+
*
391+
* Perform a replacement, where @rcu_ptr is an RCU-annotated
392+
* pointer and @c is the lockdep argument that is passed to the
393+
* rcu_dereference_protected() call used to read that pointer. The old
394+
* value of @rcu_ptr is returned, and @rcu_ptr is set to @ptr.
395+
*/
396+
#define rcu_replace_pointer(rcu_ptr, ptr, c) \
397+
({ \
398+
typeof(ptr) __tmp = rcu_dereference_protected((rcu_ptr), (c)); \
399+
rcu_assign_pointer((rcu_ptr), (ptr)); \
400+
__tmp; \
401+
})
402+
385403
/**
386404
* rcu_swap_protected() - swap an RCU and a regular pointer
387405
* @rcu_ptr: RCU pointer

include/linux/rcutiny.h

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -84,6 +84,7 @@ static inline void rcu_scheduler_starting(void) { }
8484
#endif /* #else #ifndef CONFIG_SRCU */
8585
static inline void rcu_end_inkernel_boot(void) { }
8686
static inline bool rcu_is_watching(void) { return true; }
87+
static inline void rcu_momentary_dyntick_idle(void) { }
8788

8889
/* Avoid RCU read-side critical sections leaking across. */
8990
static inline void rcu_all_qs(void) { barrier(); }

include/linux/rcutree.h

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -37,6 +37,7 @@ void kfree_call_rcu(struct rcu_head *head, rcu_callback_t func);
3737

3838
void rcu_barrier(void);
3939
bool rcu_eqs_special_set(int cpu);
40+
void rcu_momentary_dyntick_idle(void);
4041
unsigned long get_state_synchronize_rcu(void);
4142
void cond_synchronize_rcu(unsigned long oldstate);
4243

include/linux/tick.h

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -108,14 +108,16 @@ enum tick_dep_bits {
108108
TICK_DEP_BIT_POSIX_TIMER = 0,
109109
TICK_DEP_BIT_PERF_EVENTS = 1,
110110
TICK_DEP_BIT_SCHED = 2,
111-
TICK_DEP_BIT_CLOCK_UNSTABLE = 3
111+
TICK_DEP_BIT_CLOCK_UNSTABLE = 3,
112+
TICK_DEP_BIT_RCU = 4
112113
};
113114

114115
#define TICK_DEP_MASK_NONE 0
115116
#define TICK_DEP_MASK_POSIX_TIMER (1 << TICK_DEP_BIT_POSIX_TIMER)
116117
#define TICK_DEP_MASK_PERF_EVENTS (1 << TICK_DEP_BIT_PERF_EVENTS)
117118
#define TICK_DEP_MASK_SCHED (1 << TICK_DEP_BIT_SCHED)
118119
#define TICK_DEP_MASK_CLOCK_UNSTABLE (1 << TICK_DEP_BIT_CLOCK_UNSTABLE)
120+
#define TICK_DEP_MASK_RCU (1 << TICK_DEP_BIT_RCU)
119121

120122
#ifdef CONFIG_NO_HZ_COMMON
121123
extern bool tick_nohz_enabled;
@@ -268,6 +270,9 @@ static inline bool tick_nohz_full_enabled(void) { return false; }
268270
static inline bool tick_nohz_full_cpu(int cpu) { return false; }
269271
static inline void tick_nohz_full_add_cpus_to(struct cpumask *mask) { }
270272

273+
static inline void tick_nohz_dep_set_cpu(int cpu, enum tick_dep_bits bit) { }
274+
static inline void tick_nohz_dep_clear_cpu(int cpu, enum tick_dep_bits bit) { }
275+
271276
static inline void tick_dep_set(enum tick_dep_bits bit) { }
272277
static inline void tick_dep_clear(enum tick_dep_bits bit) { }
273278
static inline void tick_dep_set_cpu(int cpu, enum tick_dep_bits bit) { }

0 commit comments

Comments
 (0)