From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mails.dpdk.org (mails.dpdk.org [217.70.189.124]) by inbox.dpdk.org (Postfix) with ESMTP id A2B4941CB0; Thu, 16 Feb 2023 10:24:20 +0100 (CET) Received: from mails.dpdk.org (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id 90C3940EE3; Thu, 16 Feb 2023 10:24:20 +0100 (CET) Received: from mga02.intel.com (mga02.intel.com [134.134.136.20]) by mails.dpdk.org (Postfix) with ESMTP id 8D62940E0F for ; Thu, 16 Feb 2023 10:24:18 +0100 (CET) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1676539458; x=1708075458; h=date:from:to:cc:subject:message-id:references: in-reply-to:mime-version; bh=U/75M5luOgM/11Y+f2BB10gccz3wwc8Rw3jGlC7sZdQ=; b=BBaeyBa82GZ0sD71xHcDVZkAFHYr0mNlh181oim7uzK0PR1zlrKZb0Ec ReUph7MQvWHYiNVJGob1VywGJsEYaRzmIun6SjRHlKD9LRrB9uUVPtihp LPkxdMBdcYRZbudTXcCBe+hn6Vs3CQp3lM0mapaEKTy9VmdlmHDa5323F VFcdNm6ax/TDMqRJR66xts4YNUV0g4YEYJXHHuw0FvxMuyV0rfDQ21qAR Qu0+Qr1nDkRL0AX9UZ7spvdDD2g8ZaBxkrC/Jy0Qu5fFtiGuBKU98IDdU wkpZ/QbZZYNuKPcCxOvKu6SGgLFO5NZAzv/IwXQm8vJAl25h/FkCTip0a Q==; X-IronPort-AV: E=McAfee;i="6500,9779,10622"; a="319729810" X-IronPort-AV: E=Sophos;i="5.97,302,1669104000"; d="scan'208";a="319729810" Received: from fmsmga001.fm.intel.com ([10.253.24.23]) by orsmga101.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 16 Feb 2023 01:24:17 -0800 X-ExtLoop1: 1 X-IronPort-AV: E=McAfee;i="6500,9779,10622"; a="812895256" X-IronPort-AV: E=Sophos;i="5.97,302,1669104000"; d="scan'208";a="812895256" Received: from orsmsx601.amr.corp.intel.com ([10.22.229.14]) by fmsmga001.fm.intel.com with ESMTP; 16 Feb 2023 01:24:17 -0800 Received: from orsmsx603.amr.corp.intel.com (10.22.229.16) by ORSMSX601.amr.corp.intel.com (10.22.229.14) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2507.16; Thu, 16 Feb 2023 01:24:16 -0800 Received: from orsedg603.ED.cps.intel.com (10.7.248.4) by orsmsx603.amr.corp.intel.com (10.22.229.16) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2507.16 via Frontend Transport; Thu, 16 Feb 2023 01:24:16 -0800 Received: from NAM02-DM3-obe.outbound.protection.outlook.com (104.47.56.47) by edgegateway.intel.com (134.134.137.100) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.1.2507.16; Thu, 16 Feb 2023 01:24:16 -0800 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=e2ZlREgVzvhKYZgMaettcyUB1NejGP1Vik9iQxAAcftxPR9tw+B/XoXKzJN/hUhsdNlBDOc0PvuhdFY43sV3FxoGc/BL5vfRM3KmY/i8AeY5mKKFDFzXFML1qdwAfGAPXCXpjYzJAY5TA1gE0SQh54OaPJWPeDF+v6Go3X8WhJVEry6x0sNCQAMNiMt2p9qtMqToAdi5ojVdrZB8pVlPoHnyjs6+AdMSKWgq6ka+wtGTgAqpjkqdF5Fj4zEttysSdc+ELb1/TYGfX8OKCsU6ckrQuQDozG7Gc9GmxlcjmJ8wsXTTs84ZPev3iSynM7RCfAXNsuIBMxenYDYsM4X0qg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector9901; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-AntiSpam-MessageData-ChunkCount:X-MS-Exchange-AntiSpam-MessageData-0:X-MS-Exchange-AntiSpam-MessageData-1; bh=aoKdcE8y4XKvsQYCH+VVytVJPvv+X0gU/xAclDyB5R8=; b=aj2jCSOBkR9Y83xMnmRtEgQ4NRstk9XhyXPmYVrQjC4RJMxU3bPm90nTkLke2DRO9IrM656GVAHGbUC8Q72WkXsK/PG9JtSZL1w54fe5AflyG5zueYbP3uFFKtcWim2RLMM9KT3WjVoNdlQgj+A09Z1cAsVlkF5F/zsBUBvdzLrJ20kNcOWhTXK715vSOq4gMwVidbVQ0yWVXsJBNGQaOfRPibs6Rtory7LRFp/qLj6r2loza6xVCIZNqmyJI4XFbAKKr6HiNAHC8eF8aZpctquGL1QLY7cNpWxlGSYyL2BkM9uYAQTrYMTtCrWn6HFw3gt7B0tG6E45y8PI0yOkLw== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass smtp.mailfrom=intel.com; dmarc=pass action=none header.from=intel.com; dkim=pass header.d=intel.com; arc=none Authentication-Results: dkim=none (message not signed) header.d=none;dmarc=none action=none header.from=intel.com; Received: from DS0PR11MB7309.namprd11.prod.outlook.com (2603:10b6:8:13e::17) by CO1PR11MB5153.namprd11.prod.outlook.com (2603:10b6:303:95::13) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.6111.13; Thu, 16 Feb 2023 09:24:10 +0000 Received: from DS0PR11MB7309.namprd11.prod.outlook.com ([fe80::aaba:abb7:8794:def]) by DS0PR11MB7309.namprd11.prod.outlook.com ([fe80::aaba:abb7:8794:def%8]) with mapi id 15.20.6086.024; Thu, 16 Feb 2023 09:24:10 +0000 Date: Thu, 16 Feb 2023 09:24:03 +0000 From: Bruce Richardson To: fengchengwen CC: , Kevin Laatz Subject: Re: [PATCH v2 6/6] test/dmadev: add tests for stopping and restarting dev Message-ID: References: <20230116153714.554470-1-bruce.richardson@intel.com> <20230116173738.562322-1-bruce.richardson@intel.com> <20230116173738.562322-7-bruce.richardson@intel.com> Content-Type: text/plain; charset="us-ascii" Content-Disposition: inline In-Reply-To: X-ClientProxiedBy: LO4P123CA0264.GBRP123.PROD.OUTLOOK.COM (2603:10a6:600:194::17) To DS0PR11MB7309.namprd11.prod.outlook.com (2603:10b6:8:13e::17) MIME-Version: 1.0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: DS0PR11MB7309:EE_|CO1PR11MB5153:EE_ X-MS-Office365-Filtering-Correlation-Id: bd55d5ef-3a1b-46aa-1a1f-08db0fff8f2d X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: mBrttQrSbZnAqh0MIgp36WekznXpSvKB7/CnkndLwrYwoDYTYa7judfoxLfWubxuBKll2SF0DdsdBrP3PkTO9wSdmtm2vF4ecQ7CbvjOC4zLLzJUoOCQ+cC7OrRedJIuirC1gzXBwYnYYJ/q0OygY8uuigdNOxDe34xYBpUkvucWnubeHM6K7GwiVUR5Y0LDOKP8zFd6AhScQU6IXObwgfuQ13um0IHEgY0CbivIjbD+FCGfUXoNrrpWJlv4JiB7py6wEropScKkVN0xpFXWXLXkSGnuTp2CFrS6xyA2fK8gniIWpcV9LrpORoRcUB4iHrepOoSH2zzbpAq9sx/H4XX2HUaD7H4J1wdzPpJHI/f1KhkSDGc6sgNAszA6pZWkkI1AIyb21hIr3xA8sTAI5+7dz/iRAxzL078hKiOzmHICMsWDO6kmZsQlQCW3Y6e5Z+ic3ZppU1qOfjbFFnwBNp9qmQwZRfpSi6RKBjX036uMXYwH7eyX8kikBRv/5bfcBEu4mP3HL5vHSE47sKsrVM/uEWf8IErt28spG/dpahrvV3zQYbtapF/b8rcfqoE7jqecL4GV9Bw5tmUGb9xLMeoaMWDr7cv5hRbVgihrpdD7KzuFRT50JohKNxYgz3zSCiF3k3TsgcEo4nkE9SLxDUq0AkqWGEZo5m7nwSflzyyqfddHG7Tqs6dHrijHftok X-Forefront-Antispam-Report: CIP:255.255.255.255; CTRY:; LANG:en; SCL:1; SRV:; IPV:NLI; SFV:NSPM; H:DS0PR11MB7309.namprd11.prod.outlook.com; PTR:; CAT:NONE; SFS:(13230025)(366004)(376002)(396003)(39860400002)(136003)(346002)(451199018)(478600001)(83380400001)(53546011)(6506007)(6666004)(26005)(6512007)(186003)(107886003)(2906002)(6486002)(316002)(5660300002)(4326008)(6916009)(41300700001)(44832011)(8936002)(8676002)(66946007)(66476007)(66556008)(38100700002)(86362001)(82960400001)(67856001); DIR:OUT; SFP:1102; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: =?us-ascii?Q?0np2W95zvVIbTAvYl8u2Sr0wCs5KmAynSwEBfPcHFVY7BuSGzQEDYnl920iY?= =?us-ascii?Q?VXgGxLhFCAnZZe3MJ8n5AMxzgn1NCvFctY6fYv0Yz4QBx9TOu+JNKbisw3fh?= =?us-ascii?Q?tO1G0R4LD/15Oq1bZ0vHuO92+o6McEVRZarFw4rUH65hM6O7c294UrnhP74N?= =?us-ascii?Q?+INeyP9O64z1acmOTrJ2sfFNO7y+sOcaVjCb65aHpfTQqW5iJ/QAHYpBU2cM?= =?us-ascii?Q?uXm9//dX3jxnuUm6PP1Mo+3E4hpP19grAZl+t8TvY8oa6ZgzMmZ37LdKTXge?= =?us-ascii?Q?jk9rZNz0PWDTf4Vn2FLQGTRGctZ8snVBDQiR+YNQULCmMM5RP7oDSYOInA9a?= =?us-ascii?Q?axVcA4BFS4RL44Z+ejI9fGwP3T6z4ntWSrGjXnf4gYjc4nlpPNdI1SdRm4ql?= =?us-ascii?Q?8DniwYOPivxhd98xCQ9SCf3uUFfZCdHFJ83t/T+cRj3LWrNzb79wYt26TnT7?= =?us-ascii?Q?Wmwbi+zOTWavHFUMZoymM2r37dfog1zZVkt1NvCNk0fcMM07NgPDhOtgRSlz?=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NbwOo9B0AMcm3xCTy8OEGujAGajdd5CgmL3m3wYWRbn?= =?us-ascii?Q?KmDDKpTPr1rmUfT1pyCVD8YAgbftba2Jxv4EpfYLkq+VA19J1WTgngSr9FpM?= =?us-ascii?Q?gcGoRhBkvxV8ghB31oEMuN7dcZlXuKFUp5Uf32AveQrEl783l5fOXC/bpCeI?= =?us-ascii?Q?8suGlV3BtJa7jqo5MD2JRvzyhOUzwtmxLnvE149k0xK2/HBRatSyQ2RUocDA?= =?us-ascii?Q?Tg=3D=3D?= X-MS-Exchange-CrossTenant-Network-Message-Id: bd55d5ef-3a1b-46aa-1a1f-08db0fff8f2d X-MS-Exchange-CrossTenant-AuthSource: DS0PR11MB7309.namprd11.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 16 Feb 2023 09:24:09.8576 (UTC) X-MS-Exchange-CrossTenant-FromEntityHeader: Hosted X-MS-Exchange-CrossTenant-Id: 46c98d88-e344-4ed4-8496-4ed7712e255d X-MS-Exchange-CrossTenant-MailboxType: HOSTED X-MS-Exchange-CrossTenant-UserPrincipalName: 2H6OnQgi1whZgG0v8fCZEXFiV4AkTWOwzzF1mbo/Gp26t9G4MKE73tYleMDtrZs4uBqWMnAKQNCWe5iCmfqmfxYysxAwrQUVvbVbPM5u9aA= X-MS-Exchange-Transport-CrossTenantHeadersStamped: CO1PR11MB5153 X-OriginatorOrg: intel.com X-BeenThere: dev@dpdk.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: DPDK patches and discussions List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: dev-bounces@dpdk.org 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 --- > >>> 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