From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from dpdk.org (dpdk.org [92.243.14.124]) by inbox.dpdk.org (Postfix) with ESMTP id 64F8CA04BC; Thu, 8 Oct 2020 15:07:42 +0200 (CEST) Received: from [92.243.14.124] (localhost [127.0.0.1]) by dpdk.org (Postfix) with ESMTP id 42CE51BFEE; Thu, 8 Oct 2020 15:07:41 +0200 (CEST) Received: from mga06.intel.com (mga06.intel.com [134.134.136.31]) by dpdk.org (Postfix) with ESMTP id 579D21BFD6 for ; Thu, 8 Oct 2020 15:07:39 +0200 (CEST) IronPort-SDR: ohq9awkzxmJNhbxLv+8Vh9xuIrMDXH4MCavETb5tUvfWrj7QYyFn/k2r8ZnwkiY4/IuVeeAe9y FsJp5LHQJAlA== X-IronPort-AV: E=McAfee;i="6000,8403,9767"; a="226976613" X-IronPort-AV: E=Sophos;i="5.77,350,1596524400"; d="scan'208";a="226976613" X-Amp-Result: SKIPPED(no attachment in message) X-Amp-File-Uploaded: False Received: from fmsmga005.fm.intel.com ([10.253.24.32]) by orsmga104.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 08 Oct 2020 06:07:37 -0700 IronPort-SDR: qSe+qyO9Eu3+PtoaEvzA+tvgmdBTDFTbAGjBmj1W8qNTdhvT9Zj2gbiFhacatQnRT6/yVBiaCW HE5530MGIyQg== X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.77,350,1596524400"; d="scan'208";a="519341023" Received: from orsmsx603.amr.corp.intel.com ([10.22.229.16]) by fmsmga005.fm.intel.com with ESMTP; 08 Oct 2020 06:07:36 -0700 Received: from orsmsx601.amr.corp.intel.com (10.22.229.14) by ORSMSX603.amr.corp.intel.com (10.22.229.16) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.1713.5; Thu, 8 Oct 2020 06:07:36 -0700 Received: from ORSEDG601.ED.cps.intel.com (10.7.248.6) by orsmsx601.amr.corp.intel.com (10.22.229.14) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.1713.5 via Frontend Transport; Thu, 8 Oct 2020 06:07:36 -0700 Received: from NAM02-BL2-obe.outbound.protection.outlook.com (104.47.38.54) by edgegateway.intel.com (134.134.137.102) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.1.1713.5; Thu, 8 Oct 2020 06:07:31 -0700 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=KNATAFxuqHJyhlk52aKfuhqKPmsWLr1WVnwvWcHMdvRckPzoPq9aqgV74genCIevuC0bloXd7iF9wdy32ZYE9UqLZxL9RO3i3RYwXZxoP/hDGol9KZdR+LDwIFsWfVMtOa45pzIx05zYQCRZQysM6OjNV7OxrF3xKdYm3pW3HaKftO+Dch4O/fMX6niesQElPVhxiGVXcdw5ho4HBH9Gf/fcbVLG7QyVFAUENKAUrAf4FX7Lv7kuYawBIfmC0OUfGj/Z6FBsBsXnKbUyXJ5bZ2extZgfIYOAQuz9Y8Gw6yVPhbvCBScVr0mr5yWJNRQw861lUoBto2Sxm35VOyn42g== 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-SenderADCheck; bh=hmicd6XETz1h70W/oGJ2hwi0M4yA5+N04tDsojETADw=; b=fn6xOmJxbWaXDngC3CPxeCYXShRqemC1hv83KJvmK9xz2eBW+xkz2M8bNzF6+RMbX62O4O7EwqLJwLImrM3+yZrqzY9cvgucIroHV+kjLJ8Y6eRh/0w/xsjqiH0CT/Qgmbh1ZbPrhFX4A9P1Cje1rSLasTZqTMIcYro2yu5BSEYnmXnNUfA6lrUjTGaXOH1bYa9UKX8OKGqSxVOUn97wA6BwH8ux+ZXZTmTqajA3V0fFBkG5yAVjerwuugne6Ffu/Hdmr4ut4l6gFtqzrZIUCMgChxaN3DbGHJep3FLKIptALFQQJvssCdD0IvkpsFRXXoqk/9LGrXdxp083sraPgA== 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=hmicd6XETz1h70W/oGJ2hwi0M4yA5+N04tDsojETADw=; b=QbSLZtraWHILE8prsLefrkq4NIUhuljkCk4ewlGTqB8m5Eg21CdbwQWMM45JYchSFYAwZbUTxcfgw3VlvvMzgIhuM12ceovKrMX+LKbUxOyvOuSbOYAUMF88lUgUvMJdINtA8XIVUO7CsMzpvrAHQgQzoaFc1hNcgDWbe60cwJs= Received: from BYAPR11MB3301.namprd11.prod.outlook.com (2603:10b6:a03:7f::26) by SJ0PR11MB4784.namprd11.prod.outlook.com (2603:10b6:a03:2da::6) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.3433.34; Thu, 8 Oct 2020 13:07:26 +0000 Received: from BYAPR11MB3301.namprd11.prod.outlook.com ([fe80::f5a4:3f6b:ade3:296b]) by BYAPR11MB3301.namprd11.prod.outlook.com ([fe80::f5a4:3f6b:ade3:296b%3]) with mapi id 15.20.3455.023; Thu, 8 Oct 2020 13:07:26 +0000 From: "Ananyev, Konstantin" To: "Power, Ciara" , "dev@dpdk.org" CC: "Power, Ciara" , Ray Kinsella , Neil Horman Thread-Topic: [dpdk-dev] [PATCH v3 01/18] eal: add max SIMD bitwidth Thread-Index: AQHWlyrgifleGyJmz0qg4Mb6fmx12qmNtWnw Date: Thu, 8 Oct 2020 13:07:26 +0000 Message-ID: References: <20200807155859.63888-1-ciara.power@intel.com> <20200930130415.11211-1-ciara.power@intel.com> <20200930130415.11211-2-ciara.power@intel.com> In-Reply-To: <20200930130415.11211-2-ciara.power@intel.com> Accept-Language: en-GB, en-US Content-Language: en-US X-MS-Has-Attach: X-MS-TNEF-Correlator: dlp-product: dlpe-windows dlp-reaction: no-action dlp-version: 11.5.1.3 authentication-results: intel.com; dkim=none (message not signed) header.d=none;intel.com; dmarc=none action=none header.from=intel.com; x-originating-ip: [46.7.39.127] x-ms-publictraffictype: Email x-ms-office365-filtering-correlation-id: 6f5412fd-4d7d-49a3-04ea-08d86b8b1af1 x-ms-traffictypediagnostic: SJ0PR11MB4784: x-ms-exchange-transport-forked: True x-microsoft-antispam-prvs: x-ms-oob-tlc-oobclassifiers: OLM:7219; x-ms-exchange-senderadcheck: 1 x-microsoft-antispam: BCL:0; x-microsoft-antispam-message-info: 7laE/NE8FiscxEXXPNNRGtlfmCtVS00J6p3WlP0g0RjjS7qhzTRAMobF9eUsS1E0tLtO12PZ5KohIEaQ5I1tvqt4mgATScya/EyIBPTgCEvuRLpshXvZ6SfnM3A3LI0n7EG9xGYhkrbdZN8Uvb9P1kNJ+d0jst65YmOHkv6qHErN39769ZDx9SAhGtb0gRYRjvVSvSzOCLjnaF4afbHZZ8mpAlD8dCceKnj/lPUt76p6sCVGv2W/1if+yyZTj0YvdSOB7ZNGC8WFWorqq7oYZiY0GRwa9jqSuxDvgvQVRc4TsFMfAw1pgEnCHQfamto20/nkHLL6f6G9TkmZSzspNw== x-forefront-antispam-report: CIP:255.255.255.255; CTRY:; LANG:en; SCL:1; SRV:; IPV:NLI; SFV:NSPM; H:BYAPR11MB3301.namprd11.prod.outlook.com; PTR:; CAT:NONE; SFS:(4636009)(39860400002)(346002)(136003)(376002)(396003)(366004)(4326008)(2906002)(9686003)(33656002)(55016002)(5660300002)(8676002)(8936002)(478600001)(54906003)(26005)(316002)(6506007)(110136005)(86362001)(66946007)(83380400001)(71200400001)(66556008)(64756008)(66446008)(52536014)(76116006)(186003)(66476007)(7696005); DIR:OUT; SFP:1102; x-ms-exchange-antispam-messagedata: Iy5/d5CBg0nHOmxOJcyUXi/+OYnLGHgMlpyT8tQSBVADjbP4OBuj1KY5QDrlPTmo8Kh/qn3qwfpg0DniQ1HqNA+kL5dd9+jLr/o3rPgTEmYeRxe47rvlWAdeJaY6VsF4SI2szg3HDOAPkUikz0rV2lcyobWjbcpau6rkbp+W0DMP47VSLhxqGbbfk5EPIaW7/7RkOAY3LNy9IVE1XZf/RWsHTLJGY4zuU78iDhYpEZtxW/hXAQ4MJha+hb7hrO+f7Gl2mutFyy+41r3cQKdvQ/ANc4lCeoWeONIAxblUzvEGaTy8mfV3wkruxAaaVgD7Ne/5yP6eAlW6Yrs937yWX9eAnhHEoQFugBR13+nNUZrQous5ZlxSYWwB8OIKbAS7alub3zeyOEWdwCvmURcHnKMvsTI0cR8ET2wYO5IYrqlwnm0d08FJAonfC/7cMkZ3UlU0nuaqER/XvNO5kNaHXXsiZeNyPR/yh2ucBIqEcaeXQ9AJJ0cusgrk2WG7rvlLK2HSUwFh9y7eGmNANz/IWPz0iGqmKWrCAp6ELINS8lXvplUxdg0aWe+qBesIhDDyUN02022WVZ1B3Rmob/l0IMVCy8NIGL1T3A5QnpF5D001utWOebAzYx/F7dlTFRzFevd4svV3hfuIa1e6hjEJig== Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: quoted-printable MIME-Version: 1.0 X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-AuthSource: BYAPR11MB3301.namprd11.prod.outlook.com X-MS-Exchange-CrossTenant-Network-Message-Id: 6f5412fd-4d7d-49a3-04ea-08d86b8b1af1 X-MS-Exchange-CrossTenant-originalarrivaltime: 08 Oct 2020 13:07:26.7925 (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: 2raVr2QYnPtXAYdPJIOFLW+cqYr0Jev/dCpUsey3MZJOPs3Z/VDnrFmNl4nZHc3mTHSbaD2owOvvLKUr+Pa/S3WTwT1T5YZevjeTWVs5GyQ= X-MS-Exchange-Transport-CrossTenantHeadersStamped: SJ0PR11MB4784 X-OriginatorOrg: intel.com Subject: Re: [dpdk-dev] [PATCH v3 01/18] eal: add max SIMD bitwidth X-BeenThere: dev@dpdk.org X-Mailman-Version: 2.1.15 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" > This patch adds a max SIMD bitwidth EAL configuration. The API allows > for an app to set this value. It can also be set using EAL argument > --force-max-simd-bitwidth, which will lock the value and override any > modifications made by the app. >=20 > Signed-off-by: Ciara Power >=20 > --- > v3: > - Added enum value to essentially disable using max SIMD to choose > paths, intended for use by ARM SVE. > - Fixed parsing bitwidth argument to return an error for values > greater than uint16_t. > v2: Added to Doxygen comment for API. > --- > lib/librte_eal/common/eal_common_options.c | 64 ++++++++++++++++++++++ > lib/librte_eal/common/eal_internal_cfg.h | 8 +++ > lib/librte_eal/common/eal_options.h | 2 + > lib/librte_eal/include/rte_eal.h | 33 +++++++++++ > lib/librte_eal/rte_eal_version.map | 4 ++ > 5 files changed, 111 insertions(+) >=20 > diff --git a/lib/librte_eal/common/eal_common_options.c b/lib/librte_eal/= common/eal_common_options.c > index a5426e1234..e9117a96af 100644 > --- a/lib/librte_eal/common/eal_common_options.c > +++ b/lib/librte_eal/common/eal_common_options.c > @@ -102,6 +102,7 @@ eal_long_options[] =3D { > {OPT_MATCH_ALLOCATIONS, 0, NULL, OPT_MATCH_ALLOCATIONS_NUM}, > {OPT_TELEMETRY, 0, NULL, OPT_TELEMETRY_NUM }, > {OPT_NO_TELEMETRY, 0, NULL, OPT_NO_TELEMETRY_NUM }, > + {OPT_FORCE_MAX_SIMD_BITWIDTH, 1, NULL, OPT_FORCE_MAX_SIMD_BITWIDTH_NUM}= , > {0, 0, NULL, 0 } > }; >=20 > @@ -1309,6 +1310,34 @@ eal_parse_iova_mode(const char *name) > return 0; > } >=20 > +static int > +eal_parse_simd_bitwidth(const char *arg, bool locked) > +{ > + char *end; > + unsigned long bitwidth; > + int ret; > + struct internal_config *internal_conf =3D > + eal_get_internal_configuration(); > + > + if (arg =3D=3D NULL || arg[0] =3D=3D '\0') > + return -1; > + > + errno =3D 0; > + bitwidth =3D strtoul(arg, &end, 0); > + > + /* check for errors */ > + if (bitwidth > UINT16_MAX || errno !=3D 0 || end =3D=3D NULL || *end != =3D '\0') > + return -1; > + > + if (bitwidth =3D=3D 0) > + bitwidth =3D UINT16_MAX; > + ret =3D rte_set_max_simd_bitwidth(bitwidth); > + if (ret < 0) > + return -1; > + internal_conf->max_simd_bitwidth.locked =3D locked; > + return 0; > +} > + > static int > eal_parse_base_virtaddr(const char *arg) > { > @@ -1707,6 +1736,13 @@ eal_parse_common_option(int opt, const char *optar= g, > case OPT_NO_TELEMETRY_NUM: > conf->no_telemetry =3D 1; > break; > + case OPT_FORCE_MAX_SIMD_BITWIDTH_NUM: > + if (eal_parse_simd_bitwidth(optarg, 1) < 0) { > + RTE_LOG(ERR, EAL, "invalid parameter for --" > + OPT_FORCE_MAX_SIMD_BITWIDTH "\n"); > + return -1; > + } > + break; >=20 > /* don't know what to do, leave this to caller */ > default: > @@ -1903,6 +1939,33 @@ eal_check_common_options(struct internal_config *i= nternal_cfg) > return 0; > } >=20 > +uint16_t > +rte_get_max_simd_bitwidth(void) > +{ > + const struct internal_config *internal_conf =3D > + eal_get_internal_configuration(); > + return internal_conf->max_simd_bitwidth.bitwidth; > +} > + > +int > +rte_set_max_simd_bitwidth(uint16_t bitwidth) > +{ > + struct internal_config *internal_conf =3D > + eal_get_internal_configuration(); > + if (internal_conf->max_simd_bitwidth.locked) { > + RTE_LOG(NOTICE, EAL, "Cannot set max SIMD bitwidth - user runtime over= ride enabled"); > + return -EPERM; > + } > + > + if (bitwidth !=3D RTE_MAX_SIMD_DISABLE && (bitwidth < RTE_NO_SIMD || > + !rte_is_power_of_2(bitwidth))) { > + RTE_LOG(ERR, EAL, "Invalid bitwidth value!\n"); > + return -EINVAL; > + } > + internal_conf->max_simd_bitwidth.bitwidth =3D bitwidth; > + return 0; > +} > + > void > eal_common_usage(void) > { > @@ -1981,6 +2044,7 @@ eal_common_usage(void) > " --"OPT_BASE_VIRTADDR" Base virtual address\n" > " --"OPT_TELEMETRY" Enable telemetry support (on by default)\= n" > " --"OPT_NO_TELEMETRY" Disable telemetry support\n" > + " --"OPT_FORCE_MAX_SIMD_BITWIDTH" Force the max SIMD bitwidth\n= " > "\nEAL options for DEBUG use only:\n" > " --"OPT_HUGE_UNLINK" Unlink hugepage files after init\n" > " --"OPT_NO_HUGE" Use malloc instead of hugetlbfs\n" > diff --git a/lib/librte_eal/common/eal_internal_cfg.h b/lib/librte_eal/co= mmon/eal_internal_cfg.h > index 13f93388a7..367e0cc19e 100644 > --- a/lib/librte_eal/common/eal_internal_cfg.h > +++ b/lib/librte_eal/common/eal_internal_cfg.h > @@ -33,6 +33,12 @@ struct hugepage_info { > int lock_descriptor; /**< file descriptor for hugepage dir */ > }; >=20 > +struct simd_bitwidth { > + /**< flag indicating if bitwidth is locked from further modification */ > + bool locked; > + uint16_t bitwidth; /**< bitwidth value */ > +}; > + > /** > * internal configuration > */ > @@ -85,6 +91,8 @@ struct internal_config { > volatile unsigned int init_complete; > /**< indicates whether EAL has completed initialization */ > unsigned int no_telemetry; /**< true to disable Telemetry */ > + /** max simd bitwidth path to use */ > + struct simd_bitwidth max_simd_bitwidth; > }; >=20 > void eal_reset_internal_config(struct internal_config *internal_cfg); > diff --git a/lib/librte_eal/common/eal_options.h b/lib/librte_eal/common/= eal_options.h > index 89769d48b4..ef33979664 100644 > --- a/lib/librte_eal/common/eal_options.h > +++ b/lib/librte_eal/common/eal_options.h > @@ -85,6 +85,8 @@ enum { > OPT_TELEMETRY_NUM, > #define OPT_NO_TELEMETRY "no-telemetry" > OPT_NO_TELEMETRY_NUM, > +#define OPT_FORCE_MAX_SIMD_BITWIDTH "force-max-simd-bitwidth" > + OPT_FORCE_MAX_SIMD_BITWIDTH_NUM, > OPT_LONG_MAX_NUM > }; >=20 > diff --git a/lib/librte_eal/include/rte_eal.h b/lib/librte_eal/include/rt= e_eal.h > index ddcf6a2e7a..fb739f3474 100644 > --- a/lib/librte_eal/include/rte_eal.h > +++ b/lib/librte_eal/include/rte_eal.h > @@ -43,6 +43,14 @@ enum rte_proc_type_t { > RTE_PROC_INVALID > }; >=20 > +enum rte_max_simd_t { > + RTE_NO_SIMD =3D 64, While I do understand the idea of having that value from consistency point = of view, I wonder do we really need to allow user to specify values smaller then 128= . At least on x86 we always have 128 bit SIMD enabled, even for -Dmachine=3Dd= efault. So seems no much point to forbid libraries using SSE code-path when compile= r is free to insert SSE instructions on its own will. =20 > + RTE_MAX_128_SIMD =3D 128, > + RTE_MAX_256_SIMD =3D 256, > + RTE_MAX_512_SIMD =3D 512, > + RTE_MAX_SIMD_DISABLE =3D UINT16_MAX, As a nit, I think it is safe enough to have this last value=20 (RTE_MAX_SIMD_DISABLE or RTE_MAX_SIMD_MAX) equal to (INT16_MAX + 1). That would be big enough to probably never hit actual HW limit, while it still remains power of two, as other values.=20 > +}; > + > /** > * Get the process type in a multi-process setup > * > @@ -51,6 +59,31 @@ enum rte_proc_type_t { > */ > enum rte_proc_type_t rte_eal_process_type(void); >=20 > +/** > + * Get the supported SIMD bitwidth. > + * > + * @return > + * uint16_t bitwidth. > + */ > +__rte_experimental > +uint16_t rte_get_max_simd_bitwidth(void); > + > +/** > + * Set the supported SIMD bitwidth. > + * This API should only be called once at initialization, before EAL ini= t. > + * > + * @param bitwidth > + * uint16_t bitwidth. > + * @return > + * 0 on success. > + * @return > + * -EINVAL on invalid bitwidth parameter. > + * @return > + * -EPERM if bitwidth is locked. > + */ > +__rte_experimental > +int rte_set_max_simd_bitwidth(uint16_t bitwidth); > + > /** > * Request iopl privilege for all RPL. > * > diff --git a/lib/librte_eal/rte_eal_version.map b/lib/librte_eal/rte_eal_= version.map > index c32461c663..17a7195a3d 100644 > --- a/lib/librte_eal/rte_eal_version.map > +++ b/lib/librte_eal/rte_eal_version.map > @@ -397,6 +397,10 @@ EXPERIMENTAL { > rte_service_lcore_may_be_active; > rte_thread_register; > rte_thread_unregister; > + > + # added in 20.11 > + rte_get_max_simd_bitwidth; > + rte_set_max_simd_bitwidth; > }; >=20 > INTERNAL { > -- > 2.17.1