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 E5F73A0A0F; Wed, 30 Jun 2021 12:29:56 +0200 (CEST) Received: from [217.70.189.124] (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id 6577440141; Wed, 30 Jun 2021 12:29:56 +0200 (CEST) Received: from mga06.intel.com (mga06.intel.com [134.134.136.31]) by mails.dpdk.org (Postfix) with ESMTP id 3470040040 for ; Wed, 30 Jun 2021 12:29:55 +0200 (CEST) X-IronPort-AV: E=McAfee;i="6200,9189,10030"; a="269459079" X-IronPort-AV: E=Sophos;i="5.83,311,1616482800"; d="scan'208";a="269459079" Received: from fmsmga001.fm.intel.com ([10.253.24.23]) by orsmga104.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 30 Jun 2021 03:29:53 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.83,311,1616482800"; d="scan'208";a="559015180" Received: from fmsmsx604.amr.corp.intel.com ([10.18.126.84]) by fmsmga001.fm.intel.com with ESMTP; 30 Jun 2021 03:29:53 -0700 Received: from fmsmsx612.amr.corp.intel.com (10.18.126.92) 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.4; Wed, 30 Jun 2021 03:29:53 -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.2242.4; Wed, 30 Jun 2021 03:29:52 -0700 Received: from FMSEDG603.ED.cps.intel.com (10.1.192.133) 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.2242.4 via Frontend Transport; Wed, 30 Jun 2021 03:29:52 -0700 Received: from NAM11-BN8-obe.outbound.protection.outlook.com (104.47.58.174) by edgegateway.intel.com (192.55.55.68) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.1.2242.4; Wed, 30 Jun 2021 03:29:52 -0700 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=LQYiMNv7hD/KVrN6HMMSEEzcFAJtR6bFG5mLg6iDGn8r52He0BrCkJDE9Hwgh8TplYvfai+JAJo8StWjdN3D0c17d7JxSQHCL4nmRd7KFC/r8sOn83dJSMFK0ny2kT4z7y430doMnXC5tc7F7eVBlubqiPAWkCXcPm+07tZjneIojv/yNizNvc6GXL3XhL8+CpZuarspFE2DKGewY3kdG7a2w3V28jYrqjFxByJI/E3Vmfae1rVJSplgoizlJzOrBJRENnEnOea7wukYuXw7/8bL/ZLFwsknnf1ELQYLn2AsUD8QDwhtIcoUW0Me9oPv+fIfw5CVpaDzaiQoCol2kg== 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=1xCIuvntBU2Bgg1RkT+f1HYxmMrF9niNzuipre/tyIo=; b=c0W8/LytROGbuFClu75fgKYIKVp1X9k/rffHr3qiwl2YU/wxOn8Afw53+eCxodY5qLYEbn872sYlHX916XK4UlV+Vkf4p4J6oSSgMFWaFXKL+h4U6wVe42NwZA86pTTPg0bb0MnNq4Se6lMfKRFgqiOtDVTwjnGYSWbnd+UtevwYW9S2b1VD84lachDhUeVUJ4T6MTDvHdscvw5IBbFUaUfz1zhxShwjdPWNZkN7PpDm/asYVE3FKhGzR7DHVGXVee6DMvYo6LYgvC8qYE+XSFzLvsyG3ozA+L7yn1DbkLIlLzm+6+IWyC8X8yPLO6L1Da9RJHpCwFNery7TBQKcoA== 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=1xCIuvntBU2Bgg1RkT+f1HYxmMrF9niNzuipre/tyIo=; b=KnQX7Ha8c2AzewCq5Zq7zu/ZxGHbVM0Xjom0OswIzv6Ika27Jt9EkdoH2p51CulN8Gk5AYUvvUB/FJSMhojOMgetPwTw48putz30xVcJT9zqCpE0Qsgx92iWpsmxRYBtA2WUwGDPeFLBY9PERde/eNXleVHK2cVFMK31V8SlNZ0= Received: from DM6PR11MB4491.namprd11.prod.outlook.com (2603:10b6:5:204::19) by DM6PR11MB4545.namprd11.prod.outlook.com (2603:10b6:5:2ae::14) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.4287.22; Wed, 30 Jun 2021 10:29:50 +0000 Received: from DM6PR11MB4491.namprd11.prod.outlook.com ([fe80::7dc4:66b0:f76b:6d48]) by DM6PR11MB4491.namprd11.prod.outlook.com ([fe80::7dc4:66b0:f76b:6d48%7]) with mapi id 15.20.4264.026; Wed, 30 Jun 2021 10:29:50 +0000 From: "Ananyev, Konstantin" To: "Burakov, Anatoly" , "dev@dpdk.org" , "Hunt, David" CC: "Loftus, Ciara" Thread-Topic: [PATCH v5 6/7] power: support monitoring multiple Rx queues Thread-Index: AQHXbP5Rmf8QV9wlMk2qi/yxdXnDaassWseQ Date: Wed, 30 Jun 2021 10:29:50 +0000 Message-ID: References: <351ec2cd10ee91e9497330447783ed8d26789aad.1624981670.git.anatoly.burakov@intel.com> In-Reply-To: <351ec2cd10ee91e9497330447783ed8d26789aad.1624981670.git.anatoly.burakov@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: [109.255.184.192] x-ms-publictraffictype: Email x-ms-office365-filtering-correlation-id: 5d531e2f-1009-4529-a398-08d93bb1fdc2 x-ms-traffictypediagnostic: DM6PR11MB4545: 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:5516; x-ms-exchange-senderadcheck: 1 x-microsoft-antispam: BCL:0; x-microsoft-antispam-message-info: VuacmEpXc9Cd9QeIUUMl0K3itkcZw0Cxof61Z4Q/0ZvMeuh/4qv1Sjcw6tXzg8HdZWmZVFg3D2SpmP2XUqITYCavrzb/cKDAy+FBzizjSBsfdXNdtxCVrZp5o/IWb5shLycVqquejOW3W62mbxdUG9HgcXc8Z8WYglFrlwp8Wb3SXBBszDsXQFvy0OLbFhQbX8bOirTyr2vHVbgXjrm0RkMI0ehWJ8guDnSSuaXwPnGXNwVTqTrAhZTAIuxoYT9SNOj0G/uij0tfY6Y2jbkpCjIZYPtTixS7u1dKMcNdDZ5UAzIM7BOFAcUQKdSvn8/zSJxdZIXjG6Y1sa6wL22LGxErLjIvoHzH95WWtOO3If33fjcu4e0SAkDlIWk1iIWbucMxEHVJHXHi5I0r76F52Bz27GpJyuBLepyIwPUG88TguSd+F9j90AI0mH2nRWnIMFCecPBRTbl8Uhm83KwAWEGBDgrogpA9PVR2az+WKgnm2avW/n+sg/0s4tgaH7+pTxl8vkg1lPt667BJnay8j2RMxrG6PS3isaeJjsdRt5xO2MNhzVrEvqBsqYVFEXkJqz4AM9wDYbtn0Hsj3USyY3a4sq0XwepIp+sQKMJft9lOxzLaClJE3IVUhlauvD13F2ibDuL/IexeVu30wQ5vrQ== x-forefront-antispam-report: CIP:255.255.255.255; CTRY:; LANG:en; SCL:1; SRV:; IPV:NLI; SFV:NSPM; H:DM6PR11MB4491.namprd11.prod.outlook.com; PTR:; CAT:NONE; SFS:(346002)(39860400002)(376002)(366004)(136003)(396003)(122000001)(55016002)(71200400001)(9686003)(107886003)(38100700002)(76116006)(6636002)(33656002)(66476007)(186003)(66946007)(66446008)(64756008)(66556008)(83380400001)(55236004)(8676002)(2906002)(52536014)(6506007)(86362001)(478600001)(8936002)(5660300002)(7696005)(4326008)(110136005)(26005)(316002); DIR:OUT; SFP:1102; x-ms-exchange-antispam-messagedata-chunkcount: 1 x-ms-exchange-antispam-messagedata-0: =?us-ascii?Q?TX01zCoOCsaTSBQccfG1sZEB15/1MkTjaoaoHgpXk51sux40+KBwU/+o3JwT?= =?us-ascii?Q?4f/sZrKcPfOAv4NdJQtOeiCaF2JkgurZqkIt16K6eZhSBdtXkscPlPRKvnpN?= =?us-ascii?Q?8JU8GYVdvfCAJHSHGCbbTKmyBxT8lhe4nhFKNVhh4v6/VKVr261UZ+W2yUFi?= =?us-ascii?Q?dbf0nmCJDcBBS+7LUxKnJl7sZsWLrVLhN9nKR589jCTSQnqCUgVVVCok//i/?= =?us-ascii?Q?b7o3tj+/J/++02Qfc89Rn1qgQWIYh+l6n2I2ej25mBeytSko4CZKJJ3JxYPZ?= =?us-ascii?Q?pipXhfTiocubrpjB3seGHOxDg8X3RKbTCJcfHjFTgP3cVl+TwY8ykJiWLzQQ?= =?us-ascii?Q?jWFlqZYtSollxrh5w5pEaryn/vbcLsdGczLbVYw6L6jO3d60m6is6K+WtFOx?= =?us-ascii?Q?xccturICBfvp3ClDvJOFM6wPI5s2O+oOeJtbDQdfR4ppLEPuWZqzy001OTtn?= =?us-ascii?Q?WC1CJjxsJFAZlm/iSM7VuLN0ty/2pm5g/Pc64a6dbOOvYKf2F3Gj+Rj4GISW?= =?us-ascii?Q?lI1iFYUeK7McQnWGwfUYxs28swwAEDN0b6kOl/E698IfJuweNzrwlMxdGTSA?= =?us-ascii?Q?DDLrAYdL5uu+yJNQk1vyr09jttd+Dfj1a7i0M8Fx4mHgVWV0xKQr89mXS8eb?= =?us-ascii?Q?RCybRsuQy0mQZoIOKHhlCA+QSLujuoYLGWtkfXFqLeW9J+4I9G0DYDW3Oqc7?= =?us-ascii?Q?AApxUS8/ez50FZWKN5QUQA3FtW1sE7YE/oDpW7ETwCY3rFD0AcdtmfEZ9iDb?= =?us-ascii?Q?+qA744RoXT0KHdJyKfx0XFUVC9SnguuXdy+KH9hl8tpQ5w38BObkGuSNlgPd?= =?us-ascii?Q?D8DKoGg/3WPfxQnBdGNTZYzVjxCuhYn9wVHiVQabiIFIjKlFiRsl4pNRBtvq?= =?us-ascii?Q?89nXlhS7Dq/nSRbpDMDTCdv7pwOMO66C+hxtsrvK9CeGDLrnjN0SMbVb7/q7?= =?us-ascii?Q?WQWJ81LHNwHEJmTouveRzyBdrZC0p/pXb8MquovHc6CPqpKCy8PoOvIQZjeu?= =?us-ascii?Q?8wFkrZgh5vlFSU1Ic3PxcHq7FlAQyo+o0lAmwjCZth3mn3jzZkbIg5GfP4/d?= =?us-ascii?Q?DbDXWebemLMkUtB10uhTtvQfD2d4ackPZ0dBPCCY/u7wMZcKwBVjmtHkdlKk?= =?us-ascii?Q?vI1hShwdcgFNbeVrWWml5DIezDv3+sRh0/LVvJMxl1Tep/DA37wLXk6di0CX?= =?us-ascii?Q?rFE1O2AX0FOa3MbWWdm7BHGpU9IRM0iakG6mdWRRWkc2vLNgrVaiJ2Ekq+c6?= =?us-ascii?Q?7aNsWwwaHf+t35/4YWPWF5gDPKbWtjyt0NbJzUIIai1bUGRreMT8pceW0NQn?= =?us-ascii?Q?v7P9lH7+dlLmtw+AXEm7wyCe?= 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: DM6PR11MB4491.namprd11.prod.outlook.com X-MS-Exchange-CrossTenant-Network-Message-Id: 5d531e2f-1009-4529-a398-08d93bb1fdc2 X-MS-Exchange-CrossTenant-originalarrivaltime: 30 Jun 2021 10:29:50.0878 (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: 6/An2mkCK/XDASxnTu03lgpZOn5gwRJSDbrtkFJoWqHED2KrbW4FRqSyPb3Iu3l8Blcz5HnZB2V9ug3tqjQf3+fngaKuEcwWI1oKqWaShFE= X-MS-Exchange-Transport-CrossTenantHeadersStamped: DM6PR11MB4545 X-OriginatorOrg: intel.com Subject: Re: [dpdk-dev] [PATCH v5 6/7] power: support monitoring multiple Rx queues 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" > Use the new multi-monitor intrinsic to allow monitoring multiple ethdev > Rx queues while entering the energy efficient power state. The multi > version will be used unconditionally if supported, and the UMWAIT one > will only be used when multi-monitor is not supported by the hardware. >=20 > Signed-off-by: Anatoly Burakov > --- >=20 > Notes: > v4: > - Fix possible out of bounds access > - Added missing index increment >=20 > doc/guides/prog_guide/power_man.rst | 9 ++-- > lib/power/rte_power_pmd_mgmt.c | 81 ++++++++++++++++++++++++++++- > 2 files changed, 85 insertions(+), 5 deletions(-) >=20 > diff --git a/doc/guides/prog_guide/power_man.rst b/doc/guides/prog_guide/= power_man.rst > index ec04a72108..94353ca012 100644 > --- a/doc/guides/prog_guide/power_man.rst > +++ b/doc/guides/prog_guide/power_man.rst > @@ -221,13 +221,16 @@ power saving whenever empty poll count reaches a ce= rtain number. > The "monitor" mode is only supported in the following configurations and= scenarios: >=20 > * If ``rte_cpu_get_intrinsics_support()`` function indicates that > + ``rte_power_monitor_multi()`` function is supported by the platform, t= hen > + monitoring multiple Ethernet Rx queues for traffic will be supported. > + > +* If ``rte_cpu_get_intrinsics_support()`` function indicates that only > ``rte_power_monitor()`` is supported by the platform, then monitoring = will be > limited to a mapping of 1 core 1 queue (thus, each Rx queue will have = to be > monitored from a different lcore). >=20 > -* If ``rte_cpu_get_intrinsics_support()`` function indicates that the > - ``rte_power_monitor()`` function is not supported, then monitor mode w= ill not > - be supported. > +* If ``rte_cpu_get_intrinsics_support()`` function indicates that neithe= r of the > + two monitoring functions are supported, then monitor mode will not be = supported. >=20 > * Not all Ethernet drivers support monitoring, even if the underlying > platform may support the necessary CPU instructions. Please refer to > diff --git a/lib/power/rte_power_pmd_mgmt.c b/lib/power/rte_power_pmd_mgm= t.c > index fccfd236c2..2056996b9c 100644 > --- a/lib/power/rte_power_pmd_mgmt.c > +++ b/lib/power/rte_power_pmd_mgmt.c > @@ -124,6 +124,32 @@ queue_list_take(struct pmd_core_cfg *cfg, const unio= n queue *q) > return found; > } >=20 > +static inline int > +get_monitor_addresses(struct pmd_core_cfg *cfg, > + struct rte_power_monitor_cond *pmc, size_t len) > +{ > + const struct queue_list_entry *qle; > + size_t i =3D 0; > + int ret; > + > + TAILQ_FOREACH(qle, &cfg->head, next) { > + const union queue *q =3D &qle->queue; > + struct rte_power_monitor_cond *cur; > + > + /* attempted out of bounds access */ > + if (i >=3D len) { > + RTE_LOG(ERR, POWER, "Too many queues being monitored\n"); > + return -1; > + } > + > + cur =3D &pmc[i++]; > + ret =3D rte_eth_get_monitor_addr(q->portid, q->qid, cur); > + if (ret < 0) > + return ret; > + } > + return 0; > +} > + > static void > calc_tsc(void) > { > @@ -190,6 +216,45 @@ lcore_can_sleep(struct pmd_core_cfg *cfg) > return true; > } >=20 > +static uint16_t > +clb_multiwait(uint16_t port_id __rte_unused, uint16_t qidx __rte_unused, > + struct rte_mbuf **pkts __rte_unused, uint16_t nb_rx, > + uint16_t max_pkts __rte_unused, void *arg) > +{ > + const unsigned int lcore =3D rte_lcore_id(); > + struct queue_list_entry *queue_conf =3D arg; > + struct pmd_core_cfg *lcore_conf; > + const bool empty =3D nb_rx =3D=3D 0; > + > + lcore_conf =3D &lcore_cfgs[lcore]; > + > + /* early exit */ > + if (likely(!empty)) > + /* early exit */ > + queue_reset(lcore_conf, queue_conf); > + else { > + struct rte_power_monitor_cond pmc[RTE_MAX_ETHPORTS]; As discussed, I still think it needs to be pmc[lcore_conf->n_queues]; Or if VLA is not an option - alloca(), or dynamic lcore_conf->pmc[], or... > + int ret; > + > + /* can this queue sleep? */ > + if (!queue_can_sleep(lcore_conf, queue_conf)) > + return nb_rx; > + > + /* can this lcore sleep? */ > + if (!lcore_can_sleep(lcore_conf)) > + return nb_rx; > + > + /* gather all monitoring conditions */ > + ret =3D get_monitor_addresses(lcore_conf, pmc, RTE_DIM(pmc)); > + if (ret < 0) > + return nb_rx; > + > + rte_power_monitor_multi(pmc, lcore_conf->n_queues, UINT64_MAX); > + } > + > + return nb_rx; > +} > + > static uint16_t > clb_umwait(uint16_t port_id, uint16_t qidx, struct rte_mbuf **pkts __rte= _unused, > uint16_t nb_rx, uint16_t max_pkts __rte_unused, void *arg) > @@ -341,14 +406,19 @@ static int > check_monitor(struct pmd_core_cfg *cfg, const union queue *qdata) > { > struct rte_power_monitor_cond dummy; > + bool multimonitor_supported; >=20 > /* check if rte_power_monitor is supported */ > if (!global_data.intrinsics_support.power_monitor) { > RTE_LOG(DEBUG, POWER, "Monitoring intrinsics are not supported\n"); > return -ENOTSUP; > } > + /* check if multi-monitor is supported */ > + multimonitor_supported =3D > + global_data.intrinsics_support.power_monitor_multi; >=20 > - if (cfg->n_queues > 0) { > + /* if we're adding a new queue, do we support multiple queues? */ > + if (cfg->n_queues > 0 && !multimonitor_supported) { > RTE_LOG(DEBUG, POWER, "Monitoring multiple queues is not supported\n")= ; > return -ENOTSUP; > } > @@ -364,6 +434,13 @@ check_monitor(struct pmd_core_cfg *cfg, const union = queue *qdata) > return 0; > } >=20 > +static inline rte_rx_callback_fn > +get_monitor_callback(void) > +{ > + return global_data.intrinsics_support.power_monitor_multi ? > + clb_multiwait : clb_umwait; > +} > + > int > rte_power_ethdev_pmgmt_queue_enable(unsigned int lcore_id, uint16_t port= _id, > uint16_t queue_id, enum rte_power_pmd_mgmt_type mode) > @@ -428,7 +505,7 @@ rte_power_ethdev_pmgmt_queue_enable(unsigned int lcor= e_id, uint16_t port_id, > if (ret < 0) > goto end; >=20 > - clb =3D clb_umwait; > + clb =3D get_monitor_callback(); > break; > case RTE_POWER_MGMT_TYPE_SCALE: > /* check if we can add a new queue */ > -- > 2.25.1