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 C50C2A04BC; Thu, 8 Oct 2020 16:08:08 +0200 (CEST) Received: from [92.243.14.124] (localhost [127.0.0.1]) by dpdk.org (Postfix) with ESMTP id 2F9811C10D; Thu, 8 Oct 2020 16:08:06 +0200 (CEST) Received: from mga05.intel.com (mga05.intel.com [192.55.52.43]) by dpdk.org (Postfix) with ESMTP id EDCAE1C002 for ; Thu, 8 Oct 2020 16:08:03 +0200 (CEST) IronPort-SDR: vy3TWprOAbAfbESszgpzjE6KwTdZo330U94hN6/rEiZ39SdUfKtopF2IT210iLhzFQdK/o/7CT /NZ4OlT84Z8g== X-IronPort-AV: E=McAfee;i="6000,8403,9767"; a="250032592" X-IronPort-AV: E=Sophos;i="5.77,351,1596524400"; d="scan'208";a="250032592" X-Amp-Result: SKIPPED(no attachment in message) X-Amp-File-Uploaded: False Received: from fmsmga004.fm.intel.com ([10.253.24.48]) by fmsmga105.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 08 Oct 2020 07:08:01 -0700 IronPort-SDR: 3QX4pPn+nS5+quugLermoMnWWi0ZdeR5aOTjvL1fg+N0syfuo/PCPrv39LXsxbL/pWJaWK9lV4 gAyCyzQ0HmfA== X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.77,351,1596524400"; d="scan'208";a="343423057" Received: from fmsmsx603.amr.corp.intel.com ([10.18.126.83]) by fmsmga004.fm.intel.com with ESMTP; 08 Oct 2020 07:08:01 -0700 Received: from fmsmsx611.amr.corp.intel.com (10.18.126.91) 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.1713.5; Thu, 8 Oct 2020 07:08:00 -0700 Received: from fmsmsx603.amr.corp.intel.com (10.18.126.83) by fmsmsx611.amr.corp.intel.com (10.18.126.91) 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 07:08:00 -0700 Received: from fmsedg601.ED.cps.intel.com (10.1.192.135) 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.1713.5 via Frontend Transport; Thu, 8 Oct 2020 07:08:00 -0700 Received: from NAM10-MW2-obe.outbound.protection.outlook.com (104.47.55.101) by edgegateway.intel.com (192.55.55.70) 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 07:07:57 -0700 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=QuC0jSh3eek5o4sE2mhT3ANhIT6Il825FVyNYGxxD7Gs7g0BKq1oTaQRnx77nRd1no/tkvaZyFhxOZMWmIlRkSyYw0RRh3scBP11ksmBj7mCmuVGH0r2ZjVnHNeiZ0g2C1Fh15tFf0Yg6HlS6zNyyZovHUxMlha7Db9jD+hV3U06ZHmuceBw5ZJxjOeKzc72jsEbVOZNIdcZN4jiuJWyUtL0XZLRsc/tVuDldlzbbPXsW+qScIphWTQsbBvYcvmCblwgdpbrL/A5Hu0CHrRksoq96YNWwSSTWGGF0kQ2xQnQH4btZ73sT9Xqogl7mFyy2OOTNX+wGE+Tt3tNZUuhWw== 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=iCNh9PSdJsrbtHCpI1vZaWpfsUV2knOaxGy+Ak3t9wg=; b=eQqfCVDDieoQcivm2/RAvramsxwfv/YhV+fXGR1fg5ueMLs09scrbCosRDbD8hB68S2Md9wa/Jw0lF1XvWJQ4fCljHe9KauierTZgERvdPkW8eUEwQvj3w0Wc9LGIQozpC0uloLj6o0T4ztIzppEabKUnZGWUhywYCiim2h524gIQBXdQWM9v+UWJ7QynAQdL81mBT15loH/VXHzW/yH4rHe2s5wIrMHKM3himsInHByntOtbsJ5ZZQ8RxN8Hwv1XEhSkQOZjiunyG2CQP5Lb9Nnpw+LPtuepbw56DBO+mjKTfV3lC/GU3+Jx2CNFQ+26ToFfJ48aOL15/o6yhWbSw== 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=iCNh9PSdJsrbtHCpI1vZaWpfsUV2knOaxGy+Ak3t9wg=; b=a8caO+byfMQBXuJpxh/T4Fb4qQf57raFW8jKwVuRC0z+HshcbrJliAvcbeZa8k639+yAkGfBESvbgQp3rzJwgUzJMVKCszRyfcR+N1kt8qGjlDkn5yO9FsDCeipcbEVUepJjoGD6zHgK4YGKUx2A/XJ3BeFwXwPWo/UvpEUFwAw= Received: from BYAPR11MB3301.namprd11.prod.outlook.com (2603:10b6:a03:7f::26) by SJ0PR11MB4829.namprd11.prod.outlook.com (2603:10b6:a03:2d3::22) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.3455.21; Thu, 8 Oct 2020 14:07:54 +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 14:07:54 +0000 From: "Ananyev, Konstantin" To: "Richardson, Bruce" CC: "Power, Ciara" , "dev@dpdk.org" , "Ray Kinsella" , Neil Horman Thread-Topic: [dpdk-dev] [PATCH v3 01/18] eal: add max SIMD bitwidth Thread-Index: AQHWlyrgifleGyJmz0qg4Mb6fmx12qmNtWnwgAAGDICAAAwvoA== Date: Thu, 8 Oct 2020 14:07:54 +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> <20201008131405.GD1106@bricha3-MOBL.ger.corp.intel.com> In-Reply-To: <20201008131405.GD1106@bricha3-MOBL.ger.corp.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: ee7d7015-68fa-4a6a-3bd0-08d86b938d25 x-ms-traffictypediagnostic: SJ0PR11MB4829: x-ld-processed: 46c98d88-e344-4ed4-8496-4ed7712e255d,ExtAddr x-ms-exchange-transport-forked: True x-microsoft-antispam-prvs: x-ms-oob-tlc-oobclassifiers: OLM:10000; x-ms-exchange-senderadcheck: 1 x-microsoft-antispam: BCL:0; x-microsoft-antispam-message-info: /t1EOLGvx64p/sFUz53NjHWX20X1pF05/txTKt9/G6EagRGN4+M1xjPMXy7im9aGucbeJwmPv71af3Bmk1WrfkeXpm8GJi+5gLLyptKl2a9xpZvQSpOkBUgHcZkz16rVuC+0Xyd7R+Mawpk5ai+PkDYyxGaeyXI+U7tNn7f81J1UpU5C1FS4TKOIQHdY8kruNV2ChVc/Ao2c4kXdx3KkP4Gmwn9dTWGtkD3/V0g/lyzuGUFMUW0k59qorlWSCiiVIvNqgWRvJSDTEZgNZ6NT3obRs7BfaASsLlEJFBxjsnfbvUpzQ7LksfImZ3Vwl8Ym/VYg4Dl73GOsvFI3cRVRdSOHGfDcZCnJQqkO8kjHS7HEI+dTSXcQrxfokfAHqreaVmB0zIr1cjWGPG+9oM/U/g== 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)(396003)(39860400002)(136003)(366004)(346002)(376002)(6636002)(76116006)(66556008)(66946007)(8936002)(33656002)(55016002)(7696005)(26005)(54906003)(71200400001)(5660300002)(52536014)(6506007)(186003)(83380400001)(9686003)(66476007)(966005)(64756008)(66446008)(2906002)(316002)(6862004)(4326008)(478600001)(8676002)(86362001)(83080400001); DIR:OUT; SFP:1102; x-ms-exchange-antispam-messagedata: 3MoOAOKDwpcdA7E0CwXGW82YVkjbEkov4a3NiqQFA/sr3k1LAmqJA4yLA7PYFhiMQEnl7Zw5qUNEtzkT5ax4H5uzHYgdvfa9sLZLL4aVU7SAHcQU/DrFbyn0ifOFrWBEHo6zOFclYT20a5jjI0BuYfS0nNjJgAq+aL88GvEMTuIvBDtuy+GdY8X0qUpz1fV6DCGowSL0vs6KZg+BUGrOwl+yr2xGi6BfmtzWTAxSlj/B/JWsqhzlc/gJMQIGPSqzo2Tc3K4iwgI+tWBbmAMzv7NbL3bzTyzYna/zdInp0OSObLMT9x9JFRB57aX879PYa9n6XAPHYi2gpOgF0L9bJZ7LmuFfCS0A4n2eHt/Hfs+rUwUlN7ST0+VVdnzWseMH5GXJB2DifG3cjEqqSC/LTBBd1hvnnvY8+pnYeoT+8+7dm5zkvvHfdZe7bylWXubWbS48hoo2I+RScS6cyyAABxc5+WBK76E9U2JX8UUujsAjdlWpDI4UP/nlhLpAySKMtji8fhF7MQDcVRJlgoyYUhbeWRnHWEFdfPyr22CFYgR3K7i9vU3X2yjyhI2HeQDm8SQ+uuuwtmrUkCivADoTIBPQwFdKn9SjG2Myeb+XKeiqYlfXIBuNENKsDOtHcvoqzc+28FeyMzw7gIaicn3C8w== 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: ee7d7015-68fa-4a6a-3bd0-08d86b938d25 X-MS-Exchange-CrossTenant-originalarrivaltime: 08 Oct 2020 14:07:54.3878 (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: Zh3ygYj1BNpvF/ZuJlKMBQSfwY2HIcvbQ84Vj05NKmqFuAyBGrS6hbYjQ8Byyl2kfoQ0BDQKWdqOLkK1ncxRjpKnwi9b+A9ed7B3m/6DKao= X-MS-Exchange-Transport-CrossTenantHeadersStamped: SJ0PR11MB4829 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" > On Thu, Oct 08, 2020 at 01:07:26PM +0000, Ananyev, Konstantin wrote: > > > > > 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. > > > > > > Signed-off-by: Ciara Power > > > > > > --- > > > 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(+) > > > > > > 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 } > > > }; > > > > > > @@ -1309,6 +1310,34 @@ eal_parse_iova_mode(const char *name) > > > return 0; > > > } > > > > > > +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 || *en= d !=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 *o= ptarg, > > > 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; > > > > > > /* don't know what to do, leave this to caller */ > > > default: > > > @@ -1903,6 +1939,33 @@ eal_check_common_options(struct internal_confi= g *internal_cfg) > > > return 0; > > > } > > > > > > +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 = override 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 defau= lt)\n" > > > " --"OPT_NO_TELEMETRY" Disable telemetry support\n" > > > + " --"OPT_FORCE_MAX_SIMD_BITWIDTH" Force the max SIMD bitwid= th\n" > > > "\nEAL options for DEBUG use only:\n" > > > " --"OPT_HUGE_UNLINK" Unlink hugepage files after ini= t\n" > > > " --"OPT_NO_HUGE" Use malloc instead of hugetlbfs= \n" > > > diff --git a/lib/librte_eal/common/eal_internal_cfg.h b/lib/librte_ea= l/common/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 */ > > > }; > > > > > > +struct simd_bitwidth { > > > + /**< flag indicating if bitwidth is locked from further modificatio= n */ > > > + 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; > > > }; > > > > > > void eal_reset_internal_config(struct internal_config *internal_cfg)= ; > > > diff --git a/lib/librte_eal/common/eal_options.h b/lib/librte_eal/com= mon/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 > > > }; > > > > > > diff --git a/lib/librte_eal/include/rte_eal.h b/lib/librte_eal/includ= e/rte_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 > > > }; > > > > > > +enum rte_max_simd_t { > > > + RTE_NO_SIMD =3D 64, > > > > While I do understand the idea of having that value from consistency po= int 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= =3Ddefault. > > So seems no much point to forbid libraries using SSE code-path when com= piler > > is free to insert SSE instructions on its own will. > > >=20 > The reason to support this is for testing purposes, as it allows an easy > way for a tester to check out any scalar code paths - which are often > common across architectures. If it is just for testing things in a consistent way, then it is probably = ok. The thing that worries me - later in this series there are patches that insert extra checks into inline functions that use SSE instincts: https://patches.dpdk.org/patch/79355/ (lpm: choose vector path at runtime). Which seems like a total overkill for me. >=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 > > (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 > I actually think it's probably clearer as-is, because the fact of the res= t > being powers of 2 is irrelevant since we just check greater than or less > than.=20 Well, rte_set_max_simd_bitwidth() does accept only power of two values _AND_ this special one (UINT16_MAX). By changing it to 2^15, we can remove that special value test. =20 > If we did change it, then we need to put in a comment explaining why > the plus-one,=20 I don't think it is that big deal to put a comment, plus for UINT16_MAX we do need some explanation too, right? >while as it is now it's clearly a placeholder $BIGNUM. >=20 > /Bruce