From: Saeed Mahameed <saeed@kernel.org>
To: Tony Nguyen <anthony.l.nguyen@intel.com>
Cc: davem@davemloft.net, kuba@kernel.org, pabeni@redhat.com,
edumazet@google.com,
Anatolii Gerasymenko <anatolii.gerasymenko@intel.com>,
netdev@vger.kernel.org, richardcochran@gmail.com,
Gurucharan G <gurucharanx.g@intel.com>
Subject: Re: [PATCH net 1/4] ice: Create a separate kthread to handle ptp extts work
Date: Wed, 7 Dec 2022 14:19:30 -0800 [thread overview]
Message-ID: <Y5ERcnar+H+xtYYC@x130> (raw)
In-Reply-To: <20221207211040.1099708-2-anthony.l.nguyen@intel.com>
On 07 Dec 13:10, Tony Nguyen wrote:
>From: Anatolii Gerasymenko <anatolii.gerasymenko@intel.com>
>
>ice_ptp_extts_work() and ice_ptp_periodic_work() are both scheduled on
>the same kthread_worker pf.ptp.kworker. But, ice_ptp_periodic_work()
>sends messages to AQ and waits for responses. This causes
>ice_ptp_extts_work() to be blocked while waiting to be scheduled. This
>causes problems with the reading of the incoming signal timestamps,
>which disrupts a 100 Hz signal.
>
Sounds like an optimization rather than a bug fix, unless you explain what
the symptoms are and how critical this patch is.
code LGTM, although i find it wasteful to create a kthread per device event
type, but i can't think of a better way.
>Create an additional kthread_worker pf.ptp.kworker_extts to service only
>ice_ptp_extts_work() as soon as possible.
>
>Fixes: 77a781155a65 ("ice: enable receive hardware timestamping")
>Signed-off-by: Anatolii Gerasymenko <anatolii.gerasymenko@intel.com>
>Tested-by: Gurucharan G <gurucharanx.g@intel.com> (A Contingent worker at Intel)
>Signed-off-by: Tony Nguyen <anthony.l.nguyen@intel.com>
>---
> drivers/net/ethernet/intel/ice/ice_main.c | 5 ++++-
> drivers/net/ethernet/intel/ice/ice_ptp.c | 15 ++++++++++++++-
> drivers/net/ethernet/intel/ice/ice_ptp.h | 2 ++
> 3 files changed, 20 insertions(+), 2 deletions(-)
>
>diff --git a/drivers/net/ethernet/intel/ice/ice_main.c b/drivers/net/ethernet/intel/ice/ice_main.c
>index ca2898467dcb..d0f14e73e8da 100644
>--- a/drivers/net/ethernet/intel/ice/ice_main.c
>+++ b/drivers/net/ethernet/intel/ice/ice_main.c
>@@ -3106,7 +3106,10 @@ static irqreturn_t ice_misc_intr(int __always_unused irq, void *data)
> GLTSYN_STAT_EVENT1_M |
> GLTSYN_STAT_EVENT2_M);
> ena_mask &= ~PFINT_OICR_TSYN_EVNT_M;
>- kthread_queue_work(pf->ptp.kworker, &pf->ptp.extts_work);
>+
>+ if (pf->ptp.kworker_extts)
>+ kthread_queue_work(pf->ptp.kworker_extts,
>+ &pf->ptp.extts_work);
> }
>
> #define ICE_AUX_CRIT_ERR (PFINT_OICR_PE_CRITERR_M | PFINT_OICR_HMC_ERR_M | PFINT_OICR_PE_PUSH_M)
>diff --git a/drivers/net/ethernet/intel/ice/ice_ptp.c b/drivers/net/ethernet/intel/ice/ice_ptp.c
>index 0f668468d141..f9e20622ad9f 100644
>--- a/drivers/net/ethernet/intel/ice/ice_ptp.c
>+++ b/drivers/net/ethernet/intel/ice/ice_ptp.c
>@@ -2604,7 +2604,7 @@ static int ice_ptp_init_owner(struct ice_pf *pf)
> */
> static int ice_ptp_init_work(struct ice_pf *pf, struct ice_ptp *ptp)
> {
>- struct kthread_worker *kworker;
>+ struct kthread_worker *kworker, *kworker_extts;
>
> /* Initialize work functions */
> kthread_init_delayed_work(&ptp->work, ice_ptp_periodic_work);
>@@ -2620,6 +2620,13 @@ static int ice_ptp_init_work(struct ice_pf *pf, struct ice_ptp *ptp)
>
> ptp->kworker = kworker;
>
>+ kworker_extts = kthread_create_worker(0, "ice-ptp-extts-%s",
>+ dev_name(ice_pf_to_dev(pf)));
>+ if (IS_ERR(kworker_extts))
>+ return PTR_ERR(kworker_extts);
>+
>+ ptp->kworker_extts = kworker_extts;
>+
> /* Start periodic work going */
> kthread_queue_delayed_work(ptp->kworker, &ptp->work, 0);
>
>@@ -2719,11 +2726,17 @@ void ice_ptp_release(struct ice_pf *pf)
>
> ice_ptp_port_phy_stop(&pf->ptp.port);
> mutex_destroy(&pf->ptp.port.ps_lock);
>+
> if (pf->ptp.kworker) {
> kthread_destroy_worker(pf->ptp.kworker);
> pf->ptp.kworker = NULL;
> }
>
>+ if (pf->ptp.kworker_extts) {
>+ kthread_destroy_worker(pf->ptp.kworker_extts);
>+ pf->ptp.kworker_extts = NULL;
>+ }
>+
> if (!pf->ptp.clock)
> return;
>
>diff --git a/drivers/net/ethernet/intel/ice/ice_ptp.h b/drivers/net/ethernet/intel/ice/ice_ptp.h
>index 028349295b71..c63ad2c9af4c 100644
>--- a/drivers/net/ethernet/intel/ice/ice_ptp.h
>+++ b/drivers/net/ethernet/intel/ice/ice_ptp.h
>@@ -165,6 +165,7 @@ struct ice_ptp_port {
> * @ext_ts_chan: the external timestamp channel in use
> * @ext_ts_irq: the external timestamp IRQ in use
> * @kworker: kwork thread for handling periodic work
>+ * @kworker_extts: kworker thread for handling extts work
> * @perout_channels: periodic output data
> * @info: structure defining PTP hardware capabilities
> * @clock: pointer to registered PTP clock device
>@@ -186,6 +187,7 @@ struct ice_ptp {
> u8 ext_ts_chan;
> u8 ext_ts_irq;
> struct kthread_worker *kworker;
>+ struct kthread_worker *kworker_extts;
> struct ice_perout_channel perout_channels[GLTSYN_TGT_H_IDX_MAX];
> struct ptp_clock_info info;
> struct ptp_clock *clock;
>--
>2.35.1
>
next prev parent reply other threads:[~2022-12-07 22:19 UTC|newest]
Thread overview: 18+ messages / expand[flat|nested] mbox.gz Atom feed top
2022-12-07 21:10 [PATCH net 0/4][pull request] Intel Wired LAN Driver Updates 2022-12-07 (ice) Tony Nguyen
2022-12-07 21:10 ` [PATCH net 1/4] ice: Create a separate kthread to handle ptp extts work Tony Nguyen
2022-12-07 22:19 ` Saeed Mahameed [this message]
2022-12-07 23:22 ` Jacob Keller
2022-12-08 0:27 ` Richard Cochran
2022-12-09 17:07 ` Tony Nguyen
2022-12-07 21:10 ` [PATCH net 2/4] ice: Correctly handle aux device when num channels change Tony Nguyen
2022-12-07 22:25 ` Saeed Mahameed
2022-12-09 17:21 ` Ertman, David M
2022-12-09 19:28 ` Saeed Mahameed
2022-12-09 19:32 ` Jason Gunthorpe
2022-12-12 17:03 ` Ertman, David M
2022-12-12 23:53 ` Jason Gunthorpe
2022-12-16 19:08 ` [PATCH net 2/4] ice: git send-email --suppress-cc=all --to e1000-patches@eclists.intel.com Ertman, David M
2022-12-07 21:10 ` [PATCH net 3/4] ice: Fix deadlock on the rtnl_mutex Tony Nguyen
2022-12-07 21:10 ` [PATCH net 4/4] ice: Fix broken link in ice NAPI doc Tony Nguyen
-- strict thread matches above, loose matches on Subject: below --
2022-12-12 23:24 [PATCH net 1/4] ice: Create a separate kthread to handle ptp extts work Kolacinski, Karol
2022-12-13 2:43 ` Richard Cochran
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=Y5ERcnar+H+xtYYC@x130 \
--to=saeed@kernel.org \
--cc=anatolii.gerasymenko@intel.com \
--cc=anthony.l.nguyen@intel.com \
--cc=davem@davemloft.net \
--cc=edumazet@google.com \
--cc=gurucharanx.g@intel.com \
--cc=kuba@kernel.org \
--cc=netdev@vger.kernel.org \
--cc=pabeni@redhat.com \
--cc=richardcochran@gmail.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
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).