All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH] event/sw: fix credit return on invalid queue id
@ 2017-04-18  9:58 Harry van Haaren
  2017-04-18 10:11 ` Hunt, David
  0 siblings, 1 reply; 3+ messages in thread
From: Harry van Haaren @ 2017-04-18  9:58 UTC (permalink / raw)
  To: dev; +Cc: Harry van Haaren

This patch returns a credit when an rte_event is
enqueued with an invalid queue_id. Previously a
credit was leaked from the system.

Note that the eventdev instance does not attempt
to free any resources that the rte_event owns. As
a result, resources owned by the rte_event are leaked.
Eg. if the rte_event represents an rte_mbuf, the mbuf
will not be freed, and causes a leak from the mempool.

Fixes: 656af9180014 ("event/sw: add worker core functions")

Signed-off-by: Harry van Haaren <harry.van.haaren@intel.com>
---
 drivers/event/sw/sw_evdev_worker.c | 7 +++++--
 1 file changed, 5 insertions(+), 2 deletions(-)

diff --git a/drivers/event/sw/sw_evdev_worker.c b/drivers/event/sw/sw_evdev_worker.c
index b9b6f8d..9cb6bef 100644
--- a/drivers/event/sw/sw_evdev_worker.c
+++ b/drivers/event/sw/sw_evdev_worker.c
@@ -105,9 +105,12 @@ sw_event_enqueue_burst(void *port, const struct rte_event ev[], uint16_t num)
 		 */
 		if ((new_ops[i] & QE_FLAG_COMPLETE) && outstanding)
 			p->outstanding_releases--;
-		/* Branch to avoid touching p->stats except error case */
-		if (unlikely(invalid_qid))
+
+		/* error case: branch to avoid touching p->stats */
+		if (unlikely(invalid_qid)) {
 			p->stats.rx_dropped++;
+			p->inflight_credits++;
+		}
 	}
 
 	/* returns number of events actually enqueued */
-- 
2.7.4

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

* Re: [PATCH] event/sw: fix credit return on invalid queue id
  2017-04-18  9:58 [PATCH] event/sw: fix credit return on invalid queue id Harry van Haaren
@ 2017-04-18 10:11 ` Hunt, David
  2017-04-19 22:27   ` Thomas Monjalon
  0 siblings, 1 reply; 3+ messages in thread
From: Hunt, David @ 2017-04-18 10:11 UTC (permalink / raw)
  To: Harry van Haaren, dev


On 18/4/2017 10:58 AM, Harry van Haaren wrote:
> This patch returns a credit when an rte_event is
> enqueued with an invalid queue_id. Previously a
> credit was leaked from the system.
>
> Note that the eventdev instance does not attempt
> to free any resources that the rte_event owns. As
> a result, resources owned by the rte_event are leaked.
> Eg. if the rte_event represents an rte_mbuf, the mbuf
> will not be freed, and causes a leak from the mempool.
>
> Fixes: 656af9180014 ("event/sw: add worker core functions")
>
> Signed-off-by: Harry van Haaren <harry.van.haaren@intel.com>
> ---
>   drivers/event/sw/sw_evdev_worker.c | 7 +++++--
>   1 file changed, 5 insertions(+), 2 deletions(-)
>
> diff --git a/drivers/event/sw/sw_evdev_worker.c b/drivers/event/sw/sw_evdev_worker.c
> index b9b6f8d..9cb6bef 100644
> --- a/drivers/event/sw/sw_evdev_worker.c
> +++ b/drivers/event/sw/sw_evdev_worker.c
> @@ -105,9 +105,12 @@ sw_event_enqueue_burst(void *port, const struct rte_event ev[], uint16_t num)
>   		 */
>   		if ((new_ops[i] & QE_FLAG_COMPLETE) && outstanding)
>   			p->outstanding_releases--;
> -		/* Branch to avoid touching p->stats except error case */
> -		if (unlikely(invalid_qid))
> +
> +		/* error case: branch to avoid touching p->stats */
> +		if (unlikely(invalid_qid)) {
>   			p->stats.rx_dropped++;
> +			p->inflight_credits++;
> +		}
>   	}
>   
>   	/* returns number of events actually enqueued */

Acked-by: David Hunt <david.hunt@intel.com>

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

* Re: [PATCH] event/sw: fix credit return on invalid queue id
  2017-04-18 10:11 ` Hunt, David
@ 2017-04-19 22:27   ` Thomas Monjalon
  0 siblings, 0 replies; 3+ messages in thread
From: Thomas Monjalon @ 2017-04-19 22:27 UTC (permalink / raw)
  To: Harry van Haaren; +Cc: dev, Hunt, David

18/04/2017 12:11, Hunt, David:
> On 18/4/2017 10:58 AM, Harry van Haaren wrote:
> > This patch returns a credit when an rte_event is
> > enqueued with an invalid queue_id. Previously a
> > credit was leaked from the system.
> > 
> > Note that the eventdev instance does not attempt
> > to free any resources that the rte_event owns. As
> > a result, resources owned by the rte_event are leaked.
> > Eg. if the rte_event represents an rte_mbuf, the mbuf
> > will not be freed, and causes a leak from the mempool.
> > 
> > Fixes: 656af9180014 ("event/sw: add worker core functions")
> > 
> > Signed-off-by: Harry van Haaren <harry.van.haaren@intel.com>
> 
> Acked-by: David Hunt <david.hunt@intel.com>

Applied, thanks

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

end of thread, other threads:[~2017-04-19 22:27 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2017-04-18  9:58 [PATCH] event/sw: fix credit return on invalid queue id Harry van Haaren
2017-04-18 10:11 ` Hunt, David
2017-04-19 22:27   ` Thomas Monjalon

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.