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 0115A4284B for ; Mon, 27 Mar 2023 14:37:58 +0200 (CEST) Received: from mails.dpdk.org (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id EB200427F2; Mon, 27 Mar 2023 14:37:58 +0200 (CEST) Received: from NAM12-MW2-obe.outbound.protection.outlook.com (mail-mw2nam12on2089.outbound.protection.outlook.com [40.107.244.89]) by mails.dpdk.org (Postfix) with ESMTP id DECD940ED8; Mon, 27 Mar 2023 14:37:55 +0200 (CEST) ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=ikbzv4IuerXyLTZu5W1irfJdj8b63t0epqknFLtsExkHOicvnGWP+a2OYqGxjgvzWMMKy5YCtVARAijoDrANTk5P4JGe/LxzP/FAxUW6DlwILMsDHkgSUXvEys9+4RRuOulgZ9tLAMUzWqczCFQelYzY9iWtkP/OK2BzCg3i7joA8CVP0f9BOT6Go7BRC1ZREmPAH2m7U1m6g8mk9EOWpOIL5pq3kOoj48wrjtoCUZod/Y6JvWC52Yu+uj66GecFwSRFkhBpdIzzYqcJqT6iP25NPMVrUhm6T2p/wWbofp2g6BKnNbIyABirj3k+K4ryug0dACgVPAfW0YSBmJoYpQ== 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=21F2HgeGtSMvTgsQOHTA1VaVRUkHs/jyOjHjfx2UEe4=; b=gh7JESEKuT15NUiURAQxa2z9ZVTTy9qXrC32ouAw9+OnJOtRLk4M0z9pAp/kF5pDpSllh7lZLUnivJbRycLNNNRMNbnUlutTvg4hLagotufkvEDeMZEOEgslPvRH9BWuZwozq3AvyJ61WQJOA+juX+lxyYEhG0s6HnKBU6+4GCWCwf5FU1QTw6JMIpbNO/8hXvqtQFTmu1aa912c1jh2fFcV4nntTWH4rdiWgewPHjfHNBrtqq6pKTQ+mpTI47t4JFg3x8d59MWNqtguZs3sf5Jhm72d6r1h/gBtGUsG/7bewFRsvt6NtlEBG5tijAKTfCIfnQihSXZMSoSVakLG9w== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass smtp.mailfrom=amd.com; dmarc=pass action=none header.from=amd.com; dkim=pass header.d=amd.com; arc=none DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=amd.com; s=selector1; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=21F2HgeGtSMvTgsQOHTA1VaVRUkHs/jyOjHjfx2UEe4=; b=3oPZu+nfNmjduL1yfGXaMJ33WrBy6zdQPGnWs9ytvI6tf+385HYODId4kP36cfVbeAkFlCzO4Xz0ELy4L73YWSQaphjOlIQgldMT65FNlnfLs/16GEleTGcSAmktJFzYPGik/pvyR6KZ+7gDW8N4XnWUalTx5TUIXU4ZzdQJw8s= Authentication-Results: dkim=none (message not signed) header.d=none;dmarc=none action=none header.from=amd.com; Received: from CH2PR12MB4294.namprd12.prod.outlook.com (2603:10b6:610:a9::11) by PH8PR12MB7326.namprd12.prod.outlook.com (2603:10b6:510:216::7) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.6178.41; Mon, 27 Mar 2023 12:37:51 +0000 Received: from CH2PR12MB4294.namprd12.prod.outlook.com ([fe80::dd5a:8a5c:f493:9640]) by CH2PR12MB4294.namprd12.prod.outlook.com ([fe80::dd5a:8a5c:f493:9640%5]) with mapi id 15.20.6222.030; Mon, 27 Mar 2023 12:37:50 +0000 Message-ID: Date: Mon, 27 Mar 2023 13:37:43 +0100 User-Agent: Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:102.0) Gecko/20100101 Thunderbird/102.9.0 Subject: Re: [PATCH v3] net/iavf: fix iavf query stats in intr thread Content-Language: en-US From: Ferruh Yigit To: "Deng, KaiwenX" , "dev@dpdk.org" Cc: "stable@dpdk.org" , "Yang, Qiming" , "Zhou, YidingX" , Chas Williams , "Min Hu (Connor)" , "Wu, Jingjing" , "Xing, Beilei" , Mike Pattrick , "Zhang, Qi Z" , "Doherty, Declan" , "Mrzyglod, Daniel T" , Dapeng Yu , Helin Zhang , "Mcnamara, John" , Thomas Monjalon References: <20230307025533.1950861-1-kaiwenx.deng@intel.com> <20230322072615.179196-1-kaiwenx.deng@intel.com> <0f1ae3b9-f378-9a75-65f7-fcd6e2630414@amd.com> In-Reply-To: Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 7bit X-ClientProxiedBy: LO4P302CA0035.GBRP302.PROD.OUTLOOK.COM (2603:10a6:600:317::11) To CH2PR12MB4294.namprd12.prod.outlook.com (2603:10b6:610:a9::11) MIME-Version: 1.0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: CH2PR12MB4294:EE_|PH8PR12MB7326:EE_ X-MS-Office365-Filtering-Correlation-Id: 763436e9-5d25-4910-66d4-08db2ec013c5 X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: PD9HxNpONS1uogn1CmOXKCvTMfFHjciNzTUAz0CJeaUu9e3115tFrBpfob8/Ctm0Ty2jMAw1jwMgJcjFmywVUIKDSMTLkZjTYuqDlEpL87Lvl6aWfgM1iyfx0sx2L8ZrgEvEGzdexiAzzAtmOWRhkI2jEr6ibsMSSXN3bBi/aXp3xV/edK0nGp7blFP7Y+TQaf2B+BYRsFwnrmmrtGZNks5QEHVw9POI7LRIvtgrQcqQhntfzxIirGDBCNqZfErrmQhkiyWRUOzfcrxXmxt99F924iyEqhj2NeRFsKojUbQHGOVBsi5y002V/m/LvhRu7WBpI9fhoGj2oVwmfaRs6S/nPzTQs1nMgPkAsnOawcYC9qogV+O7zccVQ1VCgNkTpSN/cOy4R6TrUL3W3uV8VwEUGPMQQKd72B9Qq2caktwI4TAucQAYMYs5BK01dCD4uITqzrM0/wyp7N7/Rj5mXpAjNJyMTYPnnzJHtmPM3PfVlX2kbVjXBU6QXNtI3HnjohkDkgQqDifn+mcRff58apbcCcg8sfbbvjHq5811CvNCnqm1qm07w1qqEvFyFtromWDa/e3RdQDHF57kOM5rONWI/aY/7ZrVysv+75hVGYoTRonE/p5v6F3Yb5B+/y5fARVoFbB10HZBVWqBySI45g== X-Forefront-Antispam-Report: CIP:255.255.255.255; CTRY:; LANG:en; SCL:1; SRV:; IPV:NLI; SFV:NSPM; H:CH2PR12MB4294.namprd12.prod.outlook.com; PTR:; CAT:NONE; SFS:(13230028)(4636009)(136003)(39860400002)(366004)(396003)(376002)(346002)(451199021)(54906003)(7416002)(5660300002)(8936002)(478600001)(66946007)(316002)(66556008)(110136005)(66476007)(41300700001)(30864003)(6486002)(44832011)(8676002)(4326008)(31686004)(6666004)(2906002)(26005)(83380400001)(53546011)(6506007)(186003)(6512007)(2616005)(38100700002)(36756003)(31696002)(86362001)(43740500002)(45980500001); DIR:OUT; SFP:1101; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: =?utf-8?B?QmNZK2RoNzhuTncxVE81OVdaeXhFTW1Obmp2MTY3OG1YV0pNM3pLdkQrWFll?= =?utf-8?B?NVNIWjZRYlBidUI2MEJIR0hyZjJOeTZVL0tpYk5vWnJKT2ZwbVFSZFRGOGds?= =?utf-8?B?UVNOaWl1M0htTGdrTG9oTVBZbWZHL0pob0NGeU1Ecmw0TDNlSlVFOHk3WFNY?= =?utf-8?B?Mkh0LzdZYURUVnBUeDk4K1hhd1JjNUlCRERGYU9DdFE2T0dHK2doVXJaWFBu?= =?utf-8?B?d3FQamxiMmVRVkQvemJxeXJDMDdSaDlid3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ZsclhpSGxYT25ZS05UMitPV0RHbWNHY2pJckIwZndld2tuZkoz?= =?utf-8?Q?43+7iFSL7bzCj7Cy/4IqLsBlk?= X-OriginatorOrg: amd.com X-MS-Exchange-CrossTenant-Network-Message-Id: 763436e9-5d25-4910-66d4-08db2ec013c5 X-MS-Exchange-CrossTenant-AuthSource: CH2PR12MB4294.namprd12.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 27 Mar 2023 12:37:50.5649 (UTC) X-MS-Exchange-CrossTenant-FromEntityHeader: Hosted X-MS-Exchange-CrossTenant-Id: 3dd8961f-e488-4e60-8e11-a82d994e183d X-MS-Exchange-CrossTenant-MailboxType: HOSTED X-MS-Exchange-CrossTenant-UserPrincipalName: JvVPyJpY8K5qFqsZUh5psUlPyBzB4yfGXMD4k52eZF18v+oF4TKN4DJP1/AArLEi X-MS-Exchange-Transport-CrossTenantHeadersStamped: PH8PR12MB7326 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 3/27/2023 1:31 PM, Ferruh Yigit wrote: > On 3/27/2023 6:31 AM, Deng, KaiwenX wrote: >> >> >>> -----Original Message----- >>> From: Ferruh Yigit >>> Sent: Thursday, March 23, 2023 11:39 PM >>> To: Deng, KaiwenX ; dev@dpdk.org >>> Cc: stable@dpdk.org; Yang, Qiming ; Zhou, YidingX >>> ; Chas Williams ; Min Hu (Connor) >>> ; Wu, Jingjing ; Xing, Beilei >>> ; Mike Pattrick ; Zhang, Qi Z >>> ; Doherty, Declan ; >>> Mrzyglod, Daniel T ; Dapeng Yu >>> >>> Subject: Re: [PATCH v3] net/iavf: fix iavf query stats in intr thread >>> >>> On 3/22/2023 7:26 AM, Kaiwen Deng wrote: >>>> When iavf send query-stats command in eal-intr-thread through virtual >>>> channel, there will be no response received from >>>> iavf_dev_virtchnl_handler for this command during block and wait. >>>> Because iavf_dev_virtchnl_handler is also registered in eal-intr-thread. >>>> >>>> When vf device is bonded as BONDING_MODE_TLB mode, the slave device >>>> update callback will registered in alarm and called by >>>> eal-intr-thread, it would also raise the above issue. >>>> >>>> This commit add to poll the response for VIRTCHNL_OP_GET_STATS when >>> it >>>> is called by eal-intr-thread to fix this issue. >>>> >>>> Fixes: 91bf37d250aa ("net/iavf: add lock for VF commands") >>>> Fixes: 22b123a36d07 ("net/avf: initialize PMD") >>>> Fixes: 7c76a747e68c ("bond: add mode 5") >>>> Fixes: 435d523112cc ("net/iavf: fix multi-process shared data") >>>> Fixes: cb5c1b91f76f ("net/iavf: add thread for event callbacks") >>> >>> >>> Hi Kaiwen, >>> >>> Above commit already seems trying to address same issue, it creates "iavf- >>> event-thread" control thread to asyncroniously handle the interrupts, in non- >>> interrupt context, why it is not working? >>> >>> Instead of adding 'rte_thread_is_intr()' checks, can't you make sure all >>> interrupts handled in control tread? >>> >>> And can you please provide a stack trace in commit log, to describe the issue >>> better? >> Hi Ferru, >> Sorry for my late reply, And thanks for your review. >> >> The above commit does not fix this issue when we need to get the returned data. >> If we call iavf_query_stats and wait for response statistics in the intr-thread. >> iavf_handle_virtchnl_msg is also registered in the intr_thread and will not be >> executed while waiting. >> > > Got it, since return value is required, API can't be called asyncroniously. > > > > I think 'rte_thread_is_intr()' checks may cause more trouble for you in > long term, > > - why 'iavf_query_stats()' is called in the iterrupt thread, can it be > prevented? > > - does it make sense to allways poll messages from PF (for simplification)? > > > If answer to both are 'No', I am OK to continue with current proposal if > you are happy with it. > btw, how critical is this issue? If it is critical, I am OK to get it as it is for this release and investigate it further for next release, since only a few days left for this release. > >> This commit I changed it to polling for replies to commands executed in the interrupt thread. >> >> main thread interrupt thread >> | | >> | | >> iavf_query_stats | >> iavf_execute_vf_cmd | >> iavf_aq_send_msg_to_pf and wait handle complete | >> | | >> |-------------------------------------------------------------------------------------------->| >> | | >> | iavf_handle_virtchnl_msg >> | | >> |<--------------------------------------------------------------------------------------------| >> | | >> iavf_execute_vf_cmd get response | >> | | >> >> The above is the stack trace for the normal execution of iavf_query_stats >> in the main thread. >> >> interrupt thread >> | >> | >> iavf_query_stats >> iavf_execute_vf_cmd >> iavf_aq_send_msg_to_pf wait handle complete(1 sec) >> iavf_execute_vf_cmd timeout >> | >> | >> iavf_handle_virtchnl_msg >> | >> >> The above is the stack trace for the abnormal execution of iavf_query_stats >> in the interrupt thread. >>> >>>> Cc: stable@dpdk.org >>>> >>>> Signed-off-by: Kaiwen Deng >>>> --- >>>> Changes since v2: >>>> - Add to poll the response for VIRTCHNL_OP_GET_STATS. >>>> >>>> Changes since v1: >>>> - Add lock to avoid race condition. >>>> --- >>>> --- >>>> drivers/net/bonding/rte_eth_bond_pmd.c | 7 ++- >>>> drivers/net/iavf/iavf_ethdev.c | 5 +- >>>> drivers/net/iavf/iavf_vchnl.c | 71 ++++++++++++++++++-------- >>>> 3 files changed, 58 insertions(+), 25 deletions(-) >>>> >>>> diff --git a/drivers/net/bonding/rte_eth_bond_pmd.c >>>> b/drivers/net/bonding/rte_eth_bond_pmd.c >>>> index f0c4f7d26b..edce621496 100644 >>>> --- a/drivers/net/bonding/rte_eth_bond_pmd.c >>>> +++ b/drivers/net/bonding/rte_eth_bond_pmd.c >>>> @@ -894,6 +894,7 @@ bond_ethdev_update_tlb_slave_cb(void *arg) >>>> uint8_t update_stats = 0; >>>> uint16_t slave_id; >>>> uint16_t i; >>>> + int ret; >>>> >>>> internals->slave_update_idx++; >>>> >>>> @@ -903,7 +904,10 @@ bond_ethdev_update_tlb_slave_cb(void *arg) >>>> >>>> for (i = 0; i < internals->active_slave_count; i++) { >>>> slave_id = internals->active_slaves[i]; >>>> - rte_eth_stats_get(slave_id, &slave_stats); >>>> + ret = rte_eth_stats_get(slave_id, &slave_stats); >>>> + if (ret) >>>> + goto OUT; >>>> + >>>> tx_bytes = slave_stats.obytes - tlb_last_obytets[slave_id]; >>>> bandwidth_left(slave_id, tx_bytes, >>>> internals->slave_update_idx, &bwg_array[i]); >>> @@ -922,6 +926,7 @@ >>>> bond_ethdev_update_tlb_slave_cb(void *arg) >>>> for (i = 0; i < slave_count; i++) >>>> internals->tlb_slaves_order[i] = bwg_array[i].slave; >>>> >>>> +OUT: >>>> rte_eal_alarm_set(REORDER_PERIOD_MS * 1000, >>> bond_ethdev_update_tlb_slave_cb, >>>> (struct bond_dev_private *)internals); } diff --git >>>> a/drivers/net/iavf/iavf_ethdev.c b/drivers/net/iavf/iavf_ethdev.c >>>> index 3196210f2c..d6e1f1a7f4 100644 >>>> --- a/drivers/net/iavf/iavf_ethdev.c >>>> +++ b/drivers/net/iavf/iavf_ethdev.c >>>> @@ -2607,6 +2607,9 @@ iavf_dev_init(struct rte_eth_dev *eth_dev) >>>> adapter->dev_data = eth_dev->data; >>>> adapter->stopped = 1; >>>> >>>> + if (iavf_dev_event_handler_init()) >>>> + goto init_vf_err; >>>> + >>>> if (iavf_init_vf(eth_dev) != 0) { >>>> PMD_INIT_LOG(ERR, "Init vf failed"); >>>> return -1; >>>> @@ -2634,8 +2637,6 @@ iavf_dev_init(struct rte_eth_dev *eth_dev) >>>> rte_ether_addr_copy((struct rte_ether_addr *)hw->mac.addr, >>>> ð_dev->data->mac_addrs[0]); >>>> >>>> - if (iavf_dev_event_handler_init()) >>>> - goto init_vf_err; >>>> >>>> if (vf->vf_res->vf_cap_flags & VIRTCHNL_VF_OFFLOAD_WB_ON_ITR) >>> { >>>> /* register callback func to eal lib */ diff --git >>>> a/drivers/net/iavf/iavf_vchnl.c b/drivers/net/iavf/iavf_vchnl.c index >>>> 9adaadb173..aeffb07cca 100644 >>>> --- a/drivers/net/iavf/iavf_vchnl.c >>>> +++ b/drivers/net/iavf/iavf_vchnl.c >>>> @@ -256,6 +256,7 @@ iavf_read_msg_from_pf(struct iavf_adapter >>> *adapter, uint16_t buf_len, >>>> vf->link_speed = >>> iavf_convert_link_speed(speed); >>>> } >>>> iavf_dev_link_update(vf->eth_dev, 0); >>>> + iavf_dev_event_post(vf->eth_dev, >>> RTE_ETH_EVENT_INTR_LSC, NULL, 0); >>>> PMD_DRV_LOG(INFO, "Link status update:%s", >>>> vf->link_up ? "up" : "down"); >>>> break; >>>> @@ -368,28 +369,48 @@ iavf_execute_vf_cmd(struct iavf_adapter >>> *adapter, struct iavf_cmd_info *args, >>>> _clear_cmd(vf); >>>> break; >>>> default: >>>> - /* For other virtchnl ops in running time, >>>> - * wait for the cmd done flag. >>>> - */ >>>> - do { >>>> - if (vf->pend_cmd == VIRTCHNL_OP_UNKNOWN) >>>> - break; >>>> - iavf_msec_delay(ASQ_DELAY_MS); >>>> - /* If don't read msg or read sys event, continue */ >>>> - } while (i++ < MAX_TRY_TIMES); >>>> - >>>> - if (i >= MAX_TRY_TIMES) { >>>> - PMD_DRV_LOG(ERR, "No response for cmd %d", >>> args->ops); >>>> + if (rte_thread_is_intr()) { >>>> + /* For virtchnl ops were executed in eal_intr_thread, >>>> + * need to poll the response. >>>> + */ >>>> + do { >>>> + result = iavf_read_msg_from_pf(adapter, >>> args->out_size, >>>> + args->out_buffer); >>>> + if (result == IAVF_MSG_CMD) >>>> + break; >>>> + iavf_msec_delay(ASQ_DELAY_MS); >>>> + } while (i++ < MAX_TRY_TIMES); >>>> + if (i >= MAX_TRY_TIMES || >>>> + vf->cmd_retval != >>> VIRTCHNL_STATUS_SUCCESS) { >>>> + err = -1; >>>> + PMD_DRV_LOG(ERR, "No response or return >>> failure (%d)" >>>> + " for cmd %d", vf- >>>> cmd_retval, args->ops); >>>> + } >>>> _clear_cmd(vf); >>>> - err = -EIO; >>>> - } else if (vf->cmd_retval == >>>> - VIRTCHNL_STATUS_ERR_NOT_SUPPORTED) { >>>> - PMD_DRV_LOG(ERR, "Cmd %d not supported", args- >>>> ops); >>>> - err = -ENOTSUP; >>>> - } else if (vf->cmd_retval != VIRTCHNL_STATUS_SUCCESS) { >>>> - PMD_DRV_LOG(ERR, "Return failure %d for cmd %d", >>>> - vf->cmd_retval, args->ops); >>>> - err = -EINVAL; >>>> + } else { >>>> + /* For other virtchnl ops in running time, >>>> + * wait for the cmd done flag. >>>> + */ >>>> + do { >>>> + if (vf->pend_cmd == >>> VIRTCHNL_OP_UNKNOWN) >>>> + break; >>>> + iavf_msec_delay(ASQ_DELAY_MS); >>>> + /* If don't read msg or read sys event, >>> continue */ >>>> + } while (i++ < MAX_TRY_TIMES); >>>> + >>>> + if (i >= MAX_TRY_TIMES) { >>>> + PMD_DRV_LOG(ERR, "No response for >>> cmd %d", args->ops); >>>> + _clear_cmd(vf); >>>> + err = -EIO; >>>> + } else if (vf->cmd_retval == >>>> + VIRTCHNL_STATUS_ERR_NOT_SUPPORTED) { >>>> + PMD_DRV_LOG(ERR, "Cmd %d not >>> supported", args->ops); >>>> + err = -ENOTSUP; >>>> + } else if (vf->cmd_retval != >>> VIRTCHNL_STATUS_SUCCESS) { >>>> + PMD_DRV_LOG(ERR, "Return failure %d for >>> cmd %d", >>>> + vf->cmd_retval, args->ops); >>>> + err = -EINVAL; >>>> + } >>>> } >>>> break; >>>> } >>>> @@ -403,8 +424,14 @@ iavf_execute_vf_cmd_safe(struct iavf_adapter >>>> *adapter, { >>>> struct iavf_info *vf = IAVF_DEV_PRIVATE_TO_VF(adapter); >>>> int ret; >>>> + int is_intr_thread = rte_thread_is_intr(); >>>> >>>> - rte_spinlock_lock(&vf->aq_lock); >>>> + if (is_intr_thread) { >>>> + if (!rte_spinlock_trylock(&vf->aq_lock)) >>>> + return -EIO; >>>> + } else { >>>> + rte_spinlock_lock(&vf->aq_lock); >>>> + } >>>> ret = iavf_execute_vf_cmd(adapter, args, async); >>>> rte_spinlock_unlock(&vf->aq_lock); >>>> >> >