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 BB789A00C3; Mon, 31 Jan 2022 17:13:52 +0100 (CET) Received: from [217.70.189.124] (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id 44543411DD; Mon, 31 Jan 2022 17:13:52 +0100 (CET) Received: from mga09.intel.com (mga09.intel.com [134.134.136.24]) by mails.dpdk.org (Postfix) with ESMTP id 61DBF411C9 for ; Mon, 31 Jan 2022 17:13:50 +0100 (CET) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1643645630; x=1675181630; h=message-id:date:to:cc:references:from:subject: in-reply-to:content-transfer-encoding:mime-version; bh=0fuZ+cCxj//87wnoEewm+iNonDjZFhBEYBpNOp75nVU=; b=fBVq/+DYyZ2V+z3IL/PHVyXVRBKYPKaZvXAEVXBkrnCnrPf2D2tTvG+N Bq8HEXe89WEObR2JrryQO+YcJdQfQ+PaYMCxmmC/x4Ms+dYvcN3LcTe2N hu+NvJu4oJZC3gAuON/TMTooalRH6cjMlEd342xHcBOjs5+mmStkkhlNT wu6Az2b9Y4Qy2yiXRErUBMKeid7JxdLtxZel/37+x0MQH614A3ODt7YSh gOhClA1NTSZuDZgthM43vPSPbCYSfmE10RL8jL4zvXooOPXdU2dD5DA82 XFWI/KFjlAcZRM1AwP5aj+NuEbnaCKrOVCk72kAxY3Vy1roRhxep+1Z0L w==; X-IronPort-AV: E=McAfee;i="6200,9189,10244"; a="247263134" X-IronPort-AV: E=Sophos;i="5.88,331,1635231600"; d="scan'208";a="247263134" Received: from fmsmga001.fm.intel.com ([10.253.24.23]) by orsmga102.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 31 Jan 2022 08:13:44 -0800 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.88,331,1635231600"; d="scan'208";a="675774213" Received: from orsmsx606.amr.corp.intel.com ([10.22.229.19]) by fmsmga001.fm.intel.com with ESMTP; 31 Jan 2022 08:13:44 -0800 Received: from orsmsx609.amr.corp.intel.com (10.22.229.22) by ORSMSX606.amr.corp.intel.com (10.22.229.19) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2308.20; Mon, 31 Jan 2022 08:13:43 -0800 Received: from orsmsx604.amr.corp.intel.com (10.22.229.17) by ORSMSX609.amr.corp.intel.com (10.22.229.22) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2308.20; Mon, 31 Jan 2022 08:13:43 -0800 Received: from ORSEDG602.ED.cps.intel.com (10.7.248.7) by orsmsx604.amr.corp.intel.com (10.22.229.17) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2308.20 via Frontend Transport; Mon, 31 Jan 2022 08:13:43 -0800 Received: from NAM12-MW2-obe.outbound.protection.outlook.com (104.47.66.41) by edgegateway.intel.com (134.134.137.103) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.1.2308.20; Mon, 31 Jan 2022 08:13:42 -0800 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=oC9B6ivKQP4c72f5vYSQnlytUEMB6zopZEnX8KL+ODgihNv0guutVCnX09Tu1O4p4QJDuBK4y2ML5Ki5ChWPFBz97B3t92tmxiDo8wT43EZE67C1FWBV4UNh0x3zNPUCCmRQF5PT+D/oM94uNvkrq+s9ff4Pi3bbwsuKrUUqIwYRZQcdDZfnwvSi/2J36a4ebmeJ5eB3BcGBqgjWdiLFDpup51X8S5/m66IYJLuCkIJbEXlSv2yYDqiq7qu2StKkk/2YDuOaB50SfFj1hIh4UTmTYB00lL0tLLK4RC6omAdPMWexyFxhjf/g7OngOYVE39MQPrP+sQczxCmSayiohg== 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=gfxM/iohcrNoHtVdh5B8Wdfz7IKMZvJrncqcmZpemzA=; b=c3pOALOikI2NEFSAdBqObrNpjDPApv5cTLQ3c7yiX6eG7HK1+yFEFl8FMeFCVgOw5MYFfC7aUABK/VQJEVIcOjqnw5pjR1Ny9GB25VdbiaAdPimGXexZ9azofhv2+aLGySGSpZvXj/aKUHc4ddSYLLW7qNveyz3MwmcQii3piyUFALaDQhlybsK+jYU58L7iJ7df8mIbqVzPn9JZGD1EOAYQX3q8tdh5zS/9FVtGhrlAiQgQbVy1zOIQuzdwNjecbfRteMBVlG7I0uNppF6Tgm+/Wii5RfosU3WOZi0FgFWgNj3ve++iCqNkPaL079JaniMhMaoXzx/QjN2rfsLE0g== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=none; dmarc=none; dkim=none; arc=none Authentication-Results: dkim=none (message not signed) header.d=none;dmarc=none action=none header.from=intel.com; Received: from PH0PR11MB5000.namprd11.prod.outlook.com (2603:10b6:510:41::19) by DM5PR11MB0043.namprd11.prod.outlook.com (2603:10b6:4:69::17) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.4930.15; Mon, 31 Jan 2022 16:13:40 +0000 Received: from PH0PR11MB5000.namprd11.prod.outlook.com ([fe80::5046:8550:928d:850e]) by PH0PR11MB5000.namprd11.prod.outlook.com ([fe80::5046:8550:928d:850e%7]) with mapi id 15.20.4930.022; Mon, 31 Jan 2022 16:13:40 +0000 Message-ID: Date: Mon, 31 Jan 2022 16:13:35 +0000 Content-Language: en-US To: "Min Hu (Connor)" , CC: , References: <20220128023519.10027-1-humin29@huawei.com> From: Ferruh Yigit Subject: Re: [PATCH] app/testpmd: fix bonding mode set X-User: ferruhy In-Reply-To: <20220128023519.10027-1-humin29@huawei.com> Content-Type: text/plain; charset="UTF-8"; format=flowed Content-Transfer-Encoding: 7bit X-ClientProxiedBy: LNXP265CA0041.GBRP265.PROD.OUTLOOK.COM (2603:10a6:600:5c::29) To PH0PR11MB5000.namprd11.prod.outlook.com (2603:10b6:510:41::19) MIME-Version: 1.0 X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-Correlation-Id: 076f3961-3cd4-4bc3-1da7-08d9e4d4a508 X-MS-TrafficTypeDiagnostic: DM5PR11MB0043:EE_ X-Microsoft-Antispam-PRVS: X-MS-Oob-TLC-OOBClassifiers: OLM:288; X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: hH9ufeVAMe4XY4NI9Tep6h8ePVPQw1jmCVdcO3AzPdqAPc6VEDG4/A7qzHgKVUtxD08TXeaF3pK9LVIa8HAqyJm14es6WDE8agne11za/bw9rM1GI2vr/xq5/6jZYXS1ue6jWoCiXuXgCaBPRSffV5HK9LFxj0zAcn+cokuqWBE63f62e8mFXJhSGKFW/nQ8sF++DpsCaSFt+62frP1GtiN+pBWZIve8xaaZdRSp1BkaNDEEMaH33ENKFX0imszLEW93FKyAvnW4v5G8pFoGQeJptNaIn4ITKP9Mgr4ooN0sUbUUvSepM9mFx7nQ3g3ywxPlD4PmJN/w4a9BndvGAtLlWEz69tCC4koYoLY6FAisQ27LFQpQoVxny/KOr7Y30fXHwQgALL/eIt4AgBbsImKSJ0ZlwhbgOAe5/I2yWanWhizrGAi7coeRt+PyI1WvzGhjVhJSoDszOOXVM/sJJFWdFSshnG98/hihLq9MMNe1p7kyoeVNSub7i7OmlnarjtroiQFjKjJ/2jUD8IbktCWXIw3xcTJkFhyZ/63R6ZDHRtPZueBHdTuD/qoDxvTLL+PDXsd15LQ0I743GV5G+lHaudkc6pictsNeucm/Im4sql6YVBsEr2Eh7FXURICHB4Bb6ZApJDvGF4r/1Boy7q2LTXQcoCJFFLmVnbFu4yozsJMu/0fBrKl0r3fhxd1HWfBCka99G4DGQ2TfhwD50A== X-Forefront-Antispam-Report: CIP:255.255.255.255; CTRY:; LANG:en; SCL:1; SRV:; IPV:NLI; SFV:NSPM; H:PH0PR11MB5000.namprd11.prod.outlook.com; PTR:; CAT:NONE; SFS:(13230001)(366004)(8936002)(2906002)(8676002)(4326008)(107886003)(86362001)(31696002)(83380400001)(66556008)(66946007)(82960400001)(38100700002)(66476007)(6512007)(6666004)(44832011)(6506007)(6486002)(55236004)(53546011)(36756003)(186003)(508600001)(5660300002)(26005)(2616005)(31686004)(316002)(45980500001)(20210929001); DIR:OUT; SFP:1102; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: =?utf-8?B?aWQ0YVhncVBUV2U1eDhxOVo2R3hyaDBmUXdacmlvTWNXd2dENTgyaE9MTVJT?= =?utf-8?B?MU1YQVBlOENFTCs5MUhXdkx3NndsZVpRSFRNRnlHbytrSHpUcldQNS9PczF5?= =?utf-8?B?VXhuVVRXdjFSbUwwUjdjbkFxays4WnNyalNLKzIzTmxNTnN2RnZQamtaUzk1?= =?utf-8?B?N0oydFFNdmhKaFdrSlRhQlJISHIzL3JVa3hpSDBVNkY1THk5QlpEUi9zdkYr?= =?utf-8?B?QVNTWFUxWEltK3B4T1A0K2kyTEpSMnZITHFGQ1ExaWIxaUtJUERoTVIxUkly?= =?utf-8?B?bWxVcSsvL1F5cWdLbzk5dk4yemt1Vm81NUc2RjJIY1RpdmZmZjRrSjVQa1FQ?= =?utf-8?B?RFRvOWpNWXpxeUppWnpmNlBES1lQU2Nrc3NKOEZqR3JXd1IrdVhGWVlPVmx0?= =?utf-8?B?bERLU3c4blZSaDluK0FJbHpkSEFHcE1nS2NxTmd3SDBqYkZ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R11MB5000.namprd11.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 31 Jan 2022 16:13:40.7763 (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: rdo47qd+OwaxB9G1YB7kNhgoeU3jnX5rmfT0Nvi0AqbrLr8s+bnZN0+M/IVAHZjPvNBEduChDwK9Xy7QiRA19A== X-MS-Exchange-Transport-CrossTenantHeadersStamped: DM5PR11MB0043 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 1/28/2022 2:35 AM, Min Hu (Connor) wrote: > when start testpmd, and type command like this, it will lead to > Segmentation fault, like: > > testpmd> create bonded device 4 0 > testpmd> add bonding slave 0 2 > testpmd> add bonding slave 1 2 > testpmd> port start 2 > testpmd> set bonding mode 0 2 > testpmd> quit > Stopping port 0... > Stopping ports... > ... > Bye... > Segmentation fault > > The reason to the bug is that rte timer do not be cancelled when quit. > That is, in 'bond_ethdev_start', resources are allocated according to > different bonding mode. In 'bond_ethdev_stop', resources are free by > the corresponding mode. > > For example, 'bond_ethdev_start' start bond_mode_8023ad_ext_periodic_cb > timer for bonding mode 4. and 'bond_ethdev_stop' cancel the timer only > when the current bonding mode is 4. If the bonding mode is changed, > and directly quit the process, the timer will still on, and freed memory > will be accessed, then segmentation fault. > > 'bonding mode'changed means resources changed, reallocate resources for 'bonding mode' changed ... > different mode should be done, that is, device should be restarted. > > Fixes: 2950a769315e ("bond: testpmd support") > Cc: stable@dpdk.org > > Signed-off-by: Min Hu (Connor) Tested-by: Ferruh Yigit Applied to dpdk-next-net/main, thanks. > --- > app/test-pmd/cmdline.c | 13 +++++++++++++ > 1 file changed, 13 insertions(+) > > diff --git a/app/test-pmd/cmdline.c b/app/test-pmd/cmdline.c > index e626b1c7d9..2c47ab0f18 100644 > --- a/app/test-pmd/cmdline.c > +++ b/app/test-pmd/cmdline.c > @@ -5915,6 +5915,19 @@ static void cmd_set_bonding_mode_parsed(void *parsed_result, > { > struct cmd_set_bonding_mode_result *res = parsed_result; > portid_t port_id = res->port_id; > + struct rte_port *port = &ports[port_id]; > + > + /* > + * Bonding mode changed means resources of device changed, like whether > + * started rte timer or not. Device should be restarted when resources > + * of device changed. > + */ > + if (port->port_status != RTE_PORT_STOPPED) { > + fprintf(stderr, > + "\t Error: Can't config bonding mode when port %d is not stopped\n", Updated as "... Can't set bonding mode ..." > + port_id); > + return; > + } > > /* Set the bonding mode for the relevant port. */ > if (0 != rte_eth_bond_mode_set(port_id, res->value))