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 40EA1A0524; Tue, 1 Jun 2021 14:00:49 +0200 (CEST) Received: from [217.70.189.124] (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id B38BF40FDF; Tue, 1 Jun 2021 14:00:44 +0200 (CEST) Received: from mga09.intel.com (mga09.intel.com [134.134.136.24]) by mails.dpdk.org (Postfix) with ESMTP id 4C3BE40041 for ; Tue, 1 Jun 2021 14:00:42 +0200 (CEST) IronPort-SDR: dZGciVnY9ofUahIM18m/baFphQpg8FJxj2pr8Eb5xYGEenyKTlQEYpGfGUyQvhlf01CScXqD+N uZqOmPYAYJ6g== X-IronPort-AV: E=McAfee;i="6200,9189,10001"; a="203528466" X-IronPort-AV: E=Sophos;i="5.83,239,1616482800"; d="scan'208";a="203528466" Received: from fmsmga001.fm.intel.com ([10.253.24.23]) by orsmga102.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 01 Jun 2021 05:00:40 -0700 IronPort-SDR: InDbsWhm/ZEqci5aw/6cYFhMoXz7xJTUiBVYb/cR8KywDg9a7CSFTcX9ZNFsI6znas0U60bFt0 i3cqM/jfrIOA== X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.83,239,1616482800"; d="scan'208";a="549706980" Received: from silpixa00399498.ir.intel.com (HELO silpixa00399498.ger.corp.intel.com) ([10.237.222.54]) by fmsmga001.fm.intel.com with ESMTP; 01 Jun 2021 05:00:39 -0700 From: Anatoly Burakov To: dev@dpdk.org, Bruce Richardson , Konstantin Ananyev Cc: ciara.loftus@intel.com, david.hunt@intel.com Date: Tue, 1 Jun 2021 12:00:30 +0000 Message-Id: <8007029ea9e5129ea43f0c11708169406a16727f.1622548381.git.anatoly.burakov@intel.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: References: MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Subject: [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" 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. 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). Since the old behavior is the default, no need to adjust existing implementations. 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(-) diff --git a/lib/eal/include/generic/rte_power_intrinsics.h b/lib/eal/include/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) + */ }; /** diff --git a/lib/eal/x86/rte_power_intrinsics.c b/lib/eal/x86/rte_power_intrinsics.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_cond *pmc, const uint64_t masked = cur_value & pmc->mask; /* if the masked value is already matching, abort */ - if (masked == pmc->val) + if (!pmc->invert && masked == pmc->val) + goto end; + /* same, but for inverse check */ + if (pmc->invert && masked != pmc->val) goto end; } -- 2.25.1