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 6B8AC42617; Fri, 22 Sep 2023 12:55:46 +0200 (CEST) Received: from mails.dpdk.org (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id 57FAE402CB; Fri, 22 Sep 2023 12:55:46 +0200 (CEST) Received: from mgamail.intel.com (mgamail.intel.com [134.134.136.100]) by mails.dpdk.org (Postfix) with ESMTP id 3BDEC40150 for ; Fri, 22 Sep 2023 12:55:45 +0200 (CEST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1695380145; x=1726916145; h=date:from:to:cc:subject:message-id:references: in-reply-to:mime-version; bh=Rh0TVzzsJdYWec7oZP/HrFKABEXUB/Jh4zy7einfn8k=; b=I3yTMWL6wiHFcZpeYEPCh5/oOFRRJWluRDfWiHvmKR1NvyO5UMbtC7CP MuLo6ID0q85BOHqYVNlb9AwPrKJKBtPK4QnJpT3OwmNC8Cyz/ItQdqF/Z FdSRNeg7vHF44APh/kaEhTsuwWLcyDotNeldFzcz5YuiE3aXqNyE9eeu/ EyyVXwa/KZy4rT+PTH/Ckwn4Jjn3ex9i8TCY6l/qbhRKB6BfrvwbT0VF7 2TxvLqmvjZO2qWdAi7mQfKeQatWUo1GZot804mk4RnG8GEANJKsAPcWlj BmcKUU2E4cmeyrq6+gGUmlmuHR7rsNArVUpi69fmCpk4ntgCTbCHxStma w==; X-IronPort-AV: E=McAfee;i="6600,9927,10840"; a="447278464" X-IronPort-AV: E=Sophos;i="6.03,167,1694761200"; d="scan'208";a="447278464" Received: from fmsmga007.fm.intel.com ([10.253.24.52]) by orsmga105.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 22 Sep 2023 03:55:44 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=McAfee;i="6600,9927,10840"; a="750806014" X-IronPort-AV: E=Sophos;i="6.03,167,1694761200"; d="scan'208";a="750806014" Received: from fmsmsx603.amr.corp.intel.com ([10.18.126.83]) by fmsmga007.fm.intel.com with ESMTP/TLS/AES256-GCM-SHA384; 22 Sep 2023 03:55:43 -0700 Received: from fmsmsx612.amr.corp.intel.com (10.18.126.92) by fmsmsx603.amr.corp.intel.com (10.18.126.83) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2507.32; Fri, 22 Sep 2023 03:55:43 -0700 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.32; Fri, 22 Sep 2023 03:55:43 -0700 Received: from fmsedg602.ED.cps.intel.com (10.1.192.136) 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.32 via Frontend Transport; Fri, 22 Sep 2023 03:55:43 -0700 Received: from NAM12-DM6-obe.outbound.protection.outlook.com (104.47.59.174) 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.2507.32; Fri, 22 Sep 2023 03:55:42 -0700 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=HUydSi8DYcw0YXIYDKT+IUqCYtSpl1TnoTx3iu992Y1EwuVNOjY8++vAnKEbC+NGXWFP3V2/O4i57MmoL6U3rfrMku1hIho6QGueeImNtCJ3ER5OrtNaqQp151/pLeHtp9uxQGxdX4q3JUAydWekkInb6hRSwhyV5L06WVsMTARvG/VyTd5NXqm2lNQMEORVdG4GeKMXOl/CJ0h6loD7NbMd/YI8QXdK3TD1R5/hZ0x8EHDbylAH1lAFSkOWWctkr+q4eoC12ApwOW23rzq37NkZqHLLTEDsq22Fmq34PZqYtgjC3c/Wlh8gEmGSbY9tkY931SrxusrXUF47dUv6GA== 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=LPSpGZ6BSaDBBWGk0aH46n9zXAM31tANQ0hA/giMyNs=; b=DmnCeNfMplhONqvZFigq2v+ssp79DiEaO42eUhbIjsCoQkPCf71YsaECKniOrAiboV4CTNGjZJkt3Y6v2gIlM2Q2SEUQKv3aX3AMh/j6XqcHhiZjX7SyItaIaFMUoTiGgvTH+fzeGmePeEgXsPBhTypls7yRDYcDYS4FKrW6IQghDuxOzk1nCNi8W71FYFlSDPmdESkAXe57GmgK7WjxpF0z0jeJ/MDyoDChrGplpXLb4CN8X1Ses45GL/jeHNuuzfMP0ALF48NF5QuSYNWKP5SfRcxi2vLgEgxKgLkGNmowhTsIq8S9tIwkwaS/OX11tX5l/odAVbh336KsvDVFHQ== 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 CY5PR11MB6534.namprd11.prod.outlook.com (2603:10b6:930:42::14) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.6792.30; Fri, 22 Sep 2023 10:55:36 +0000 Received: from DS0PR11MB7309.namprd11.prod.outlook.com ([fe80::43d1:af60:464:347]) by DS0PR11MB7309.namprd11.prod.outlook.com ([fe80::43d1:af60:464:347%5]) with mapi id 15.20.6768.029; Fri, 22 Sep 2023 10:55:36 +0000 Date: Fri, 22 Sep 2023 11:55:28 +0100 From: Bruce Richardson To: David Marchand CC: , , , , , , , , Subject: Re: [PATCH 1/2] eal: introduce x86 processor identification Message-ID: References: <20230922093722.2057688-1-david.marchand@redhat.com> <20230922093722.2057688-2-david.marchand@redhat.com> Content-Type: text/plain; charset="us-ascii" Content-Disposition: inline In-Reply-To: X-ClientProxiedBy: DU6P191CA0037.EURP191.PROD.OUTLOOK.COM (2603:10a6:10:53f::16) To DS0PR11MB7309.namprd11.prod.outlook.com (2603:10b6:8:13e::17) MIME-Version: 1.0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: DS0PR11MB7309:EE_|CY5PR11MB6534:EE_ X-MS-Office365-Filtering-Correlation-Id: f924d8ba-2658-4d77-83a6-08dbbb5a737e X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: UE4C3QNswgCUf482PRdfWOOLTUq3qgUHSbUqOwqsAHj34JI8hC4fOWLCaTRbh4T+xKtWU093gCcF1k9UHC+oQkSyfBPOc/+8jFODSCWwFjDdv0uESeydxfeLXJz7zNX2N49bBvAjLMasVjt/GSeMLMcGzqxpIbuWce9Fbd1rp1Wa6lUUPKRwFUK3TKzRWIf01TmuFtJKRCFtlmwHA/Hsx1PYM1bUFT0F61GCB2xTEE7gX2E5uWf3qhQSuK/2CLVLSXVwjoccyX2D2Oh16/3256RtVkEXuHGOg+iD0BBgGkrj7w/kG147zW8Yy9RTcXBILRsVez1P4Zam5lv6VJMvD1pXPPJKvwMuJeRe0AcJHH3+S86n8oO3Gqn8O0Hzn0jEcSsMfVTAr0QPRl5xg73tuw0Er2+jQ7Fok67028ohHkDRSnorhgLPAYkhGpl0dXfkmFWRXxX4ZphDTaetMMZvvVl73hxUOMyP+BefC37bOvYuzTiRVgizMKm3VLiGT7RoiZC8Qm89zZAKR/CVge0xD80IC6gN7cm6VdA9tUk8nq1An6QtzimlcVpfakDWJ7JW 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)(136003)(366004)(376002)(346002)(39860400002)(396003)(451199024)(1800799009)(186009)(6506007)(6486002)(4326008)(6666004)(82960400001)(38100700002)(86362001)(26005)(2906002)(6512007)(478600001)(41300700001)(8936002)(5660300002)(44832011)(8676002)(7416002)(66556008)(6916009)(66946007)(316002)(66476007); DIR:OUT; SFP:1102; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: =?us-ascii?Q?q0cMSPjTxgMK86zxG5pr2fA7Rnr59FM2XbE/uewt98DXAAwkQhpVyMxNFUkX?= =?us-ascii?Q?1jGvxkq4/h5fFc/SbXist9E5HhzOC6SkvILeVfGi6+FxPK4SKZtiemXSJnVN?= =?us-ascii?Q?VwkXwHUH2kq1FjOCipI7/QWPws70JnTqITQsf/6H2UmF5nhJmuOFKkcfE2L5?= =?us-ascii?Q?mkdDh/pl/CyC+vADmJWwgmKHT0BnWHhc+8Tlgq6yjd232HvJxplp3uc/5JxU?= =?us-ascii?Q?WPGGcfjF8ZZ2up2BEC0mqEm0pGsg/zCvnUwc6dtiAgaljLKDejpb39xZupqv?= =?us-ascii?Q?6sbtyzTAFcLJtgm/oQX4yyBU36HpOIZfctGgW57Awi110zuW8b8pdzKRlS+9?= =?us-ascii?Q?QkO7h+ctW5IuVvdfMJXMx5mVHYn8UTepcfQpnTfjY84gcOSiaDlUWt4W5QSy?= =?us-ascii?Q?kEbNSIRkzmAb7xQfVygCEN+EvpUfBuXcts8rj9YshKuVoVqSnL+sL59DqFlg?= =?us-ascii?Q?3xSnxXagSLJ52iRQWCO14zmZ/SaUOLJbh+u/a89ublKKE/xIr72Feq7NCFq+?= =?us-ascii?Q?soF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rpAX5D?= =?us-ascii?Q?5idhlC1KE8U/2q5rMsemMpbfIBaSB1m0tA8LaplJ5uRWv7DT7tUYajJoziaf?= =?us-ascii?Q?bBtXD6xjH4NvYYBHU/og1kVNXU9cDX30qeDF1gTJ+TY/1Px9oOSIL6AAp2ZD?= =?us-ascii?Q?qH2xJFd1Qq3hPFQbs8wK7hq7yPupoVLvIUyJrzdlWUSUKag9gOcXy4qdKHAF?= =?us-ascii?Q?qQ=3D=3D?= X-MS-Exchange-CrossTenant-Network-Message-Id: f924d8ba-2658-4d77-83a6-08dbbb5a737e X-MS-Exchange-CrossTenant-AuthSource: DS0PR11MB7309.namprd11.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 22 Sep 2023 10:55:36.3705 (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: ZVBieEMVx6aL8jWJWuqYL1ZCVjJqIZvJTf5lxJnj44dVDgEAsDmeAzjILHtAP7PR/BBlzKVFd9yUpE7yjtMlxACxyLUAHC+5uttBeDJW1Nk= X-MS-Exchange-Transport-CrossTenantHeadersStamped: CY5PR11MB6534 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 Fri, Sep 22, 2023 at 11:38:38AM +0100, Bruce Richardson wrote: > On Fri, Sep 22, 2023 at 11:37:20AM +0200, David Marchand wrote: > > In some really specific cases, it may be needed to get a detailed > > information on the processor running a DPDK application for drivers to > > achieve better performance, or for matters that concern only them. > > > > Those information are highly arch-specific and require a specific API. > > > > Introduce a set of functions to get brand, family and model of a x86 > > processor. > > Those functions do not make sense on other arches and a > > driver must first check rte_cpu_is_x86() before anything else. > > > > Signed-off-by: David Marchand > > --- > > Couple of thoughts, having had a few minutes to process this. > > * Rather than rte_cpu_is_x86() API, we could go a general API called > rte_cpu_arch() which returns either a string, or an enum value. Within > that, rather than #ifdefs, the actual return value could just be a define > placed by meson in the rte_build_config.h file. The list of families > according to meson are [1] - we'd just need to merge the 32 and 64-bit > variants into one in the meson file. > We already have the architecture family in meson computed as the "arch_subdir". Exposing that to the C code and wrapping as EAL function might look like below (adding to eal.h for convenience). Thoughts? /Bruce diff --git a/lib/eal/include/rte_eal.h b/lib/eal/include/rte_eal.h index 53c4a5519e..39f65d0e0c 100644 --- a/lib/eal/include/rte_eal.h +++ b/lib/eal/include/rte_eal.h @@ -517,6 +517,24 @@ __rte_internal int rte_eal_parse_coremask(const char *coremask, int *cores); +enum rte_arch_family { + rte_cpu_arch_arm, + rte_cpu_arch_loongarch, + rte_cpu_arch_ppc, + rte_cpu_arch_riscv, + rte_cpu_arch_x86, +}; + +/** + * Return the architecture family of the current CPU + */ +static inline enum rte_arch_family +rte_eal_get_arch_family(void) +{ + /* take value from build config set by meson */ + return RTE_ARCH_FAMILY; +} + #ifdef __cplusplus } #endif diff --git a/meson.build b/meson.build index 2e6e546d20..45e22daeb1 100644 --- a/meson.build +++ b/meson.build @@ -63,6 +63,7 @@ elif host_machine.cpu_family().startswith('ppc') elif host_machine.cpu_family().startswith('riscv') arch_subdir = 'riscv' endif +dpdk_conf.set('RTE_ARCH_FAMILY', 'rte_cpu_arch_' + arch_subdir) # configure the build, and make sure configs here and in config folder are # able to be included in any file. We also store a global array of include dirs