DPDK patches and discussions
 help / color / mirror / Atom feed
From: Bruce Richardson <bruce.richardson@intel.com>
To: fengchengwen <fengchengwen@huawei.com>
Cc: <dev@dpdk.org>, Kevin Laatz <kevin.laatz@intel.com>
Subject: Re: [PATCH v2 6/6] test/dmadev: add tests for stopping and restarting dev
Date: Thu, 16 Feb 2023 09:24:03 +0000	[thread overview]
Message-ID: <Y+32M6JIasHV2WPj@bricha3-MOBL.ger.corp.intel.com> (raw)
In-Reply-To: <bfb74bca-e692-fbe1-20ec-3129dc95b024@huawei.com>

On Thu, Feb 16, 2023 at 09:24:38AM +0800, fengchengwen wrote:
> On 2023/2/15 19:57, Bruce Richardson wrote:
> > On Wed, Feb 15, 2023 at 09:59:06AM +0800, fengchengwen wrote:
> >> On 2023/1/17 1:37, Bruce Richardson wrote:
> >>> Validate device operation when a device is stopped or restarted.
> >>>
> >>> The only complication - and gap in the dmadev ABI specification - is
> >>> what happens to the job ids on restart. Some drivers reset them to 0,
> >>> while others continue where things left off. Take account of both
> >>> possibilities in the test case.
> >>>
> >>> Signed-off-by: Bruce Richardson <bruce.richardson@intel.com> ---
> >>> app/test/test_dmadev.c | 46 ++++++++++++++++++++++++++++++++++++++++++
> >>> 1 file changed, 46 insertions(+)
> >>>
> >>> diff --git a/app/test/test_dmadev.c b/app/test/test_dmadev.c index
> >>> de787c14e2..8fb73a41e2 100644 --- a/app/test/test_dmadev.c +++
> >>> b/app/test/test_dmadev.c @@ -304,6 +304,48 @@
> >>> test_enqueue_copies(int16_t dev_id, uint16_t vchan) ||
> >>> do_multi_copies(dev_id, vchan, 0, 0, 1); }
> >>>  
> >>> +static int +test_stop_start(int16_t dev_id, uint16_t vchan) +{ +	/*
> >>> device is already started on input, should be (re)started on output */
> >>> + +	uint16_t id = 0; +	enum rte_dma_status_code status =
> >>> RTE_DMA_STATUS_SUCCESSFUL; + +	/* - test stopping a device works
> >>> ok, +	 * - then do a start-stop without doing a copy +	 *
> >>> - finally restart the device +	 * checking for errors at each
> >>> stage, and validating we can still copy at the end.  +	 */ +	if
> >>> (rte_dma_stop(dev_id) < 0) +		ERR_RETURN("Error stopping
> >>> device\n"); + +	if (rte_dma_start(dev_id) < 0) +
> >>> ERR_RETURN("Error restarting device\n"); +	if (rte_dma_stop(dev_id) <
> >>> 0) +		ERR_RETURN("Error stopping device after restart (no
> >>> jobs executed)\n"); + +	if (rte_dma_start(dev_id) < 0) +
> >>> ERR_RETURN("Error restarting device after multiple stop-starts\n"); + +
> >>> /* before doing a copy, we need to know what the next id will be it
> >>> should +	 * either be: +	 * - the last completed job before start if
> >>> driver does not reset id on stop +	 * - or -1 i.e. next job is 0, if
> >>> driver does reset the job ids on stop +	 */ +	if
> >>> (rte_dma_completed_status(dev_id, vchan, 1, &id, &status) != 0) +
> >>> ERR_RETURN("Error with rte_dma_completed_status when no job done\n"); +
> >>> id += 1; /* id_count is next job id */ +	if (id != id_count && id !=
> >>> 0) +		ERR_RETURN("Unexpected next id from device after
> >>> stop-start. Got %u, expected %u or 0\n", +				id,
> >>> id_count);
> >>
> >> Hi Bruce,
> >>
> >> Suggest add a warn LOG to identify the id was not reset zero.  So that
> >> new driver could detect break ABI specification.
> >>
> > Not sure that that is necessary. The actual ABI, nor the doxygen docs,
> > doesn't specify what happens to the values on doing stop and then start. My
> > thinking was that it should continue numbering as it would be equivalent to
> > suspend and resume, but other drivers appear to treat it as a "reset". I
> > suspect there are advantages and disadvantages to both schemes. Until we
> > decide on what the correct behaviour should be - or decide to allow both -
> > I don't think warning is the right thing to do here.
> 
> In this point, agree to upstream this patch first, and then discuss the correct
> behavior should be for restart scenario.
> 
+1. Thanks.

With this patch in place we will also be better able to help drivers
enforce the correct behaviour once we define it.

I'll do v3 keeping this as-is for now.

/Bruce

  reply	other threads:[~2023-02-16  9:24 UTC|newest]

Thread overview: 43+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-01-16 15:37 [PATCH 0/5] dma/ioat: fix issues with stopping and restarting device Bruce Richardson
2023-01-16 15:37 ` [PATCH 1/5] dma/ioat: fix device stop if no copies done Bruce Richardson
2023-01-16 15:37 ` [PATCH 2/5] dma/ioat: fix incorrectly set indexes after restart Bruce Richardson
2023-01-16 15:37 ` [PATCH 3/5] test/dmadev: check result for device stop Bruce Richardson
2023-01-16 15:37 ` [PATCH 4/5] test/dmadev: create separate function for single copy test Bruce Richardson
2023-01-16 15:37 ` [PATCH 5/5] test/dmadev: add tests for stopping and restarting dev Bruce Richardson
2023-01-16 16:09 ` [PATCH 0/5] dma/ioat: fix issues with stopping and restarting device Walsh, Conor
2023-01-16 16:38   ` Bruce Richardson
2023-01-16 17:37 ` [PATCH v2 0/6] " Bruce Richardson
2023-01-16 17:37   ` [PATCH v2 1/6] dma/ioat: fix device stop if no copies done Bruce Richardson
2023-01-18 10:47     ` Walsh, Conor
2023-02-14 16:04     ` Kevin Laatz
2023-01-16 17:37   ` [PATCH v2 2/6] dma/ioat: fix incorrectly set indexes after restart Bruce Richardson
2023-01-18 10:47     ` Walsh, Conor
2023-02-14 16:04     ` Kevin Laatz
2023-01-16 17:37   ` [PATCH v2 3/6] dma/ioat: fix incorrect error reporting on restart Bruce Richardson
2023-01-18 10:47     ` Walsh, Conor
2023-02-14 16:04     ` Kevin Laatz
2023-01-16 17:37   ` [PATCH v2 4/6] test/dmadev: check result for device stop Bruce Richardson
2023-01-18 10:47     ` Walsh, Conor
2023-02-02 11:12     ` David Marchand
2023-02-14 16:04     ` Kevin Laatz
2023-02-15  1:26     ` fengchengwen
2023-02-15 11:58       ` Bruce Richardson
2023-01-16 17:37   ` [PATCH v2 5/6] test/dmadev: create separate function for single copy test Bruce Richardson
2023-02-14 16:04     ` Kevin Laatz
2023-02-15  1:28     ` fengchengwen
2023-01-16 17:37   ` [PATCH v2 6/6] test/dmadev: add tests for stopping and restarting dev Bruce Richardson
2023-02-14 16:04     ` Kevin Laatz
2023-02-15  1:59     ` fengchengwen
2023-02-15 11:57       ` Bruce Richardson
2023-02-16  1:24         ` fengchengwen
2023-02-16  9:24           ` Bruce Richardson [this message]
2023-02-16 11:09 ` [PATCH v3 0/6] dma/ioat: fix issues with stopping and restarting device Bruce Richardson
2023-02-16 11:09   ` [PATCH v3 1/6] dma/ioat: fix device stop if no copies done Bruce Richardson
2023-02-16 11:09   ` [PATCH v3 2/6] dma/ioat: fix incorrectly set indexes after restart Bruce Richardson
2023-02-16 11:09   ` [PATCH v3 3/6] dma/ioat: fix incorrect error reporting on restart Bruce Richardson
2023-02-16 11:09   ` [PATCH v3 4/6] test/dmadev: check result for device stop Bruce Richardson
2023-02-16 11:41     ` fengchengwen
2023-02-16 11:09   ` [PATCH v3 5/6] test/dmadev: create separate function for single copy test Bruce Richardson
2023-02-16 11:09   ` [PATCH v3 6/6] test/dmadev: add tests for stopping and restarting dev Bruce Richardson
2023-02-16 11:42     ` fengchengwen
2023-02-19 23:11   ` [PATCH v3 0/6] dma/ioat: fix issues with stopping and restarting device Thomas Monjalon

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=Y+32M6JIasHV2WPj@bricha3-MOBL.ger.corp.intel.com \
    --to=bruce.richardson@intel.com \
    --cc=dev@dpdk.org \
    --cc=fengchengwen@huawei.com \
    --cc=kevin.laatz@intel.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).