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 53A6F432D3 for ; Mon, 13 Nov 2023 12:11:31 +0100 (CET) Received: from mails.dpdk.org (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id 297904026C; Mon, 13 Nov 2023 12:11:31 +0100 (CET) Received: from mgamail.intel.com (mgamail.intel.com [134.134.136.65]) by mails.dpdk.org (Postfix) with ESMTP id 767944021F; Mon, 13 Nov 2023 12:11:29 +0100 (CET) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1699873889; x=1731409889; h=date:from:to:cc:subject:message-id:references: in-reply-to:mime-version; bh=0fnlbEKmeJ3hNoqoyPoV33nWH33OBR4WEqmPysLGvDQ=; b=Wtlf94TZ4UDILIjBmjfM//D6d2YVOn+wCKiPN45QkNBzNd85y0cUvgYp s0PhOV9/OkAbMI3ISSBh4YmkbbPJ8BgAf3jMHjHQPjcQqodTzDwUJqWca PY7TMsXBaIKzQJWxLRKAJkeWjNuba30ga3Lfnp8F77nLplE4T/mqRNzzL 6qSF6Lgd4mei1mKT9tp2ML8vLTg5GfA3RFUvTMu6+ErIX8NcSa9iWaCik EneCM0+7tx6gBTr60h1YiaIEh/14NPiqXvzgiuIPzNQwtNj8VVZdkogU6 PTDu4fLVhrsWWSfaj+LbBzl6AyjJ+L+mgeMHEMHnEXA3PRgJa91zbE4Pm A==; X-IronPort-AV: E=McAfee;i="6600,9927,10892"; a="394315276" X-IronPort-AV: E=Sophos;i="6.03,299,1694761200"; d="scan'208";a="394315276" Received: from fmsmga003.fm.intel.com ([10.253.24.29]) by orsmga103.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 13 Nov 2023 03:11:28 -0800 X-ExtLoop1: 1 X-IronPort-AV: E=McAfee;i="6600,9927,10892"; a="854935721" X-IronPort-AV: E=Sophos;i="6.03,299,1694761200"; d="scan'208";a="854935721" Received: from fmsmsx601.amr.corp.intel.com ([10.18.126.81]) by FMSMGA003.fm.intel.com with ESMTP/TLS/AES256-GCM-SHA384; 13 Nov 2023 03:11:26 -0800 Received: from fmsmsx612.amr.corp.intel.com (10.18.126.92) by fmsmsx601.amr.corp.intel.com (10.18.126.81) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2507.34; Mon, 13 Nov 2023 03:11:26 -0800 Received: from fmsmsx610.amr.corp.intel.com (10.18.126.90) by fmsmsx612.amr.corp.intel.com (10.18.126.92) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2507.34; Mon, 13 Nov 2023 03:11:26 -0800 Received: from fmsedg601.ED.cps.intel.com (10.1.192.135) by fmsmsx610.amr.corp.intel.com (10.18.126.90) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2507.34 via Frontend Transport; Mon, 13 Nov 2023 03:11:26 -0800 Received: from NAM12-DM6-obe.outbound.protection.outlook.com (104.47.59.169) by edgegateway.intel.com (192.55.55.70) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.1.2507.34; Mon, 13 Nov 2023 03:11:25 -0800 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=ZekRIGjDQ4NurojctpiHakBIWLJsOGk8xPIPV4keaB6+kyeb//LWPfaVJQY5xx2Jt3he+BdxuwJ6Yxh/RC4C8rToqXujgNmh4Z4k27kRPBE+gkt8HNLo6NPecUN9Uc5Bi0QVtCMDZZ6tm68VBYOCVayjsQiR4OeQ/UwpLCvqHHuxB0duNXg35agtLkoWMl5cpSr0xPZFp+NsEVQ1l4HnXhYZuj3wF0O/b/MX0rY1OrZmCba2Aloa/SlkdJr0UGhzHv5mqv4gvmtDsDZAETy0siOkko5E42jMgrT6heSfBXvkKRe0AbFpj97vdQNmqC9AU1OB5tlIOvnDZ1rjXYCxTQ== 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=0z4lbY06/Khdw/NiEDNE2mfHrY3tEvFjToGJcF7BTr4=; b=mJLju85LtV00/BWRffDjq7WsI+9R01OlAU9ris10CZwd0p4nK+/mH4i0H1WEOVO1muN0Gbisc0jR8LFrxym7gW9X5Gz3tUZoGiOxqHKlQKIH9AjS+FI2kkVbQh9NJN4ooAf4nRDvDOke8t07danBngVFNK1RmB/wrCFzc3W9nO28pkL/mGP3ykOCg6YpYi7iuzZNj+S6mj8rM5AKjRhcS7Z+0ZQyYYyJI3tBrCWSQZgr3Us38t9OXrF4nysGGZbLRLtnZZnelcvvyYn5FqYtsaEBohZZyQfbtZWthP3lgvRNV2MSOv5AZjx99kc8UHWzj4mWZfo6NRlXzN0Ab8socw== 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 DM4PR11MB5993.namprd11.prod.outlook.com (2603:10b6:8:5c::19) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.6977.29; Mon, 13 Nov 2023 11:11:24 +0000 Received: from DS0PR11MB7309.namprd11.prod.outlook.com ([fe80::8645:d921:ce8a:12ba]) by DS0PR11MB7309.namprd11.prod.outlook.com ([fe80::8645:d921:ce8a:12ba%5]) with mapi id 15.20.6977.029; Mon, 13 Nov 2023 11:11:24 +0000 Date: Mon, 13 Nov 2023 11:11:19 +0000 From: Bruce Richardson To: Mingjin Ye CC: , , Subject: Re: [PATCH v6] app/test: secondary process passes allow parameters Message-ID: References: <20231110103013.469430-1-mingjinx.ye@intel.com> <20231113104222.85891-1-mingjinx.ye@intel.com> Content-Type: text/plain; charset="us-ascii" Content-Disposition: inline In-Reply-To: <20231113104222.85891-1-mingjinx.ye@intel.com> X-ClientProxiedBy: DB3PR08CA0008.eurprd08.prod.outlook.com (2603:10a6:8::21) To DS0PR11MB7309.namprd11.prod.outlook.com (2603:10b6:8:13e::17) MIME-Version: 1.0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: DS0PR11MB7309:EE_|DM4PR11MB5993:EE_ X-MS-Office365-Filtering-Correlation-Id: d0605903-1add-420a-47e3-08dbe43945cb X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: 9WOyGrc7fCqj46a/KeDfHKbH8HyN7QR9sHUwop4ghR9CwyWSe7nLSJNiSHY50wNt+3NKfCNHnntL5ZmR6fKP68WatLqQuKW29w6S9OZgpjPEy8TYDyvHfl1kGTSjEwqwFgr7AXT2QDNFC/ZwH5AXMWgtZhOx76pPb2AneuhVD61fhlYt0so3Vx6lyksA4r/rp9GGk2Irp5f3IMRUUWR0gooIkjrt1WNVK4ONgRczLCKTPGO38Tw4mPKq2x0Euga0dBw/UVL+JWf8AHJybEEgE7kNUk7hD6w9PU152y8rpbBDAViSidUA0OWF/KKi8p6pAC/yLmsn/g4Y0MPgs7Aed6+BYpnLX6fIMYTGzH8X6UqFDJiQZ44/sRNSwvCiIwgeck6GkB2atCRMiegGXyDBs2dyW9NVgRioY4TVcSmUHPhwT42cFR3CxNzdIAUCZclgeWmh44mmpTpP97zR2wWxakZX1pv8BKYRIDV6PM040UNgjzQ17ZoOaUD8na+XpnkhD3CICJqXrdCWag84FCFnPM/1/59cKW/j0dEVXX4sdZl9Km0Eiu8VWL8VtF4gtNDq 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:(13230031)(396003)(136003)(366004)(376002)(39860400002)(346002)(230922051799003)(451199024)(1800799009)(186009)(64100799003)(26005)(6666004)(6506007)(6512007)(83380400001)(44832011)(5660300002)(4326008)(6862004)(8676002)(8936002)(41300700001)(2906002)(450100002)(6486002)(478600001)(316002)(66476007)(66556008)(66946007)(82960400001)(86362001)(6636002)(38100700002); DIR:OUT; SFP:1102; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: =?us-ascii?Q?bboskQKMywWsAmrDJjAZWDag6VvpaJpNd9Bn4vonsMguCHnNBnVtRHSFuwGI?= =?us-ascii?Q?LJEzo5j7cDMTL62qZg/qsaNmx5i52S3ZUSaJ9ek74kzIASsk+R4mt6J7Ijvb?= =?us-ascii?Q?Q9E8UQINw7kNiECV3XGYAvr5FNJ+We1zFtm9H218ry8Rwnq9Mzv4GThKFugh?= =?us-ascii?Q?IiRgsbw8HmLZsll347768am/POe907YQLrkQyRKAVv1ZwOFKZJBfrYg/lAIv?= =?us-ascii?Q?i0aiR4OywahJdYMNj9p9lUldf/lizMMJyjE3KahItyfqJXaIYxaO0LQc+B4x?= =?us-ascii?Q?JbHD14pdFh1+GdK8r834so5VuqpjahCDlLERDRX1AfqGMIps+/8roHHt0/Rm?= =?us-ascii?Q?9AB0AG1ME5H88VGkjjsPjeXYe8qPmSUUqCrOxyWSMLHoqBDj6prbNXC1IN2P?= =?us-ascii?Q?7iSl4m7ISv3ObQYbWkN7jCNdFypCl+GFjsy6cOyQSyo8WUD2AefXUX3a0X3L?= =?us-ascii?Q?3JH1EdWb8zXhC9bCDyf7SJ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O/NtB+3AYK1omj7W8qv204qu40EO4s8yYs2gRwPdG+b+pinDOdOG8?= =?us-ascii?Q?QHsmCd1lmeToKpHZM5MrYC4+rxPwX1SAP1Wa+VrX/uT6MVt2u2ZYheranyY9?= =?us-ascii?Q?Zsh+47lNZeeJg+d8OMtfhqRKtEOp/W9rI5v2W1wn+NCCUqQnEzmgXmeMquha?= =?us-ascii?Q?2Eb7SUgOpyg8D84gd49vtqx8TKr92XALBpd63CWTZdSE1Eb023Ukv9ufz1VK?= =?us-ascii?Q?8Q=3D=3D?= X-MS-Exchange-CrossTenant-Network-Message-Id: d0605903-1add-420a-47e3-08dbe43945cb X-MS-Exchange-CrossTenant-AuthSource: DS0PR11MB7309.namprd11.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 13 Nov 2023 11:11:24.0248 (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: 44NlLOjUpnV8Dvb8A612Apw+15bQjvkCU7HvV2Llih9JNtTKaifr2KDHnkbGW9SePXT1hxBwDiXQ5npZRnDESX1QYV7SNrJEMjFoYOdesUs= X-MS-Exchange-Transport-CrossTenantHeadersStamped: DM4PR11MB5993 X-OriginatorOrg: intel.com X-BeenThere: stable@dpdk.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: patches for DPDK stable branches List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: stable-bounces@dpdk.org On Mon, Nov 13, 2023 at 10:42:22AM +0000, Mingjin Ye wrote: > In EAL related test cases, the allow parameters are not passed to > the secondary process, resulting in unexpected NICs being loaded. > > This patch fixes this issue by appending the allow parameters to > the secondary process. > > Fixes: af75078fece3 ("first public release") > Cc: stable@dpdk.org > > Signed-off-by: Mingjin Ye Acked-by: Bruce Richardson > --- > v5: Optimized. > --- > v6: Optimized. > --- > app/test/process.h | 52 +++++++++++++++++++++++++++++++++++++++++++--- > 1 file changed, 49 insertions(+), 3 deletions(-) > > diff --git a/app/test/process.h b/app/test/process.h > index af7bc3e0de..cd3603b7bb 100644 > --- a/app/test/process.h > +++ b/app/test/process.h > @@ -18,6 +18,8 @@ > > #include /* strlcpy */ > > +#include > + > #ifdef RTE_EXEC_ENV_FREEBSD > #define self "curproc" > #define exe "file" > @@ -34,6 +36,34 @@ extern uint16_t flag_for_send_pkts; > #endif > #endif > > +#define PREFIX_ALLOW "--allow=" > + > +static int > +add_parameter_allow(char **argv, int max_capacity) > +{ > + struct rte_devargs *devargs; > + int count = 0; > + > + RTE_EAL_DEVARGS_FOREACH(NULL, devargs) { > + if (strlen(devargs->name) == 0) > + continue; > + > + if (strlen(devargs->data) == 0) { > + if (asprintf(&argv[count], PREFIX_ALLOW"%s", devargs->name) < 0) > + break; > + } else { > + if (asprintf(&argv[count], PREFIX_ALLOW"%s,%s", > + devargs->name, devargs->data) < 0) > + break; > + } > + > + if (++count == max_capacity) > + break; > + } > + > + return count; > +} > + > /* > * launches a second copy of the test process using the given argv parameters, > * which should include argv[0] as the process name. To identify in the > @@ -44,7 +74,9 @@ static inline int > process_dup(const char *const argv[], int numargs, const char *env_value) > { > int num; > - char *argv_cpy[numargs + 1]; > + char **argv_cpy; > + int allow_num; > + int argv_num; > int i, status; > char path[32]; > #ifdef RTE_LIB_PDUMP > @@ -58,12 +90,21 @@ process_dup(const char *const argv[], int numargs, const char *env_value) > if (pid < 0) > return -1; > else if (pid == 0) { > + allow_num = rte_devargs_type_count(RTE_DEVTYPE_ALLOWED); > + argv_num = numargs + allow_num + 1; > + argv_cpy = malloc(argv_num * sizeof(char *)); > + if (!argv_cpy) > + rte_panic("Memory allocation failed\n"); > + > /* make a copy of the arguments to be passed to exec */ > for (i = 0; i < numargs; i++) > argv_cpy[i] = strdup(argv[i]); > - argv_cpy[i] = NULL; > - num = numargs; > + num = add_parameter_allow(&argv_cpy[i], allow_num); > + if (num != allow_num) > + rte_panic("Fill allow parameter incomplete\n"); > > + num += numargs; > + argv_cpy[argv_num - 1] = NULL; > #ifdef RTE_EXEC_ENV_LINUX > { > const char *procdir = "/proc/" self "/fd/"; > @@ -131,6 +172,11 @@ process_dup(const char *const argv[], int numargs, const char *env_value) > } > rte_panic("Cannot exec: %s\n", strerror(errno)); > } > + > + for (i = 0; i < num; i++) > + free(argv_cpy[i]); > + > + free(argv_cpy); > } > /* parent process does a wait */ > #ifdef RTE_LIB_PDUMP > -- > 2.25.1 >