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 CDBE842DFA; Fri, 7 Jul 2023 19:04:02 +0200 (CEST) Received: from mails.dpdk.org (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id 615574021F; Fri, 7 Jul 2023 19:04:02 +0200 (CEST) Received: from NAM11-BN8-obe.outbound.protection.outlook.com (mail-bn8nam11on2041.outbound.protection.outlook.com [40.107.236.41]) by mails.dpdk.org (Postfix) with ESMTP id E90DB4014F; Fri, 7 Jul 2023 19:04:00 +0200 (CEST) ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=RVmB+ANvWi7fNolTFdDCqfwdAOsstpMA7SDIRkAGc7yzprCiQzuUwuaQt8fb+Fw7soqf60VBaiz9iFgggZ1sOqOh2BaEvLvbNecUPOQvuvyIhYlGoFOLZHgwxQv9JsHB1tXTjo9N/RuLcdNdHAnMzW4KvAZZYbGODex5pzEtzcZGWf1UEN706o9xTZyKClVHGHwiA5sGQZvYg6Kobs5XAiFXpkXRzmj0LuO9ha4F7xC8C4+sGMwUOnw4HqLth2ENhDn+JlC3x8CGDYrbuxr+HCc02WX07VpUYfi/ZiRZaDW9wdFwwsibv1PuAGSwqfJCeG7wbKrMzE0v0BgbVlYEJQ== 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=ubt51ZVuNfpg0DesEbC1FY5woZfJxocF2TGMAdOuivo=; b=NLVuGzmq+i83yMs8oji2Jhffqbysam8xmf/OarxxaAFw1otCKEKBzgG63RD35MrpP5ce2W2cHnyqaKaflkO0hACx1gKht6eZNaJQ+FTHo4C2ezFMlzlsyy544cXW2AtOdN9I6khjl8Y38HR7+SFolaqTI8q5wbru0/aoj3Wl1u5IU5NfNzPHOnO7n93SaONFGqSx1K7lcRZhrPDHmy/Qt1whRo6It34LxmTg/z1z+Cw3ZmIr1nZIXHIO00h9RQlIJWzOCpZ72MqZflwu4oZuhvWZB1VHZmCSg3Iyo6Pt7Xty8zffvwp8Tgf688W+QW9d7mEwgVxl/WnrlPWvYLqwcQ== 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=ubt51ZVuNfpg0DesEbC1FY5woZfJxocF2TGMAdOuivo=; b=IytlQz0fdJiogTKErJbv5/LszoU/i2SYB7vYSKBLntqFaIaso0HKcMW5r7rg/L+XIi3mmONNjzbxZnyphs99eyrr6oT3tsy6B9FHaLMDLf7qcgdNkUzDAnLxcFLJ8lY445xY9yJGJI9HpanbIfVNVPw9bI1E9JuE86Wsze5IlcM= Authentication-Results: dkim=none (message not signed) header.d=none;dmarc=none action=none header.from=amd.com; Received: from CH3PR12MB8308.namprd12.prod.outlook.com (2603:10b6:610:131::8) by DM6PR12MB4204.namprd12.prod.outlook.com (2603:10b6:5:212::23) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.6565.25; Fri, 7 Jul 2023 17:03:59 +0000 Received: from CH3PR12MB8308.namprd12.prod.outlook.com ([fe80::72a7:19eb:4df8:efea]) by CH3PR12MB8308.namprd12.prod.outlook.com ([fe80::72a7:19eb:4df8:efea%2]) with mapi id 15.20.6565.019; Fri, 7 Jul 2023 17:03:58 +0000 Message-ID: <7926ad24-0c82-e2d0-7b59-52bed94bf210@amd.com> Date: Fri, 7 Jul 2023 22:33:46 +0530 User-Agent: Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:102.0) Gecko/20100101 Thunderbird/102.12.0 Subject: Re: [PATCH v2 1/2] net/virtio: fix legacy device IO port map in secondary process Content-Language: en-US To: "Xia, Chenbo" , David Marchand , "Li, Miao" , Maxime Coquelin Cc: "dev@dpdk.org" , "stable@dpdk.org" References: <20230628063651.178604-1-miao.li@intel.com> <20230629022653.263046-1-miao.li@intel.com> From: "Gupta, Nipun" In-Reply-To: Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 8bit X-ClientProxiedBy: SI2PR01CA0044.apcprd01.prod.exchangelabs.com (2603:1096:4:193::8) To CH3PR12MB8308.namprd12.prod.outlook.com (2603:10b6:610:131::8) MIME-Version: 1.0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: CH3PR12MB8308:EE_|DM6PR12MB4204:EE_ X-MS-Office365-Filtering-Correlation-Id: 44f473c8-3a68-43f7-fdac-08db7f0c278b X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: +7y29ylfEomddLKvqPUznfIdXeJaPCIV1lQhkIITQ8fBsWnYIw2KJ1PUW0m+r76nQpoyB0nzOkxLoBD6SV0AOs6Zs1cTOYVu7mykGn9G/FbPBBnVQyWjxYdvOhcGdRQ7sp+sR90ddSFy+050r+4eMFjOMotMRJ4aV2upG8n295pgSkt2knOPSjvNeLR+19hKx9FPA9Uw7dYdmxLb0Px4uwtsHMuZUHQPbL7jidJk5zhYBDBatHGp6mqavILaL1RQ5yiyFVym65w3Ju5GzMN/FvjCkyfuL2rwqIZkI42cUGc4d967CO8kFBTrgppnSpC/vdz9jQvZTQoRzJ+Obd2l4acr+PSIi9Uitbqu9UKd/4uyuEsGE5FzTxiPNf2iEI6jI8Sg0Wf/2h75RDlA/kDWz3+jq73e94QOBwOKx8JVJJ4Sp5ny32SzbB83Y5EgCeRKxfAnoI00m5uR5q9gtFO2/rg7weM4r99+LPmgbFkKP8HivQ6YfNsStDGRjZ6TUCao+23jC9FTId0C1zerV1huNoq7TCRwnm+JGiEEdbdcipwJyVv89E+6Sfl4OlNIE/l9y9LKBqDUJRk0gLUaS7ZPdduMQG+8I1pj7oiRtPzifJ3Thx8O9eny/pv8p1vHAAKB9IGDRhEkglw6qufyUSQEMw== X-Forefront-Antispam-Report: CIP:255.255.255.255; CTRY:; LANG:en; SCL:1; SRV:; IPV:NLI; SFV:NSPM; H:CH3PR12MB8308.namprd12.prod.outlook.com; PTR:; CAT:NONE; SFS:(13230028)(4636009)(346002)(376002)(366004)(136003)(396003)(39860400002)(451199021)(41300700001)(5660300002)(31686004)(110136005)(54906003)(6486002)(316002)(2906002)(8676002)(8936002)(66476007)(66556008)(66946007)(36756003)(6512007)(478600001)(86362001)(31696002)(186003)(2616005)(38100700002)(4326008)(83380400001)(53546011)(6506007)(26005)(6666004)(43740500002)(45980500001); DIR:OUT; SFP:1101; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: =?utf-8?B?NUgxc01kUllWSXF2UTdBZ1VZdndKKzAvb1VsVDRodUNCc0ZEK1luTmVtemcv?= =?utf-8?B?MGhUY3Vmd3FLdjJtbUc5eGhkbE5EN1Y3MlcwdEQ1SnB3WlVGU2gva2hwRGpV?= =?utf-8?B?a21TRXlUMDJDWVM2ZmE4c0hHRnIzL3BaTVhMM3VHY0loaGhaeU9Ccm40Y2pn?= =?utf-8?B?VmdVWTk5SE4rSHZpYlhkK2FuL1VEWEVsOWMyY2t3bWNPZDVFdmx0SEhuUXpu?= =?utf-8?B?WkZJWmxKSzhaazJjZzc4RkNqTEtqUWdVaHBacVdqZ21CZmhuQU5YR1kvNEhP?= =?utf-8?B?Mm9WOWN5K3F2RHVaM2p4Nm9wOVNubFlkeTVYRlMwVVRxVHljdWwwOWN2Zmht?= =?utf-8?B?NEN2cmF4cHMzdmxaZ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message-Id: 44f473c8-3a68-43f7-fdac-08db7f0c278b X-MS-Exchange-CrossTenant-AuthSource: CH3PR12MB8308.namprd12.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 07 Jul 2023 17:03:58.6666 (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: wRzKB92QolOYzPJwhWCsSlk07FS9aM+rf9yn2SKPW8w+xz2XpS7DVgNY9yChYhOc X-MS-Exchange-Transport-CrossTenantHeadersStamped: DM6PR12MB4204 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 7/3/2023 3:01 PM, Xia, Chenbo wrote: > +Nipun > >> -----Original Message----- >> From: David Marchand >> Sent: Monday, July 3, 2023 4:58 PM >> To: Li, Miao >> Cc: dev@dpdk.org; stable@dpdk.org; Maxime Coquelin >> ; Xia, Chenbo >> Subject: Re: [PATCH v2 1/2] net/virtio: fix legacy device IO port map in >> secondary process >> >> On Mon, Jul 3, 2023 at 10:54 AM Li, Miao wrote: >>>>> When doing IO port map for legacy device in secondary process, >>>>> vfio_cfg setup for legacy device like vfio_group_fd and vfio_dev_fd >> is >>>>> missing. So, in secondary process, rte_pci_map_device is added for >>>>> legacy device to setup vfio_cfg and fill in region info like in >>>>> primary process. >>>> >>>> I think, in legacy mode, there is no PCI mappable memory. >>>> So there should be no need for this call to rte_pci_map_device. >>>> >>>> What is missing is a vfio setup, is this correct? >>>> I'd rather see this issue be fixed in the pci_vfio_ioport_map() >> function. >>>> >>> If adding vfio setup in the pci_vfio_ioport_map() function, vfio will be >> setup twice in primary process because rte_pci_map_device will be called >> for legacy device in primary process. >>> I add IO port region check to skip region map in the next patch. >> >> Well, something must be done so that it is not mapped twice, I did not >> look into the details. >> This current patch looks wrong to me and I understand this is not a >> virtio only issue. > > I think we could have some way to improve this: > > 1. Make rte_pci_map_device map either PIO or MMIO (Based on my knowledge, it's doable > for vfio. For UIO, I am no expert and not sure). For ioport, it's only about setting > up the ioport offset and size. > 2. rte_pci_ioport_map may not be needed anymore. > 3. struct rte_pci_ioport may not be needed anymore as the info could be saved in > struct rte_pci_device_internal. > 4. ioport device uses bar #, len, offset to RW specific BAR. > > Then for virtio device, either primary or secondary process only calls rte_pci_map_device > once. > > Any comments? Wouldn't a call to API rte_vfio_setup_device() to setup vfio_cfg, vfio_group_fd, vfio_dev_fd under a secondary process check suffice to handle IO port map for legacy device in secondary process? I do not have much info on legacy Virtio device, and I am not clear on why and how for these devices rte_pci_map_device() would be called in case of primary process, but not in case of secondary process as mentioned by Miao Li? Steps you have mentioned looks fine but note that this would cause an ABI breakage and as you mentioned may need changes in UIO (even I am not an expert in UIO). Thanks, Nipun > > Thanks, > Chenbo > >> >> >> -- >> David Marchand >