Skip to content

Commit

Permalink
arch: Mass conversion of smp_mb__*()
Browse files Browse the repository at this point in the history
Mostly scripted conversion of the smp_mb__* barriers.

Signed-off-by: Peter Zijlstra <[email protected]>
Acked-by: Paul E. McKenney <[email protected]>
Link: http://lkml.kernel.org/n/[email protected]
Cc: Linus Torvalds <[email protected]>
Cc: [email protected]
Signed-off-by: Ingo Molnar <[email protected]>
  • Loading branch information
Peter Zijlstra authored and Ingo Molnar committed Apr 18, 2014
1 parent 1b15611 commit 4e857c5
Show file tree
Hide file tree
Showing 106 changed files with 284 additions and 288 deletions.
4 changes: 2 additions & 2 deletions block/blk-iopoll.c
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,7 @@ EXPORT_SYMBOL(blk_iopoll_sched);
void __blk_iopoll_complete(struct blk_iopoll *iop)
{
list_del(&iop->list);
smp_mb__before_clear_bit();
smp_mb__before_atomic();
clear_bit_unlock(IOPOLL_F_SCHED, &iop->state);
}
EXPORT_SYMBOL(__blk_iopoll_complete);
Expand Down Expand Up @@ -161,7 +161,7 @@ EXPORT_SYMBOL(blk_iopoll_disable);
void blk_iopoll_enable(struct blk_iopoll *iop)
{
BUG_ON(!test_bit(IOPOLL_F_SCHED, &iop->state));
smp_mb__before_clear_bit();
smp_mb__before_atomic();
clear_bit_unlock(IOPOLL_F_SCHED, &iop->state);
}
EXPORT_SYMBOL(blk_iopoll_enable);
Expand Down
2 changes: 1 addition & 1 deletion crypto/chainiv.c
Original file line number Diff line number Diff line change
Expand Up @@ -126,7 +126,7 @@ static int async_chainiv_schedule_work(struct async_chainiv_ctx *ctx)
int err = ctx->err;

if (!ctx->queue.qlen) {
smp_mb__before_clear_bit();
smp_mb__before_atomic();
clear_bit(CHAINIV_STATE_INUSE, &ctx->state);

if (!ctx->queue.qlen ||
Expand Down
2 changes: 1 addition & 1 deletion drivers/base/power/domain.c
Original file line number Diff line number Diff line change
Expand Up @@ -105,7 +105,7 @@ static bool genpd_sd_counter_dec(struct generic_pm_domain *genpd)
static void genpd_sd_counter_inc(struct generic_pm_domain *genpd)
{
atomic_inc(&genpd->sd_count);
smp_mb__after_atomic_inc();
smp_mb__after_atomic();
}

static void genpd_acquire_lock(struct generic_pm_domain *genpd)
Expand Down
4 changes: 2 additions & 2 deletions drivers/block/mtip32xx/mtip32xx.c
Original file line number Diff line number Diff line change
Expand Up @@ -224,9 +224,9 @@ static int get_slot(struct mtip_port *port)
*/
static inline void release_slot(struct mtip_port *port, int tag)
{
smp_mb__before_clear_bit();
smp_mb__before_atomic();
clear_bit(tag, port->allocated);
smp_mb__after_clear_bit();
smp_mb__after_atomic();
}

/*
Expand Down
2 changes: 1 addition & 1 deletion drivers/cpuidle/coupled.c
Original file line number Diff line number Diff line change
Expand Up @@ -159,7 +159,7 @@ void cpuidle_coupled_parallel_barrier(struct cpuidle_device *dev, atomic_t *a)
{
int n = dev->coupled->online_count;

smp_mb__before_atomic_inc();
smp_mb__before_atomic();
atomic_inc(a);

while (atomic_read(a) < n)
Expand Down
2 changes: 1 addition & 1 deletion drivers/firewire/ohci.c
Original file line number Diff line number Diff line change
Expand Up @@ -3498,7 +3498,7 @@ static int ohci_flush_iso_completions(struct fw_iso_context *base)
}

clear_bit_unlock(0, &ctx->flushing_completions);
smp_mb__after_clear_bit();
smp_mb__after_atomic();
}

tasklet_enable(&ctx->context.tasklet);
Expand Down
10 changes: 5 additions & 5 deletions drivers/gpu/drm/drm_irq.c
Original file line number Diff line number Diff line change
Expand Up @@ -156,7 +156,7 @@ static void vblank_disable_and_save(struct drm_device *dev, int crtc)
*/
if ((vblrc > 0) && (abs64(diff_ns) > 1000000)) {
atomic_inc(&dev->vblank[crtc].count);
smp_mb__after_atomic_inc();
smp_mb__after_atomic();
}

/* Invalidate all timestamps while vblank irq's are off. */
Expand Down Expand Up @@ -864,9 +864,9 @@ static void drm_update_vblank_count(struct drm_device *dev, int crtc)
vblanktimestamp(dev, crtc, tslot) = t_vblank;
}

smp_mb__before_atomic_inc();
smp_mb__before_atomic();
atomic_add(diff, &dev->vblank[crtc].count);
smp_mb__after_atomic_inc();
smp_mb__after_atomic();
}

/**
Expand Down Expand Up @@ -1330,9 +1330,9 @@ bool drm_handle_vblank(struct drm_device *dev, int crtc)
/* Increment cooked vblank count. This also atomically commits
* the timestamp computed above.
*/
smp_mb__before_atomic_inc();
smp_mb__before_atomic();
atomic_inc(&dev->vblank[crtc].count);
smp_mb__after_atomic_inc();
smp_mb__after_atomic();
} else {
DRM_DEBUG("crtc %d: Redundant vblirq ignored. diff_ns = %d\n",
crtc, (int) diff_ns);
Expand Down
2 changes: 1 addition & 1 deletion drivers/gpu/drm/i915/i915_irq.c
Original file line number Diff line number Diff line change
Expand Up @@ -2147,7 +2147,7 @@ static void i915_error_work_func(struct work_struct *work)
* updates before
* the counter increment.
*/
smp_mb__before_atomic_inc();
smp_mb__before_atomic();
atomic_inc(&dev_priv->gpu_error.reset_counter);

kobject_uevent_env(&dev->primary->kdev->kobj,
Expand Down
2 changes: 1 addition & 1 deletion drivers/md/bcache/bcache.h
Original file line number Diff line number Diff line change
Expand Up @@ -828,7 +828,7 @@ static inline bool cached_dev_get(struct cached_dev *dc)
return false;

/* Paired with the mb in cached_dev_attach */
smp_mb__after_atomic_inc();
smp_mb__after_atomic();
return true;
}

Expand Down
2 changes: 1 addition & 1 deletion drivers/md/bcache/closure.h
Original file line number Diff line number Diff line change
Expand Up @@ -243,7 +243,7 @@ static inline void set_closure_fn(struct closure *cl, closure_fn *fn,
cl->fn = fn;
cl->wq = wq;
/* between atomic_dec() in closure_put() */
smp_mb__before_atomic_dec();
smp_mb__before_atomic();
}

static inline void closure_queue(struct closure *cl)
Expand Down
8 changes: 4 additions & 4 deletions drivers/md/dm-bufio.c
Original file line number Diff line number Diff line change
Expand Up @@ -607,9 +607,9 @@ static void write_endio(struct bio *bio, int error)

BUG_ON(!test_bit(B_WRITING, &b->state));

smp_mb__before_clear_bit();
smp_mb__before_atomic();
clear_bit(B_WRITING, &b->state);
smp_mb__after_clear_bit();
smp_mb__after_atomic();

wake_up_bit(&b->state, B_WRITING);
}
Expand Down Expand Up @@ -997,9 +997,9 @@ static void read_endio(struct bio *bio, int error)

BUG_ON(!test_bit(B_READING, &b->state));

smp_mb__before_clear_bit();
smp_mb__before_atomic();
clear_bit(B_READING, &b->state);
smp_mb__after_clear_bit();
smp_mb__after_atomic();

wake_up_bit(&b->state, B_READING);
}
Expand Down
4 changes: 2 additions & 2 deletions drivers/md/dm-snap.c
Original file line number Diff line number Diff line change
Expand Up @@ -642,7 +642,7 @@ static void free_pending_exception(struct dm_snap_pending_exception *pe)
struct dm_snapshot *s = pe->snap;

mempool_free(pe, s->pending_pool);
smp_mb__before_atomic_dec();
smp_mb__before_atomic();
atomic_dec(&s->pending_exceptions_count);
}

Expand Down Expand Up @@ -783,7 +783,7 @@ static int init_hash_tables(struct dm_snapshot *s)
static void merge_shutdown(struct dm_snapshot *s)
{
clear_bit_unlock(RUNNING_MERGE, &s->state_bits);
smp_mb__after_clear_bit();
smp_mb__after_atomic();
wake_up_bit(&s->state_bits, RUNNING_MERGE);
}

Expand Down
2 changes: 1 addition & 1 deletion drivers/md/dm.c
Original file line number Diff line number Diff line change
Expand Up @@ -2447,7 +2447,7 @@ static void dm_wq_work(struct work_struct *work)
static void dm_queue_flush(struct mapped_device *md)
{
clear_bit(DMF_BLOCK_IO_FOR_SUSPEND, &md->flags);
smp_mb__after_clear_bit();
smp_mb__after_atomic();
queue_work(md->wq, &md->work);
}

Expand Down
2 changes: 1 addition & 1 deletion drivers/md/raid5.c
Original file line number Diff line number Diff line change
Expand Up @@ -4400,7 +4400,7 @@ static void raid5_unplug(struct blk_plug_cb *blk_cb, bool from_schedule)
* STRIPE_ON_UNPLUG_LIST clear but the stripe
* is still in our list
*/
smp_mb__before_clear_bit();
smp_mb__before_atomic();
clear_bit(STRIPE_ON_UNPLUG_LIST, &sh->state);
/*
* STRIPE_ON_RELEASE_LIST could be set here. In that
Expand Down
6 changes: 3 additions & 3 deletions drivers/media/usb/dvb-usb-v2/dvb_usb_core.c
Original file line number Diff line number Diff line change
Expand Up @@ -399,7 +399,7 @@ static int dvb_usb_stop_feed(struct dvb_demux_feed *dvbdmxfeed)

/* clear 'streaming' status bit */
clear_bit(ADAP_STREAMING, &adap->state_bits);
smp_mb__after_clear_bit();
smp_mb__after_atomic();
wake_up_bit(&adap->state_bits, ADAP_STREAMING);
skip_feed_stop:

Expand Down Expand Up @@ -550,7 +550,7 @@ static int dvb_usb_fe_init(struct dvb_frontend *fe)
err:
if (!adap->suspend_resume_active) {
clear_bit(ADAP_INIT, &adap->state_bits);
smp_mb__after_clear_bit();
smp_mb__after_atomic();
wake_up_bit(&adap->state_bits, ADAP_INIT);
}

Expand Down Expand Up @@ -591,7 +591,7 @@ static int dvb_usb_fe_sleep(struct dvb_frontend *fe)
if (!adap->suspend_resume_active) {
adap->active_fe = -1;
clear_bit(ADAP_SLEEP, &adap->state_bits);
smp_mb__after_clear_bit();
smp_mb__after_atomic();
wake_up_bit(&adap->state_bits, ADAP_SLEEP);
}

Expand Down
6 changes: 3 additions & 3 deletions drivers/net/ethernet/broadcom/bnx2x/bnx2x_cmn.c
Original file line number Diff line number Diff line change
Expand Up @@ -2781,7 +2781,7 @@ int bnx2x_nic_load(struct bnx2x *bp, int load_mode)

case LOAD_OPEN:
netif_tx_start_all_queues(bp->dev);
smp_mb__after_clear_bit();
smp_mb__after_atomic();
break;

case LOAD_DIAG:
Expand Down Expand Up @@ -4939,9 +4939,9 @@ void bnx2x_update_coalesce_sb_index(struct bnx2x *bp, u8 fw_sb_id,
void bnx2x_schedule_sp_rtnl(struct bnx2x *bp, enum sp_rtnl_flag flag,
u32 verbose)
{
smp_mb__before_clear_bit();
smp_mb__before_atomic();
set_bit(flag, &bp->sp_rtnl_state);
smp_mb__after_clear_bit();
smp_mb__after_atomic();
DP((BNX2X_MSG_SP | verbose), "Scheduling sp_rtnl task [Flag: %d]\n",
flag);
schedule_delayed_work(&bp->sp_rtnl_task, 0);
Expand Down
18 changes: 9 additions & 9 deletions drivers/net/ethernet/broadcom/bnx2x/bnx2x_main.c
Original file line number Diff line number Diff line change
Expand Up @@ -1858,10 +1858,10 @@ void bnx2x_sp_event(struct bnx2x_fastpath *fp, union eth_rx_cqe *rr_cqe)
return;
#endif

smp_mb__before_atomic_inc();
smp_mb__before_atomic();
atomic_inc(&bp->cq_spq_left);
/* push the change in bp->spq_left and towards the memory */
smp_mb__after_atomic_inc();
smp_mb__after_atomic();

DP(BNX2X_MSG_SP, "bp->cq_spq_left %x\n", atomic_read(&bp->cq_spq_left));

Expand All @@ -1876,11 +1876,11 @@ void bnx2x_sp_event(struct bnx2x_fastpath *fp, union eth_rx_cqe *rr_cqe)
* sp_state is cleared, and this order prevents
* races
*/
smp_mb__before_clear_bit();
smp_mb__before_atomic();
set_bit(BNX2X_AFEX_PENDING_VIFSET_MCP_ACK, &bp->sp_state);
wmb();
clear_bit(BNX2X_AFEX_FCOE_Q_UPDATE_PENDING, &bp->sp_state);
smp_mb__after_clear_bit();
smp_mb__after_atomic();

/* schedule the sp task as mcp ack is required */
bnx2x_schedule_sp_task(bp);
Expand Down Expand Up @@ -5272,9 +5272,9 @@ static void bnx2x_after_function_update(struct bnx2x *bp)
__clear_bit(RAMROD_COMP_WAIT, &queue_params.ramrod_flags);

/* mark latest Q bit */
smp_mb__before_clear_bit();
smp_mb__before_atomic();
set_bit(BNX2X_AFEX_FCOE_Q_UPDATE_PENDING, &bp->sp_state);
smp_mb__after_clear_bit();
smp_mb__after_atomic();

/* send Q update ramrod for FCoE Q */
rc = bnx2x_queue_state_change(bp, &queue_params);
Expand Down Expand Up @@ -5500,7 +5500,7 @@ static void bnx2x_eq_int(struct bnx2x *bp)
spqe_cnt++;
} /* for */

smp_mb__before_atomic_inc();
smp_mb__before_atomic();
atomic_add(spqe_cnt, &bp->eq_spq_left);

bp->eq_cons = sw_cons;
Expand Down Expand Up @@ -13869,9 +13869,9 @@ static int bnx2x_drv_ctl(struct net_device *dev, struct drv_ctl_info *ctl)
case DRV_CTL_RET_L2_SPQ_CREDIT_CMD: {
int count = ctl->data.credit.credit_count;

smp_mb__before_atomic_inc();
smp_mb__before_atomic();
atomic_add(count, &bp->cq_spq_left);
smp_mb__after_atomic_inc();
smp_mb__after_atomic();
break;
}
case DRV_CTL_ULP_REGISTER_CMD: {
Expand Down
26 changes: 13 additions & 13 deletions drivers/net/ethernet/broadcom/bnx2x/bnx2x_sp.c
Original file line number Diff line number Diff line change
Expand Up @@ -258,16 +258,16 @@ static bool bnx2x_raw_check_pending(struct bnx2x_raw_obj *o)

static void bnx2x_raw_clear_pending(struct bnx2x_raw_obj *o)
{
smp_mb__before_clear_bit();
smp_mb__before_atomic();
clear_bit(o->state, o->pstate);
smp_mb__after_clear_bit();
smp_mb__after_atomic();
}

static void bnx2x_raw_set_pending(struct bnx2x_raw_obj *o)
{
smp_mb__before_clear_bit();
smp_mb__before_atomic();
set_bit(o->state, o->pstate);
smp_mb__after_clear_bit();
smp_mb__after_atomic();
}

/**
Expand Down Expand Up @@ -2131,7 +2131,7 @@ static int bnx2x_set_rx_mode_e1x(struct bnx2x *bp,

/* The operation is completed */
clear_bit(p->state, p->pstate);
smp_mb__after_clear_bit();
smp_mb__after_atomic();

return 0;
}
Expand Down Expand Up @@ -3576,16 +3576,16 @@ int bnx2x_config_mcast(struct bnx2x *bp,

static void bnx2x_mcast_clear_sched(struct bnx2x_mcast_obj *o)
{
smp_mb__before_clear_bit();
smp_mb__before_atomic();
clear_bit(o->sched_state, o->raw.pstate);
smp_mb__after_clear_bit();
smp_mb__after_atomic();
}

static void bnx2x_mcast_set_sched(struct bnx2x_mcast_obj *o)
{
smp_mb__before_clear_bit();
smp_mb__before_atomic();
set_bit(o->sched_state, o->raw.pstate);
smp_mb__after_clear_bit();
smp_mb__after_atomic();
}

static bool bnx2x_mcast_check_sched(struct bnx2x_mcast_obj *o)
Expand Down Expand Up @@ -4200,7 +4200,7 @@ int bnx2x_queue_state_change(struct bnx2x *bp,
if (rc) {
o->next_state = BNX2X_Q_STATE_MAX;
clear_bit(pending_bit, pending);
smp_mb__after_clear_bit();
smp_mb__after_atomic();
return rc;
}

Expand Down Expand Up @@ -4288,7 +4288,7 @@ static int bnx2x_queue_comp_cmd(struct bnx2x *bp,
wmb();

clear_bit(cmd, &o->pending);
smp_mb__after_clear_bit();
smp_mb__after_atomic();

return 0;
}
Expand Down Expand Up @@ -5279,7 +5279,7 @@ static inline int bnx2x_func_state_change_comp(struct bnx2x *bp,
wmb();

clear_bit(cmd, &o->pending);
smp_mb__after_clear_bit();
smp_mb__after_atomic();

return 0;
}
Expand Down Expand Up @@ -5926,7 +5926,7 @@ int bnx2x_func_state_change(struct bnx2x *bp,
if (rc) {
o->next_state = BNX2X_F_STATE_MAX;
clear_bit(cmd, pending);
smp_mb__after_clear_bit();
smp_mb__after_atomic();
return rc;
}

Expand Down
Loading

0 comments on commit 4e857c5

Please sign in to comment.