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 CE3D1A0547; Mon, 21 Jun 2021 14:56:30 +0200 (CEST) Received: from [217.70.189.124] (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id 5A51A41158; Mon, 21 Jun 2021 14:56:30 +0200 (CEST) Received: from mga07.intel.com (mga07.intel.com [134.134.136.100]) by mails.dpdk.org (Postfix) with ESMTP id 0C54A40040 for ; Mon, 21 Jun 2021 14:56:27 +0200 (CEST) IronPort-SDR: MstLHjaMT7081cGyQLiD9+bxwniLrN5hrVq+aHuHqvdqNf+U7ckPXGSQMZ9GHa8gKpIh1Ftmyj cnaaoaHY8gkA== X-IronPort-AV: E=McAfee;i="6200,9189,10021"; a="270679569" X-IronPort-AV: E=Sophos;i="5.83,289,1616482800"; d="scan'208";a="270679569" Received: from orsmga004.jf.intel.com ([10.7.209.38]) by orsmga105.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 21 Jun 2021 05:56:26 -0700 IronPort-SDR: jpelnAhR6XG1ru0frdw7z7l02WabxyZX2FtfEytyi5CX2fCORf+7vH9pF4ufLIZmS0u9hnjnYl NVuT8y27XaKQ== X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.83,289,1616482800"; d="scan'208";a="555406437" Received: from fmsmsx605.amr.corp.intel.com ([10.18.126.85]) by orsmga004.jf.intel.com with ESMTP; 21 Jun 2021 05:56:25 -0700 Received: from fmsmsx607.amr.corp.intel.com (10.18.126.87) by fmsmsx605.amr.corp.intel.com (10.18.126.85) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2242.4; Mon, 21 Jun 2021 05:56:25 -0700 Received: from fmsmsx603.amr.corp.intel.com (10.18.126.83) by fmsmsx607.amr.corp.intel.com (10.18.126.87) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2242.4; Mon, 21 Jun 2021 05:56:25 -0700 Received: from fmsedg602.ED.cps.intel.com (10.1.192.136) 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.2242.4 via Frontend Transport; Mon, 21 Jun 2021 05:56:25 -0700 Received: from NAM10-BN7-obe.outbound.protection.outlook.com (104.47.70.104) 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.2242.4; Mon, 21 Jun 2021 05:56:25 -0700 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=Zx2RCOx8OYbv5pE9Hj28IJ/AYkTBcdABh3QjJsy+3S1C8U/42FI2+6wGusDavmtUokR9ENQLTW70XKox04UFfXy9Sb0fP6RjQA13F2cZrlzW/wjwArMxJLg6Y7hakpp3bfyEZqyrm388JphxQClijYvIm/YYykUFgqrpt/DmXwVCOVkAIcNBX1+ZDm9wR5YuL8hxakvRQA3pUWFiThuOB7HOGoZXPfdme2JcQjZmNXFnv83dkoihS9hxdlA7P6hACO/A6TUYX8mMc1YQ3ZmaMKwCiUuvD/3Xiy/AmPa6Wnh0Tl8orF4kAX2SQCjcANWcQCyy2BUjI9VQO/RqZMJWbw== 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=8+loCpw8C0C9E4FEkuTWP3hT98/JM5n4mRQScYtrds8=; b=ZLV73JL4eNEbiys42CgJubUfLHx1hcHQJjKXzgL0zMtkRlADxrgGPZyab0Dw5VJ9AvJuQwHfP9rTp7p0dzlgR9EQfLrgBEXXHUdjYOAyFmtSDR88KqK1xJ079Gd0uFDAtWjkKekhKN83AHCDk/lZNl9gafCXJIfP0TvgUcGRmw3wwti5mJ0jDzEUeLi7b6cwbvadLaK1QHhVB8QTarPstHHZpXCHnoOJgoJY3yGOKBW7ET9U5n41m0jxTpqnaFzcWp3Fryl97CtawBYT4gw+sVZZjAyzSI0/NDcQa0Cjnlxmg6YUEjAyBcpXQOksKY2HPoLep5Ll48Dku72PD0ZJaQ== 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=8+loCpw8C0C9E4FEkuTWP3hT98/JM5n4mRQScYtrds8=; b=Y+eB0NgaBySjHjZ5IZaznIqjd2O8qfQPNOVfuHGa26/q3QlwAt9aUQmMrI3gMjtiuLeR5n0kS5I9+SOKd4+jQ675WUdt1K5g7VvcNfpBZ0tDgBxNjJ8PtM2YiTcXrT0Jng7zNS1BOJpioWmMTa7Eq3wJAnuLl64hUdMLksqqGug= Received: from DM6PR11MB4491.namprd11.prod.outlook.com (2603:10b6:5:204::19) by DM4PR11MB5391.namprd11.prod.outlook.com (2603:10b6:5:396::9) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.4242.21; Mon, 21 Jun 2021 12:56:21 +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.4242.023; Mon, 21 Jun 2021 12:56:20 +0000 From: "Ananyev, Konstantin" To: "Burakov, Anatoly" , "dev@dpdk.org" , "Richardson, Bruce" CC: "Loftus, Ciara" , "Hunt, David" Thread-Topic: [PATCH v1 1/7] power_intrinsics: allow monitor checks inversion Thread-Index: AQHXVt3hXKEPl/Wz7069wuvKSGP/iKseiW0g Date: Mon, 21 Jun 2021 12:56:20 +0000 Message-ID: References: <8007029ea9e5129ea43f0c11708169406a16727f.1622548381.git.anatoly.burakov@intel.com> In-Reply-To: <8007029ea9e5129ea43f0c11708169406a16727f.1622548381.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: c5aad3af-fb1b-48c9-cceb-08d934b3f7bb x-ms-traffictypediagnostic: DM4PR11MB5391: 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: oysVvOBZvWZQJPoKJwi2jEn6Jmd1tjFjdeV+7dRsNob9qsPSE9uBC5Q6Qhb3rxgP+UTtBHtowk5UKz3jVltYUYDPWwoqK3NhIwKyuXZJM0j2U6vArUDHMoVjwBpSChHcbcT9CJNzhxGdxpJkCeBPtdBYYiJMIkagnEH4M71ETapJjOwDWCnzMxuxSwlIUWdEw7FhF0P6xfR2Oy+AEMzE9JxXNQpABx7XsyvAVvAkea+IA5yuuGwoKrkBvxzbPNmFGOQNKF3qR6Ae6B3XJjtTW9fvnfWHOCTMUfIyYXYVfeiLRl6dd9S8Lv2Wg7/awBdc5FF928BtDj5sYjWzocJ1GFOyPl/ml/bEXPbUe1c7llZoQhaRlkURh+zJwFgtNljzVh9ibFBQrBUE+lox+lt8b2mm6cFcZ1aBxL+OSepbfmbOXJQsi8lVBvitqwn14IlgpwbioIriy02Ud9f+8DUdZMRl4wbNSiyxtbu5NA6GSpjl+wVgYinnK5j6z0PjyOSmGFZ6HmBeNGFs2avyhgDv6cdpRwayEGVKUD+d5klu4oMTy2IvPckaR9oLJxq7yxRGDYFVTS+8lJxSH2YPC1PSwaunZDZvv5q4myDklHdF/iw= 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:(136003)(366004)(346002)(39860400002)(376002)(396003)(122000001)(7696005)(38100700002)(186003)(86362001)(66556008)(54906003)(110136005)(26005)(316002)(6636002)(55236004)(6506007)(66446008)(66946007)(66476007)(64756008)(76116006)(4326008)(8936002)(55016002)(33656002)(8676002)(52536014)(478600001)(107886003)(5660300002)(71200400001)(9686003)(83380400001)(2906002); DIR:OUT; SFP:1102; x-ms-exchange-antispam-messagedata-chunkcount: 1 x-ms-exchange-antispam-messagedata-0: =?us-ascii?Q?bszqKlfodj2VP2QybMVZuldold96/5mxsr5+dLhu1Su/QEH3RjKDrnFGhTsZ?= =?us-ascii?Q?UwC30KRrwi2Jxj72GNqMBcm4yxkplTN28N8J0gTNP3RSKg5lk7C1owtf88M3?= =?us-ascii?Q?UVMtCBM8i9rI/BfrAhiTufnDrS6hDJux65onIrwBeMThkc2ylAjZEoP3hu9H?= =?us-ascii?Q?gas/MORWwUqgoLJrG2K+eP+WktpurnhSy0SIllaKB5fWNtQNCYtros+nLcJV?= =?us-ascii?Q?ON85ivbJ2ZMLuh5C9yIaSe/e5PSWvVIRW66/NjF2xGpLNRWkZIFSrinlt0HR?= =?us-ascii?Q?CNpKkmenJm4Q50oHbF3Fxt1dooBvc+Z57KFs7FvN/NimN5yM2c6Q23IqS71B?= =?us-ascii?Q?VXXSLg8DdpgsIHapCPp/6Bj+jOwKn0tliaBYqAicgSlPtT51kMTtP9QgLLtL?= =?us-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2lfcgLZtdopHDMi87U5801QUdiqBYjSLZ1t?= =?us-ascii?Q?Cgaoa7iSKDGd7soEEyazy64t?= 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: c5aad3af-fb1b-48c9-cceb-08d934b3f7bb X-MS-Exchange-CrossTenant-originalarrivaltime: 21 Jun 2021 12:56:20.8067 (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: ix5fZCbDkxDO/rpCikFIIJKb+gqqrM6n27djXBjYxMh37GzNU80hFfKudRvSjqrQM+84K+UiZMAQpJN2T+LtkyWZEPxYQcYmtaS7HT+aT34= X-MS-Exchange-Transport-CrossTenantHeadersStamped: DM4PR11MB5391 X-OriginatorOrg: intel.com Subject: Re: [dpdk-dev] [PATCH v1 1/7] power_intrinsics: allow monitor checks inversion 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" Hi Anatoly, > Previously, the semantics of power monitor were such that we were > checking current value against the expected value, and if they matched, > then the sleep was aborted. This is somewhat inflexible, because it only > allowed us to check for a specific value. >=20 > This commit adds an option to reverse the check, so that we can have > monitor sleep aborted if the expected value *doesn't* match what's in > memory. This allows us to both implement all currently implemented > driver code, as well as support more use cases which don't easily map to > previous semantics (such as waiting on writes to AF_XDP counter value). >=20 > Since the old behavior is the default, no need to adjust existing > implementations. >=20 > Signed-off-by: Anatoly Burakov > --- > lib/eal/include/generic/rte_power_intrinsics.h | 4 ++++ > lib/eal/x86/rte_power_intrinsics.c | 5 ++++- > 2 files changed, 8 insertions(+), 1 deletion(-) >=20 > diff --git a/lib/eal/include/generic/rte_power_intrinsics.h b/lib/eal/inc= lude/generic/rte_power_intrinsics.h > index dddca3d41c..1006c2edfc 100644 > --- a/lib/eal/include/generic/rte_power_intrinsics.h > +++ b/lib/eal/include/generic/rte_power_intrinsics.h > @@ -31,6 +31,10 @@ struct rte_power_monitor_cond { > * 4, or 8. Supplying any other value will result in > * an error. > */ > + uint8_t invert; /**< Invert check for expected value (e.g. instead of > + * checking if `val` matches something, check if > + * `val` *doesn't* match a particular value) > + */ > }; >=20 > /** > diff --git a/lib/eal/x86/rte_power_intrinsics.c b/lib/eal/x86/rte_power_i= ntrinsics.c > index 39ea9fdecd..5d944e9aa4 100644 > --- a/lib/eal/x86/rte_power_intrinsics.c > +++ b/lib/eal/x86/rte_power_intrinsics.c > @@ -117,7 +117,10 @@ rte_power_monitor(const struct rte_power_monitor_con= d *pmc, > const uint64_t masked =3D cur_value & pmc->mask; >=20 > /* if the masked value is already matching, abort */ > - if (masked =3D=3D pmc->val) > + if (!pmc->invert && masked =3D=3D pmc->val) > + goto end; > + /* same, but for inverse check */ > + if (pmc->invert && masked !=3D pmc->val) > goto end; > } >=20 Hmm..., such approach looks too 'patchy'... Can we at least replace 'inver' with something like: enum rte_power_monitor_cond_op { _EQ, NEQ,... }; Then at least new comparions ops can be added in future. Even better I think would be to just leave to PMD to provide a comparison c= allback. Will make things really simple and generic: struct rte_power_monitor_cond { volatile void *addr; int (*cmp)(uint64_t val); uint8_t size; }; And then in rte_power_monitor(...): .... const uint64_t cur_value =3D __get_umwait_val(pmc->addr, pmc->size); if (pmc->cmp(cur_value) !=3D 0) goto end; .... =20