* [dpdk-stable] [PATCH] event/sw: fix cq idx check for unlink usecases
@ 2018-09-21 10:25 Harry van Haaren
2018-09-21 12:17 ` Elo, Matias (Nokia - FI/Espoo)
0 siblings, 1 reply; 3+ messages in thread
From: Harry van Haaren @ 2018-09-21 10:25 UTC (permalink / raw)
To: dev; +Cc: matias.elo, Harry van Haaren, stable
This commit fixes the cq index checks when unlinking
ports/queues while the scheduler core is running.
Previously, the == comparison could be "skipped" if
in particular corner cases. With the check being changed
to >= this is resolved as the cq idx gets reset to zero.
Bugzilla ID: 60
Fixes: 617995dfc5b2 ("event/sw: add scheduling logic")
Suggested-by: Matias Elo <matias.elo@nokia.com>
Signed-off-by: Harry van Haaren <harry.van.haaren@intel.com>
---
Cc: stable@dpdk.org
@Matias,
When testing this patch with your provided test case as per attachment
to bug #60 in Bugzilla, I don't see any events arriving to port 0.
Hence, I believe this to be the correct behaviour, if you can confirm
that'd be awesome!
Regards, -Harry
---
drivers/event/sw/sw_evdev_scheduler.c | 13 ++++++++-----
1 file changed, 8 insertions(+), 5 deletions(-)
diff --git a/drivers/event/sw/sw_evdev_scheduler.c b/drivers/event/sw/sw_evdev_scheduler.c
index e3a41e02f..fb5d44630 100644
--- a/drivers/event/sw/sw_evdev_scheduler.c
+++ b/drivers/event/sw/sw_evdev_scheduler.c
@@ -51,9 +51,11 @@ sw_schedule_atomic_to_cq(struct sw_evdev *sw, struct sw_qid * const qid,
int cq = fid->cq;
if (cq < 0) {
- uint32_t cq_idx = qid->cq_next_tx++;
- if (qid->cq_next_tx == qid->cq_num_mapped_cqs)
+ uint32_t cq_idx;
+ if (qid->cq_next_tx >= qid->cq_num_mapped_cqs)
qid->cq_next_tx = 0;
+ cq_idx = qid->cq_next_tx++;
+
cq = qid->cq_map[cq_idx];
/* find least used */
@@ -140,9 +142,10 @@ sw_schedule_parallel_to_cq(struct sw_evdev *sw, struct sw_qid * const qid,
do {
if (++cq_check_count > qid->cq_num_mapped_cqs)
goto exit;
- cq = qid->cq_map[cq_idx];
- if (++cq_idx == qid->cq_num_mapped_cqs)
+ if (cq_idx >= qid->cq_num_mapped_cqs)
cq_idx = 0;
+ cq = qid->cq_map[cq_idx++];
+
} while (rte_event_ring_free_count(
sw->ports[cq].cq_worker_ring) == 0 ||
sw->ports[cq].inflights == SW_PORT_HIST_LIST);
@@ -220,7 +223,7 @@ sw_schedule_qid_to_cq(struct sw_evdev *sw)
int iq_num = PKT_MASK_TO_IQ(qid->iq_pkt_mask);
/* zero mapped CQs indicates directed */
- if (iq_num >= SW_IQS_MAX)
+ if (iq_num >= SW_IQS_MAX || qid->cq_num_mapped_cqs == 0)
continue;
uint32_t pkts_done = 0;
--
2.17.1
^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: [dpdk-stable] [PATCH] event/sw: fix cq idx check for unlink usecases
2018-09-21 10:25 [dpdk-stable] [PATCH] event/sw: fix cq idx check for unlink usecases Harry van Haaren
@ 2018-09-21 12:17 ` Elo, Matias (Nokia - FI/Espoo)
2018-09-23 11:27 ` [dpdk-stable] [dpdk-dev] " Jerin Jacob
0 siblings, 1 reply; 3+ messages in thread
From: Elo, Matias (Nokia - FI/Espoo) @ 2018-09-21 12:17 UTC (permalink / raw)
To: Harry van Haaren; +Cc: dev, stable
> On 21 Sep 2018, at 13:25, Harry van Haaren <harry.van.haaren@intel.com> wrote:
>
> This commit fixes the cq index checks when unlinking
> ports/queues while the scheduler core is running.
> Previously, the == comparison could be "skipped" if
> in particular corner cases. With the check being changed
> to >= this is resolved as the cq idx gets reset to zero.
>
> Bugzilla ID: 60
> Fixes: 617995dfc5b2 ("event/sw: add scheduling logic")
>
> Suggested-by: Matias Elo <matias.elo@nokia.com>
> Signed-off-by: Harry van Haaren <harry.van.haaren@intel.com>
>
> ---
>
> Cc: stable@dpdk.org
>
> @Matias,
>
> When testing this patch with your provided test case as per attachment
> to bug #60 in Bugzilla, I don't see any events arriving to port 0.
> Hence, I believe this to be the correct behaviour, if you can confirm
> that'd be awesome!
>
I can confirm that this patch fixes the problem also on my system. Thanks!
I can’t remember if I ever saw this problem with ordered queues. At least now they seem to be also working correctly.
Regards,
Matias
^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: [dpdk-stable] [dpdk-dev] [PATCH] event/sw: fix cq idx check for unlink usecases
2018-09-21 12:17 ` Elo, Matias (Nokia - FI/Espoo)
@ 2018-09-23 11:27 ` Jerin Jacob
0 siblings, 0 replies; 3+ messages in thread
From: Jerin Jacob @ 2018-09-23 11:27 UTC (permalink / raw)
To: Elo, Matias (Nokia - FI/Espoo); +Cc: Harry van Haaren, dev, stable
-----Original Message-----
> Date: Fri, 21 Sep 2018 12:17:38 +0000
> From: "Elo, Matias (Nokia - FI/Espoo)" <matias.elo@nokia.com>
> To: Harry van Haaren <harry.van.haaren@intel.com>
> CC: "dev@dpdk.org" <dev@dpdk.org>, "stable@dpdk.org" <stable@dpdk.org>
> Subject: Re: [dpdk-dev] [PATCH] event/sw: fix cq idx check for unlink
> usecases
> x-mailer: Apple Mail (2.3445.9.1)
>
>
> > On 21 Sep 2018, at 13:25, Harry van Haaren <harry.van.haaren@intel.com> wrote:
> >
> > This commit fixes the cq index checks when unlinking
> > ports/queues while the scheduler core is running.
> > Previously, the == comparison could be "skipped" if
> > in particular corner cases. With the check being changed
> > to >= this is resolved as the cq idx gets reset to zero.
> >
> > Bugzilla ID: 60
> > Fixes: 617995dfc5b2 ("event/sw: add scheduling logic")
> >
> > Suggested-by: Matias Elo <matias.elo@nokia.com>
> > Signed-off-by: Harry van Haaren <harry.van.haaren@intel.com>
> >
> > ---
> >
> > Cc: stable@dpdk.org
> >
> > @Matias,
> >
> > When testing this patch with your provided test case as per attachment
> > to bug #60 in Bugzilla, I don't see any events arriving to port 0.
> > Hence, I believe this to be the correct behaviour, if you can confirm
> > that'd be awesome!
> >
>
> I can confirm that this patch fixes the problem also on my system. Thanks!
>
> I can’t remember if I ever saw this problem with ordered queues. At least now they seem to be also working correctly.
>
> Regards,
> Matias
Cc: stable@dpdk.org
Applied to dpdk-next-eventdev/master. Thanks.
>
^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2018-09-23 11:27 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2018-09-21 10:25 [dpdk-stable] [PATCH] event/sw: fix cq idx check for unlink usecases Harry van Haaren
2018-09-21 12:17 ` Elo, Matias (Nokia - FI/Espoo)
2018-09-23 11:27 ` [dpdk-stable] [dpdk-dev] " Jerin Jacob
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).