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 AC20BA0C47; Fri, 8 Oct 2021 23:11:56 +0200 (CEST) Received: from [217.70.189.124] (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id 4E246407FF; Fri, 8 Oct 2021 23:11:56 +0200 (CEST) Received: from mga18.intel.com (mga18.intel.com [134.134.136.126]) by mails.dpdk.org (Postfix) with ESMTP id D781D4014F for ; Fri, 8 Oct 2021 23:11:54 +0200 (CEST) X-IronPort-AV: E=McAfee;i="6200,9189,10131"; a="213537625" X-IronPort-AV: E=Sophos;i="5.85,358,1624345200"; d="scan'208";a="213537625" Received: from fmsmga005.fm.intel.com ([10.253.24.32]) by orsmga106.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 08 Oct 2021 14:11:32 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.85,358,1624345200"; d="scan'208";a="715672118" Received: from fmsmsx604.amr.corp.intel.com ([10.18.126.84]) by fmsmga005.fm.intel.com with ESMTP; 08 Oct 2021 14:11:32 -0700 Received: from fmsmsx607.amr.corp.intel.com (10.18.126.87) by fmsmsx604.amr.corp.intel.com (10.18.126.84) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2242.12; Fri, 8 Oct 2021 14:11:31 -0700 Received: from fmsedg602.ED.cps.intel.com (10.1.192.136) by fmsmsx607.amr.corp.intel.com (10.18.126.87) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2242.12 via Frontend Transport; Fri, 8 Oct 2021 14:11:31 -0700 Received: from NAM10-BN7-obe.outbound.protection.outlook.com (104.47.70.109) by edgegateway.intel.com (192.55.55.71) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.1.2242.12; Fri, 8 Oct 2021 14:11:30 -0700 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=BJprcUutFAIHZyMIZOEmtBnRnHcrm3V4XK6r86UP0QJmR2o8Gyw2iLCdEwI51gmtQQmDUhkTesbiCoCFZv+6Pyozju/r1tkuAkJXTxqn4IwB2iXzHBkmd/KYNmagcjtbZlTSWAiIIZLYfkAs7v9L68d7332108+TmEcQQPNN2PQuAVeNOMR3422uayn4vj6L/DLMnFLGbyAw9i51445SkhcJWwZkxJ/0L8mAKayRw+zf/VxyytfLfxSP2IflrkNLoLwwP8MLRoGwCL2lR8j/KzYyXrq8RyTWVLfmPoy0yG+pFz44Wv342oevtw3lA+xpe/VlTJrPnZFVxgeYuFR8UA== 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=Kb7CGrX1oGUyINFksZ62LsYwsmmgndBUpD4b78rJsJ8=; b=jzz7mNSFDNo7/1bRcumJV1eMS7ACvVi0am4E4g2IAwk0LZrvJNKCIqBweHGuzoRJeRd+nrp6ZTS/TlyDqKiiJrBbvkgkXTBNvVfArqdl22zD9xB3DUVNqlcvwoSCXFr9HeCA3wR+IClTX4T2Mu/zYfF35otHmFkGk2lF1HoTwqK8HT3DONp9m8V4SpeWURu9DIKgjbFHb0nF6SgfORY8w27N3jXJbgSM+vNX4dLiVb5yXKaPVIWv2pw/eeF7CO+nxm7o466pMJHIk4wdGpc1Vl7HaOHgR/XDoE2z68C7kPZ3jzYvC7+Z+pp0uziJFbzaOUlA2+a/hh+XZF/9HTRR4A== 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 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=intel.onmicrosoft.com; s=selector2-intel-onmicrosoft-com; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=Kb7CGrX1oGUyINFksZ62LsYwsmmgndBUpD4b78rJsJ8=; b=mE1/t0kHs42qdzkRYV7HGUatt1wl7PDqfqHdxIQbl0EpvZpEE5yLmlauEuC7sQEk43eSUnhgfUotUOG431GIb1eAM1ft9WC60POtscFuGOse/D26xPEBM7p7232Bgw655LVto9gaeD9dHBLXVXnKAKo+ihEPYqqJrZL2JZwBk5Q= Authentication-Results: gmail.com; dkim=none (message not signed) header.d=none;gmail.com; dmarc=none action=none header.from=intel.com; Received: from PH0PR11MB5000.namprd11.prod.outlook.com (2603:10b6:510:41::19) by PH0PR11MB4776.namprd11.prod.outlook.com (2603:10b6:510:30::14) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.4587.18; Fri, 8 Oct 2021 21:11:25 +0000 Received: from PH0PR11MB5000.namprd11.prod.outlook.com ([fe80::bd7d:29be:3342:632c]) by PH0PR11MB5000.namprd11.prod.outlook.com ([fe80::bd7d:29be:3342:632c%5]) with mapi id 15.20.4587.022; Fri, 8 Oct 2021 21:11:25 +0000 Message-ID: Date: Fri, 8 Oct 2021 22:11:19 +0100 Content-Language: en-US To: Elad Nachman CC: Eric Christian , dev , Igor Ryzhov References: <20210924105409.21711-1-eladv6@gmail.com> <3ae193df-292c-4907-df4a-88ce3d6735fc@intel.com> <1a17d552-8b81-04f9-7594-61e84ea7990f@intel.com> <8525082f-eb28-92db-11d3-ef4d24144be4@intel.com> From: Ferruh Yigit X-User: ferruhy In-Reply-To: Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 8bit X-ClientProxiedBy: DB9PR05CA0012.eurprd05.prod.outlook.com (2603:10a6:10:1da::17) To PH0PR11MB5000.namprd11.prod.outlook.com (2603:10b6:510:41::19) MIME-Version: 1.0 Received: from [192.168.0.206] (37.228.236.146) by DB9PR05CA0012.eurprd05.prod.outlook.com (2603:10a6:10:1da::17) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.4587.18 via Frontend Transport; Fri, 8 Oct 2021 21:11:24 +0000 X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-Correlation-Id: ad8b35cc-2295-4ae9-6455-08d98aa02fd5 X-MS-TrafficTypeDiagnostic: PH0PR11MB4776: X-Microsoft-Antispam-PRVS: X-MS-Oob-TLC-OOBClassifiers: OLM:8273; X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: u8aY2KEHoYiPeA3Tedo+aRaAkapd0//c0a9RprMSzHmIjIvRqdAx0wr8t0fjyX6GquoofE7wWnna1zJuZT2MigJr7LDRsZF1Ww/mZ5lv9O/MB1Www6o2u6sgVd/PrdkI/clkrMOS9vq+Fokb9MgUQg4ukyp8PcnYjAG7Epu4heza9aC9W70lPXiEMhHMHpL6nIKLnu8L7+sCBizqOwwweW0UYqtVXJsHrFa+0nZFM1Lm0lhJT/gi78aDl/okW+NtTb8Q5N/JXyuVoIlMTCCm5angm/l9ul3k767S7qyS3TE68VQk/Ar9skJzf7HZklGYqJBS+A0kDkdgeD9R4S+Qz25TbUCs+PiEe7xESetGPFgxabMKWNvJMgHJ15XyeXJ70i2cxo1K2a01li84wJ53x0IKqzX0uNp9MMSlP3yZHsNLA13GuTvW2lbYyaDcdawqBCNjKYew7zX0fvlAvpiBjRqgbAXy5jwL3WCE4M6eIC7jXCAgxZwzlIkOU/m1GpU12llAJwPW8U/Mv9Z0S2F191Vgz6DscrzXeqtBud9CXbvV/lvufs9VJastSQ+QTR2cLZkz5GIU4XE2ciMltnaHY+XFJuABiH1QnDURIwnBCqdVRgnPgpx02QhUIIPmXeY9SzSbJGRwbbWysCwPiNHBedUgcHilDhc52QsN6cZqq60BDqKkJ66IY6GbaRDJk26hm7GNRv+0cqr9Dafu37TtYfCWiAx3975m+up6xHrjlOS6AgQZeEuT7CwgvH7uare868lyytXp08TaYxSkrqD956/IDENXEWacPR0Kbk/9LKw= 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:(4636009)(366004)(2616005)(956004)(44832011)(66476007)(66556008)(36756003)(316002)(8676002)(26005)(6486002)(83380400001)(8936002)(53546011)(66946007)(86362001)(54906003)(16576012)(6916009)(186003)(2906002)(5660300002)(31696002)(508600001)(31686004)(38100700002)(6666004)(4326008)(966005)(45980500001); DIR:OUT; SFP:1102; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: =?utf-8?B?bnZHKzlBWWJPYWdlRlRmN25ybHVzNGduNUZaVGp2WnNCVHZodE8zU3YvUVlZ?= =?utf-8?B?dG1EOTlPTWV1dEJ0Y2QyRy9BRnpVVFJ0MkFreDhrcGtVNVZNSmhmZ00xay91?= =?utf-8?B?THd5QnpWR1kydjJlVTdQUUcxdG9iV1ZsNUpWam5BZ0NOUHhDdXQ3L21SRU9h?= =?utf-8?B?TUVMdmVDVmRIcjBsblJ6VkorU2VkZktCZ2FPSVAvTkdRZjczdEpCSUZOcXlX?= =?utf-8?B?bmNqTndZQWZTVlg2L1RoTGgzRHJ0dWovT3h1NGxreVVwNURzdzg4RWFEMnM3?= =?utf-8?B?cjRqcU9MRWltcWswWHJrZ2RHblhFRWlGRHA5UXFKRWp5NTJTQ01HYVBGZHdz?= =?utf-8?B?Ri9maERyZjFmOHBvcHdpVC9kcVFZZWJwemZZaXMreDFOMUVhaXovV1dYTkE1?= =?utf-8?B?ZTZxcnhPWUp0NGh1VX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VHJNOERnTXVSVGFrV3hOTEdReW9KTGwraXpRNTJBMGN0NC9mYTd3?= =?utf-8?B?VERlSGlVQitqR1NoNTNNQ2RVUmY0TU42UHFzZmRqUjFsVG1pTDNFN1NRRGdZ?= =?utf-8?B?bG1TcnpMSDhWR3VTU2kwdTZ5TDJxS1lldVBUc0ptdTV4dnR3cUZITm0xelpu?= =?utf-8?B?Mm85Zm5qNTg2N1N5T0xpNGlNSC81MStFaUwxR1p0eHlmREhGTkpDWkoxWUV0?= =?utf-8?B?K1ZhYTJQVy9YV0pmWTlUWEhKV2dZVzRtV3ZIaVBTZWc5MEkxa2h5U1dSOHRO?= =?utf-8?B?M0NPNTllbkdOdTR4RHZZSzg0K2Z2ZXZ2ZTE5MUc3WEYrS2pabU8ySlQ0bytQ?= =?utf-8?B?eHBtYzFDU005Tmo5Vm94OTlZRjhtZkVncnNsRC9IZXN6MTVQcjBGUWJsZk9M?= =?utf-8?Q?42UIJlLzzZU0z1wOQdkEGmtIWmMLxJ2f7hapBBz?= X-MS-Exchange-CrossTenant-Network-Message-Id: ad8b35cc-2295-4ae9-6455-08d98aa02fd5 X-MS-Exchange-CrossTenant-AuthSource: PH0PR11MB5000.namprd11.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 08 Oct 2021 21:11:25.4855 (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: d/ll9V34zbdR8YBRLTCMp2MeTt6fCo6b0rEXmxQb7oYpxjRcGQmUTmLEdMfxPW73IQD2R999wti9hikJBTke0w== X-MS-Exchange-Transport-CrossTenantHeadersStamped: PH0PR11MB4776 X-OriginatorOrg: intel.com Subject: Re: [dpdk-dev] [PATCH v2] kni: Fix request overwritten 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 Sender: "dev" On 10/4/2021 5:18 PM, Elad Nachman wrote: > On Mon, Oct 4, 2021 at 7:05 PM Ferruh Yigit wrote: > >> On 10/4/2021 3:58 PM, Elad Nachman wrote: >>> בתאריך יום ב׳, 4 באוק׳ 2021, 17:51, מאת Ferruh Yigit ‏< >>> ferruh.yigit@intel.com>: >>> >>>> On 10/4/2021 3:25 PM, Elad Nachman wrote: >>>> >>>> Can you please try to not top post, it will make impossible to follow >> this >>>> discussion later from the mail archives. >>>> >>>>> 1. Userspace will get an error >>>> >>>> So there is nothing special with returning '-EAGAIN', user will only >>>> observe an >>>> error. >>>> Wasn't initial intention to use '-EAGAIN' to try request again? >>>> >>> To signal user-space to retry the operation. >>> >> >> Not sure if it will reach to the end user. If user is calling "ifconfig >> >> down", it will just fail right, it won't recognize the error type. >> >> Unless this is common usage by the Linux network drivers, having this >> usage in >> KNI won't help much. I am for handling this in the kernel side if we can. >> >> > If user calls ifconfig down it will not happen. It requires some > multi-core race condition only Eric can recreate. > > >>>> >>>>> 2. Waiting with rtnl locked causes a deadlock; waiting with rtnl >> unlocked >>>>> for interface down command causes a crash because of a race condition >> in >>>>> the device delete/unregister list in the kernel. >>>>> >>>> >>>> Why waiting with rthnl lock causes a deadlock? As said below we are >> already >>>> doing it, why it is different with retry logic? >>>> >>> Because it can be interface down request. >>> >> >> (sure you like short answers) >> >> Please help me to see why "interface down" is special. Isn't it point of >> your >> patch to wait the request execution in the userspace even it is an async >> request? >> >> And yet again, number of retry can be limited. >> >> > No, it is not. Please look again: > https://patches.dpdk.org/project/dpdk/patch/20210924105409.21711-1-eladv6@gmail.com/ > Still not clear why not to handle EAGAIN within KNI module. Also another problem is kernel relying userspace to continue processing requests is error prone, we need some escape mechanism, some kind of time out etc... Anyway, I will send a patch disable bifurcated device support by default. > > >> >>> >>>> I agree to not wait with rtnl unlocked. >>>> >>>>> FYI, >>>>> >>>>> Elad. >>>>> >>>>> בתאריך יום ב׳, 4 באוק׳ 2021, 17:13, מאת Ferruh Yigit ‏< >>>>> ferruh.yigit@intel.com>: >>>>> >>>>>> On 10/4/2021 2:09 PM, Elad Nachman wrote: >>>>>>> Hi, >>>>>>> >>>>>>> EAGAIN is propogated back to the kernel and to the caller. >>>>>>> >>>>>> >>>>>> So will the user get an error, or it will be handled by the kernel and >>>>>> retried? >>>>>> >>>>>>> We cannot retry from the kni kernel module since we hold the rtnl >> lock. >>>>>>> >>>>>> >>>>>> Why not? We are already waiting until a command time out, like >>>>>> 'kni_net_open()' >>>>>> can retry if 'kni_net_process_request()' returns '-EAGAIN'. And we can >>>>>> limit the >>>>>> number of retry for safety. >>>>>> >>>>>>> FYI, >>>>>>> >>>>>>> Elad >>>>>>> >>>>>>> בתאריך יום ב׳, 4 באוק׳ 2021, 16:05, מאת Ferruh Yigit ‏< >>>>>>> ferruh.yigit@intel.com>: >>>>>>> >>>>>>>> On 9/24/2021 11:54 AM, Elad Nachman wrote: >>>>>>>>> Fix lack of multiple KNI requests handling support by introducing a >>>>>>>>> request in progress flag which will fail additional requests with >>>>>>>>> EAGAIN return code if the original request has not been processed >>>>>>>>> by user-space. >>>>>>>>> >>>>>>>>> Bugzilla ID: 809 >>>>>>>> >>>>>>>> Hi Eric, >>>>>>>> >>>>>>>> Can you please test this patch, if it solves the issue you reported? >>>>>>>> >>>>>>>>> >>>>>>>>> Signed-off-by: Elad Nachman >>>>>>>>> --- >>>>>>>>> kernel/linux/kni/kni_net.c | 9 +++++++++ >>>>>>>>> lib/kni/rte_kni.c | 2 ++ >>>>>>>>> lib/kni/rte_kni_common.h | 1 + >>>>>>>>> 3 files changed, 12 insertions(+) >>>>>>>>> >>>>>>>> >>>>>>>> <...> >>>>>>>> >>>>>>>>> @@ -123,7 +124,15 @@ kni_net_process_request(struct net_device >> *dev, >>>>>>>> struct rte_kni_request *req) >>>>>>>>> >>>>>>>>> mutex_lock(&kni->sync_lock); >>>>>>>>> >>>>>>>>> + /* Check that existing request has been processed: */ >>>>>>>>> + cur_req = (struct rte_kni_request *)kni->sync_kva; >>>>>>>>> + if (cur_req->req_in_progress) { >>>>>>>>> + ret = -EAGAIN; >>>>>>>> >>>>>>>> Overall logic in the KNI looks good to me, this helps to serialize >> the >>>>>>>> requests >>>>>>>> even for async ones. >>>>>>>> >>>>>>>> But can you please clarify how it behaves in the kernel side with >>>>>> '-EAGAIN' >>>>>>>> return type? Will linux call the ndo again, or will it just fail. >>>>>>>> >>>>>>>> If it just fails should we handle the re-try on '-EAGAIN' within the >>>> kni >>>>>>>> module? >>>>>>>> >>>>>>>> >>>>>> >>>>>> >>>> >>>> Elad. >> >>