RE: [PATCH] RDMA/i40iw: Convert timers to use timer_setup() (part 2)
> Subject: [PATCH] RDMA/i40iw: Convert timers to use timer_setup() (part 2) > > In preparation for unconditionally passing the struct timer_list pointer to > all timer > callbacks, switch to using the new timer_setup() and from_timer() to pass the > timer > pointer explicitly. > > This includes the remaining timers missed in the earlier i40iw patch. > > Cc: Faisal Latif > Cc: Shiraz Saleem > Cc: Doug Ledford > Cc: Sean Hefty > Cc: Hal Rosenstock > Cc: linux-r...@vger.kernel.org > Signed-off-by: Kees Cook > --- Thanks! Acked-by: Shiraz Saleem
Re: [PATCH] RDMA/i40iw: Convert timers to use timer_setup() (part 2)
On Tue, 2017-10-17 at 11:37 -0700, Kees Cook wrote: > In preparation for unconditionally passing the struct timer_list > pointer to > all timer callbacks, switch to using the new timer_setup() and > from_timer() > to pass the timer pointer explicitly. > > This includes the remaining timers missed in the earlier i40iw patch. > > Cc: Faisal Latif > Cc: Shiraz Saleem > Cc: Doug Ledford > Cc: Sean Hefty > Cc: Hal Rosenstock > Cc: linux-r...@vger.kernel.org > Signed-off-by: Kees Cook Thanks, applied. -- Doug Ledford GPG KeyID: B826A3330E572FDD Key fingerprint = AE6B 1BDA 122B 23B4 265B 1274 B826 A333 0E57 2FDD
[PATCH] RDMA/i40iw: Convert timers to use timer_setup() (part 2)
In preparation for unconditionally passing the struct timer_list pointer to all timer callbacks, switch to using the new timer_setup() and from_timer() to pass the timer pointer explicitly. This includes the remaining timers missed in the earlier i40iw patch. Cc: Faisal Latif Cc: Shiraz Saleem Cc: Doug Ledford Cc: Sean Hefty Cc: Hal Rosenstock Cc: linux-r...@vger.kernel.org Signed-off-by: Kees Cook --- drivers/infiniband/hw/i40iw/i40iw_cm.c| 7 +++ drivers/infiniband/hw/i40iw/i40iw_utils.c | 7 +++ 2 files changed, 6 insertions(+), 8 deletions(-) diff --git a/drivers/infiniband/hw/i40iw/i40iw_cm.c b/drivers/infiniband/hw/i40iw/i40iw_cm.c index 50c43766defd..789d925df227 100644 --- a/drivers/infiniband/hw/i40iw/i40iw_cm.c +++ b/drivers/infiniband/hw/i40iw/i40iw_cm.c @@ -1188,7 +1188,7 @@ static void i40iw_handle_close_entry(struct i40iw_cm_node *cm_node, u32 rem_node * i40iw_cm_timer_tick - system's timer expired callback * @pass: Pointing to cm_core */ -static void i40iw_cm_timer_tick(unsigned long pass) +static void i40iw_cm_timer_tick(struct timer_list *t) { unsigned long nexttimeout = jiffies + I40IW_LONG_TIME; struct i40iw_cm_node *cm_node; @@ -1196,7 +1196,7 @@ static void i40iw_cm_timer_tick(unsigned long pass) struct list_head *list_core_temp; struct i40iw_sc_vsi *vsi; struct list_head *list_node; - struct i40iw_cm_core *cm_core = (struct i40iw_cm_core *)pass; + struct i40iw_cm_core *cm_core = from_timer(cm_core, t, tcp_timer); u32 settimer = 0; unsigned long timetosend; struct i40iw_sc_dev *dev; @@ -3202,8 +3202,7 @@ void i40iw_setup_cm_core(struct i40iw_device *iwdev) INIT_LIST_HEAD(&cm_core->connected_nodes); INIT_LIST_HEAD(&cm_core->listen_nodes); - setup_timer(&cm_core->tcp_timer, i40iw_cm_timer_tick, - (unsigned long)cm_core); + timer_setup(&cm_core->tcp_timer, i40iw_cm_timer_tick, 0); spin_lock_init(&cm_core->ht_lock); spin_lock_init(&cm_core->listen_list_lock); diff --git a/drivers/infiniband/hw/i40iw/i40iw_utils.c b/drivers/infiniband/hw/i40iw/i40iw_utils.c index f6c76595e834..2ed31004b19c 100644 --- a/drivers/infiniband/hw/i40iw/i40iw_utils.c +++ b/drivers/infiniband/hw/i40iw/i40iw_utils.c @@ -870,9 +870,9 @@ void i40iw_terminate_done(struct i40iw_sc_qp *qp, int timeout_occurred) * i40iw_terminate_imeout - timeout happened * @context: points to iwarp qp */ -static void i40iw_terminate_timeout(unsigned long context) +static void i40iw_terminate_timeout(struct timer_list *t) { - struct i40iw_qp *iwqp = (struct i40iw_qp *)context; + struct i40iw_qp *iwqp = from_timer(iwqp, t, terminate_timer); struct i40iw_sc_qp *qp = (struct i40iw_sc_qp *)&iwqp->sc_qp; i40iw_terminate_done(qp, 1); @@ -889,8 +889,7 @@ void i40iw_terminate_start_timer(struct i40iw_sc_qp *qp) iwqp = (struct i40iw_qp *)qp->back_qp; i40iw_add_ref(&iwqp->ibqp); - setup_timer(&iwqp->terminate_timer, i40iw_terminate_timeout, - (unsigned long)iwqp); + timer_setup(&iwqp->terminate_timer, i40iw_terminate_timeout, 0); iwqp->terminate_timer.expires = jiffies + HZ; add_timer(&iwqp->terminate_timer); } -- 2.7.4 -- Kees Cook Pixel Security
Re: [PATCH] RDMA/i40iw: Convert timers to use timer_setup()
On Sat, Oct 7, 2017 at 7:12 AM, Shiraz Saleem wrote: > On Fri, Oct 06, 2017 at 06:17:23PM -0500, Shiraz Saleem wrote: >> On Wed, Oct 04, 2017 at 05:45:41PM -0700, Kees Cook wrote: >> > In preparation for unconditionally passing the struct timer_list pointer to >> > all timer callbacks, switch to using the new timer_setup() and from_timer() >> > to pass the timer pointer explicitly. >> > >> > Cc: Faisal Latif >> > Cc: Shiraz Saleem >> > Cc: Doug Ledford >> > Cc: Sean Hefty >> > Cc: Hal Rosenstock >> > Cc: linux-r...@vger.kernel.org >> > Cc: Thomas Gleixner >> > Signed-off-by: Kees Cook >> > --- >> > This requires commit 686fef928bba ("timer: Prepare to change timer >> > callback argument type") in v4.14-rc3, but should be otherwise >> > stand-alone. >> > --- >> >> Patch looks ok. Did some minimal testing and looks good. >> >> Acked-by: Shiraz Saleem >> > > Hi Kees, > > Sorry, I didnt notice this earlier, but, you made the change only to the > stats timer > to use the new timer init APIs. Can you do the same for the cm_timer and > terminate_timer > too for i40iw; so that things are consistent? > > [ssaleem@linbuild6081 i40iw]$ grep "setup_timer" * > i40iw_cm.c: setup_timer(&cm_core->tcp_timer, i40iw_cm_timer_tick, > i40iw_utils.c: setup_timer(&iwqp->terminate_timer, i40iw_terminate_timeout, > i40iw_utils.c: setup_timer(&devstat->stats_timer, i40iw_hw_stats_timeout, Hi! (Sorry for the delay, I missed this email, thanks for the reminder.) I will send a follow-up with these added. (They were trivial conversions, so they were originally part of my tree's tree-wide mass conversion before I started pulling per-subsystem conversions out into separate patches.) Thanks! -Kees -- Kees Cook Pixel Security
Re: [PATCH] RDMA/i40iw: Convert timers to use timer_setup()
On Sat, 2017-10-07 at 09:12 -0500, Shiraz Saleem wrote: > Hi Kees, > > Sorry, I didnt notice this earlier, but, you made the change only to > the stats timer > to use the new timer init APIs. Can you do the same for the cm_timer > and terminate_timer > too for i40iw; so that things are consistent? > > [ssaleem@linbuild6081 i40iw]$ grep "setup_timer" * > i40iw_cm.c: setup_timer(&cm_core->tcp_timer, i40iw_cm_timer_tick, > i40iw_utils.c: setup_timer(&iwqp->terminate_timer, > i40iw_terminate_timeout, > i40iw_utils.c: setup_timer(&devstat->stats_timer, > i40iw_hw_stats_timeout, Since I took the first patch, this will need to be as an incremental change. -- Doug Ledford GPG KeyID: B826A3330E572FDD Key fingerprint = AE6B 1BDA 122B 23B4 265B 1274 B826 A333 0E57 2FDD
Re: [PATCH] RDMA/i40iw: Convert timers to use timer_setup()
On Wed, 2017-10-04 at 17:45 -0700, Kees Cook wrote: > In preparation for unconditionally passing the struct timer_list > pointer to > all timer callbacks, switch to using the new timer_setup() and > from_timer() > to pass the timer pointer explicitly. > > Cc: Faisal Latif > Cc: Shiraz Saleem > Cc: Doug Ledford > Cc: Sean Hefty > Cc: Hal Rosenstock > Cc: linux-r...@vger.kernel.org > Cc: Thomas Gleixner > Signed-off-by: Kees Cook > --- > This requires commit 686fef928bba ("timer: Prepare to change timer > callback argument type") in v4.14-rc3, but should be otherwise > stand-alone. Thanks, applied. -- Doug Ledford GPG KeyID: B826A3330E572FDD Key fingerprint = AE6B 1BDA 122B 23B4 265B 1274 B826 A333 0E57 2FDD
Re: [PATCH] RDMA/i40iw: Convert timers to use timer_setup()
On Fri, Oct 06, 2017 at 06:17:23PM -0500, Shiraz Saleem wrote: > On Wed, Oct 04, 2017 at 05:45:41PM -0700, Kees Cook wrote: > > In preparation for unconditionally passing the struct timer_list pointer to > > all timer callbacks, switch to using the new timer_setup() and from_timer() > > to pass the timer pointer explicitly. > > > > Cc: Faisal Latif > > Cc: Shiraz Saleem > > Cc: Doug Ledford > > Cc: Sean Hefty > > Cc: Hal Rosenstock > > Cc: linux-r...@vger.kernel.org > > Cc: Thomas Gleixner > > Signed-off-by: Kees Cook > > --- > > This requires commit 686fef928bba ("timer: Prepare to change timer > > callback argument type") in v4.14-rc3, but should be otherwise > > stand-alone. > > --- > > Patch looks ok. Did some minimal testing and looks good. > > Acked-by: Shiraz Saleem > Hi Kees, Sorry, I didnt notice this earlier, but, you made the change only to the stats timer to use the new timer init APIs. Can you do the same for the cm_timer and terminate_timer too for i40iw; so that things are consistent? [ssaleem@linbuild6081 i40iw]$ grep "setup_timer" * i40iw_cm.c: setup_timer(&cm_core->tcp_timer, i40iw_cm_timer_tick, i40iw_utils.c: setup_timer(&iwqp->terminate_timer, i40iw_terminate_timeout, i40iw_utils.c: setup_timer(&devstat->stats_timer, i40iw_hw_stats_timeout, Shiraz
Re: [PATCH] RDMA/i40iw: Convert timers to use timer_setup()
On Wed, Oct 04, 2017 at 05:45:41PM -0700, Kees Cook wrote: > In preparation for unconditionally passing the struct timer_list pointer to > all timer callbacks, switch to using the new timer_setup() and from_timer() > to pass the timer pointer explicitly. > > Cc: Faisal Latif > Cc: Shiraz Saleem > Cc: Doug Ledford > Cc: Sean Hefty > Cc: Hal Rosenstock > Cc: linux-r...@vger.kernel.org > Cc: Thomas Gleixner > Signed-off-by: Kees Cook > --- > This requires commit 686fef928bba ("timer: Prepare to change timer > callback argument type") in v4.14-rc3, but should be otherwise > stand-alone. > --- Patch looks ok. Did some minimal testing and looks good. Acked-by: Shiraz Saleem
[PATCH] RDMA/i40iw: Convert timers to use timer_setup()
In preparation for unconditionally passing the struct timer_list pointer to all timer callbacks, switch to using the new timer_setup() and from_timer() to pass the timer pointer explicitly. Cc: Faisal Latif Cc: Shiraz Saleem Cc: Doug Ledford Cc: Sean Hefty Cc: Hal Rosenstock Cc: linux-r...@vger.kernel.org Cc: Thomas Gleixner Signed-off-by: Kees Cook --- This requires commit 686fef928bba ("timer: Prepare to change timer callback argument type") in v4.14-rc3, but should be otherwise stand-alone. --- drivers/infiniband/hw/i40iw/i40iw_ctrl.c | 1 + drivers/infiniband/hw/i40iw/i40iw_type.h | 1 + drivers/infiniband/hw/i40iw/i40iw_utils.c | 10 +- 3 files changed, 7 insertions(+), 5 deletions(-) diff --git a/drivers/infiniband/hw/i40iw/i40iw_ctrl.c b/drivers/infiniband/hw/i40iw/i40iw_ctrl.c index d1f5345f04f0..2d076cf946e0 100644 --- a/drivers/infiniband/hw/i40iw/i40iw_ctrl.c +++ b/drivers/infiniband/hw/i40iw/i40iw_ctrl.c @@ -4873,6 +4873,7 @@ enum i40iw_status_code i40iw_vsi_stats_init(struct i40iw_sc_vsi *vsi, struct i40 vsi->pestat = info->pestat; vsi->pestat->hw = vsi->dev->hw; + vsi->pestat->vsi = vsi; if (info->stats_initialize) { i40iw_hw_stats_init(vsi->pestat, fcn_id, true); diff --git a/drivers/infiniband/hw/i40iw/i40iw_type.h b/drivers/infiniband/hw/i40iw/i40iw_type.h index 63118f6d5ab4..7798e8e2f9bd 100644 --- a/drivers/infiniband/hw/i40iw/i40iw_type.h +++ b/drivers/infiniband/hw/i40iw/i40iw_type.h @@ -250,6 +250,7 @@ struct i40iw_vsi_pestat { struct i40iw_dev_hw_stats last_read_hw_stats; struct i40iw_dev_hw_stats_offsets hw_stats_offsets; struct timer_list stats_timer; + struct i40iw_sc_vsi *vsi; spinlock_t lock; /* rdma stats lock */ }; diff --git a/drivers/infiniband/hw/i40iw/i40iw_utils.c b/drivers/infiniband/hw/i40iw/i40iw_utils.c index e52dbbb4165e..f6c76595e834 100644 --- a/drivers/infiniband/hw/i40iw/i40iw_utils.c +++ b/drivers/infiniband/hw/i40iw/i40iw_utils.c @@ -1445,11 +1445,12 @@ enum i40iw_status_code i40iw_puda_get_tcpip_info(struct i40iw_puda_completion_in * i40iw_hw_stats_timeout - Stats timer-handler which updates all HW stats * @vsi: pointer to the vsi structure */ -static void i40iw_hw_stats_timeout(unsigned long vsi) +static void i40iw_hw_stats_timeout(struct timer_list *t) { - struct i40iw_sc_vsi *sc_vsi = (struct i40iw_sc_vsi *)vsi; + struct i40iw_vsi_pestat *pf_devstat = from_timer(pf_devstat, t, + stats_timer); + struct i40iw_sc_vsi *sc_vsi = pf_devstat->vsi; struct i40iw_sc_dev *pf_dev = sc_vsi->dev; - struct i40iw_vsi_pestat *pf_devstat = sc_vsi->pestat; struct i40iw_vsi_pestat *vf_devstat = NULL; u16 iw_vf_idx; unsigned long flags; @@ -1480,8 +1481,7 @@ void i40iw_hw_stats_start_timer(struct i40iw_sc_vsi *vsi) { struct i40iw_vsi_pestat *devstat = vsi->pestat; - setup_timer(&devstat->stats_timer, i40iw_hw_stats_timeout, - (unsigned long)vsi); + timer_setup(&devstat->stats_timer, i40iw_hw_stats_timeout, 0); mod_timer(&devstat->stats_timer, jiffies + msecs_to_jiffies(STATS_TIMER_DELAY)); } -- 2.7.4 -- Kees Cook Pixel Security