linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH net] ice: check whether PTP is initialized in ice_ptp_release()
@ 2021-10-11  7:02 Yongxin Liu
  2021-10-11  8:10 ` Keller, Jacob E
  2021-10-22  5:22 ` G, GurucharanX
  0 siblings, 2 replies; 3+ messages in thread
From: Yongxin Liu @ 2021-10-11  7:02 UTC (permalink / raw)
  To: jacob.e.keller, gurucharanx.g, anthony.l.nguyen
  Cc: netdev, linux-kernel, davem, jesse.brandeburg, intel-wired-lan, kuba

PTP is currently only supported on E810 devices, it is checked
in ice_ptp_init(). However, there is no check in ice_ptp_release().
For other E800 series devices, ice_ptp_release() will be wrongly executed.

Fix the following calltrace.

  INFO: trying to register non-static key.
  The code is fine but needs lockdep annotation, or maybe
  you didn't initialize this object before use?
  turning off the locking correctness validator.
  Workqueue: ice ice_service_task [ice]
  Call Trace:
   dump_stack_lvl+0x5b/0x82
   dump_stack+0x10/0x12
   register_lock_class+0x495/0x4a0
   ? find_held_lock+0x3c/0xb0
   __lock_acquire+0x71/0x1830
   lock_acquire+0x1e6/0x330
   ? ice_ptp_release+0x3c/0x1e0 [ice]
   ? _raw_spin_lock+0x19/0x70
   ? ice_ptp_release+0x3c/0x1e0 [ice]
   _raw_spin_lock+0x38/0x70
   ? ice_ptp_release+0x3c/0x1e0 [ice]
   ice_ptp_release+0x3c/0x1e0 [ice]
   ice_prepare_for_reset+0xcb/0xe0 [ice]
   ice_do_reset+0x38/0x110 [ice]
   ice_service_task+0x138/0xf10 [ice]
   ? __this_cpu_preempt_check+0x13/0x20
   process_one_work+0x26a/0x650
   worker_thread+0x3f/0x3b0
   ? __kthread_parkme+0x51/0xb0
   ? process_one_work+0x650/0x650
   kthread+0x161/0x190
   ? set_kthread_struct+0x40/0x40
   ret_from_fork+0x1f/0x30

Fixes: 4dd0d5c33c3e ("ice: add lock around Tx timestamp tracker flush")
Signed-off-by: Yongxin Liu <yongxin.liu@windriver.com>
---
 drivers/net/ethernet/intel/ice/ice_ptp.c | 3 +++
 1 file changed, 3 insertions(+)

diff --git a/drivers/net/ethernet/intel/ice/ice_ptp.c b/drivers/net/ethernet/intel/ice/ice_ptp.c
index 05cc5870e4ef..b1cd26a5ad33 100644
--- a/drivers/net/ethernet/intel/ice/ice_ptp.c
+++ b/drivers/net/ethernet/intel/ice/ice_ptp.c
@@ -1572,6 +1572,9 @@ void ice_ptp_init(struct ice_pf *pf)
  */
 void ice_ptp_release(struct ice_pf *pf)
 {
+	if (!test_bit(ICE_FLAG_PTP, pf->flags))
+		return;
+
 	/* Disable timestamping for both Tx and Rx */
 	ice_ptp_cfg_timestamp(pf, false);
 
-- 
2.31.1


^ permalink raw reply related	[flat|nested] 3+ messages in thread

* RE: [PATCH net] ice: check whether PTP is initialized in ice_ptp_release()
  2021-10-11  7:02 [PATCH net] ice: check whether PTP is initialized in ice_ptp_release() Yongxin Liu
@ 2021-10-11  8:10 ` Keller, Jacob E
  2021-10-22  5:22 ` G, GurucharanX
  1 sibling, 0 replies; 3+ messages in thread
From: Keller, Jacob E @ 2021-10-11  8:10 UTC (permalink / raw)
  To: Yongxin Liu, G, GurucharanX, Nguyen, Anthony L
  Cc: netdev, linux-kernel, davem, Brandeburg, Jesse, intel-wired-lan, kuba



> -----Original Message-----
> From: Yongxin Liu <yongxin.liu@windriver.com>
> Sent: Monday, October 11, 2021 12:02 AM
> To: Keller, Jacob E <jacob.e.keller@intel.com>; G, GurucharanX
> <gurucharanx.g@intel.com>; Nguyen, Anthony L <anthony.l.nguyen@intel.com>
> Cc: netdev@vger.kernel.org; linux-kernel@vger.kernel.org;
> davem@davemloft.net; Brandeburg, Jesse <jesse.brandeburg@intel.com>; intel-
> wired-lan@lists.osuosl.org; kuba@kernel.org
> Subject: [PATCH net] ice: check whether PTP is initialized in ice_ptp_release()
> 
> PTP is currently only supported on E810 devices, it is checked
> in ice_ptp_init(). However, there is no check in ice_ptp_release().
> For other E800 series devices, ice_ptp_release() will be wrongly executed.
> 
> Fix the following calltrace.
> 


Ahhh. Yep.

Reviewed-by: Jacob Keller <jacob.e.keller@intel.com>

>   INFO: trying to register non-static key.
>   The code is fine but needs lockdep annotation, or maybe
>   you didn't initialize this object before use?
>   turning off the locking correctness validator.
>   Workqueue: ice ice_service_task [ice]
>   Call Trace:
>    dump_stack_lvl+0x5b/0x82
>    dump_stack+0x10/0x12
>    register_lock_class+0x495/0x4a0
>    ? find_held_lock+0x3c/0xb0
>    __lock_acquire+0x71/0x1830
>    lock_acquire+0x1e6/0x330
>    ? ice_ptp_release+0x3c/0x1e0 [ice]
>    ? _raw_spin_lock+0x19/0x70
>    ? ice_ptp_release+0x3c/0x1e0 [ice]
>    _raw_spin_lock+0x38/0x70
>    ? ice_ptp_release+0x3c/0x1e0 [ice]
>    ice_ptp_release+0x3c/0x1e0 [ice]
>    ice_prepare_for_reset+0xcb/0xe0 [ice]
>    ice_do_reset+0x38/0x110 [ice]
>    ice_service_task+0x138/0xf10 [ice]
>    ? __this_cpu_preempt_check+0x13/0x20
>    process_one_work+0x26a/0x650
>    worker_thread+0x3f/0x3b0
>    ? __kthread_parkme+0x51/0xb0
>    ? process_one_work+0x650/0x650
>    kthread+0x161/0x190
>    ? set_kthread_struct+0x40/0x40
>    ret_from_fork+0x1f/0x30
> 
> Fixes: 4dd0d5c33c3e ("ice: add lock around Tx timestamp tracker flush")
> Signed-off-by: Yongxin Liu <yongxin.liu@windriver.com>
> ---
>  drivers/net/ethernet/intel/ice/ice_ptp.c | 3 +++
>  1 file changed, 3 insertions(+)
> 
> diff --git a/drivers/net/ethernet/intel/ice/ice_ptp.c
> b/drivers/net/ethernet/intel/ice/ice_ptp.c
> index 05cc5870e4ef..b1cd26a5ad33 100644
> --- a/drivers/net/ethernet/intel/ice/ice_ptp.c
> +++ b/drivers/net/ethernet/intel/ice/ice_ptp.c
> @@ -1572,6 +1572,9 @@ void ice_ptp_init(struct ice_pf *pf)
>   */
>  void ice_ptp_release(struct ice_pf *pf)
>  {
> +	if (!test_bit(ICE_FLAG_PTP, pf->flags))
> +		return;
> +
>  	/* Disable timestamping for both Tx and Rx */
>  	ice_ptp_cfg_timestamp(pf, false);
> 
> --
> 2.31.1


^ permalink raw reply	[flat|nested] 3+ messages in thread

* RE: [PATCH net] ice: check whether PTP is initialized in ice_ptp_release()
  2021-10-11  7:02 [PATCH net] ice: check whether PTP is initialized in ice_ptp_release() Yongxin Liu
  2021-10-11  8:10 ` Keller, Jacob E
@ 2021-10-22  5:22 ` G, GurucharanX
  1 sibling, 0 replies; 3+ messages in thread
From: G, GurucharanX @ 2021-10-22  5:22 UTC (permalink / raw)
  To: Yongxin Liu, Keller, Jacob E, Nguyen, Anthony L
  Cc: netdev, linux-kernel, davem, Brandeburg, Jesse, intel-wired-lan, kuba



> -----Original Message-----
> From: Yongxin Liu <yongxin.liu@windriver.com>
> Sent: Monday, October 11, 2021 12:32 PM
> To: Keller, Jacob E <jacob.e.keller@intel.com>; G, GurucharanX
> <gurucharanx.g@intel.com>; Nguyen, Anthony L
> <anthony.l.nguyen@intel.com>
> Cc: netdev@vger.kernel.org; linux-kernel@vger.kernel.org;
> davem@davemloft.net; Brandeburg, Jesse <jesse.brandeburg@intel.com>;
> intel-wired-lan@lists.osuosl.org; kuba@kernel.org
> Subject: [PATCH net] ice: check whether PTP is initialized in ice_ptp_release()
> 
> PTP is currently only supported on E810 devices, it is checked in ice_ptp_init().
> However, there is no check in ice_ptp_release().
> For other E800 series devices, ice_ptp_release() will be wrongly executed.
> 
> Fix the following calltrace.
> 
>   INFO: trying to register non-static key.
>   The code is fine but needs lockdep annotation, or maybe
>   you didn't initialize this object before use?
>   turning off the locking correctness validator.
>   Workqueue: ice ice_service_task [ice]
>   Call Trace:
>    dump_stack_lvl+0x5b/0x82
>    dump_stack+0x10/0x12
>    register_lock_class+0x495/0x4a0
>    ? find_held_lock+0x3c/0xb0
>    __lock_acquire+0x71/0x1830
>    lock_acquire+0x1e6/0x330
>    ? ice_ptp_release+0x3c/0x1e0 [ice]
>    ? _raw_spin_lock+0x19/0x70
>    ? ice_ptp_release+0x3c/0x1e0 [ice]
>    _raw_spin_lock+0x38/0x70
>    ? ice_ptp_release+0x3c/0x1e0 [ice]
>    ice_ptp_release+0x3c/0x1e0 [ice]
>    ice_prepare_for_reset+0xcb/0xe0 [ice]
>    ice_do_reset+0x38/0x110 [ice]
>    ice_service_task+0x138/0xf10 [ice]
>    ? __this_cpu_preempt_check+0x13/0x20
>    process_one_work+0x26a/0x650
>    worker_thread+0x3f/0x3b0
>    ? __kthread_parkme+0x51/0xb0
>    ? process_one_work+0x650/0x650
>    kthread+0x161/0x190
>    ? set_kthread_struct+0x40/0x40
>    ret_from_fork+0x1f/0x30
> 
> Fixes: 4dd0d5c33c3e ("ice: add lock around Tx timestamp tracker flush")
> Signed-off-by: Yongxin Liu <yongxin.liu@windriver.com>
> ---
>  drivers/net/ethernet/intel/ice/ice_ptp.c | 3 +++
>  1 file changed, 3 insertions(+)
> 

Tested-by: Gurucharan G <gurucharanx.g@intel.com> (A Contingent worker at Intel)

^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2021-10-22  5:22 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-10-11  7:02 [PATCH net] ice: check whether PTP is initialized in ice_ptp_release() Yongxin Liu
2021-10-11  8:10 ` Keller, Jacob E
2021-10-22  5:22 ` G, GurucharanX

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).