[RFC,v2,10/17] power: replace RTE_LOGTYPE_POWER with dynamic type

Message ID 20230207230438.1617331-11-stephen@networkplumber.org (mailing list archive)
State Superseded, archived
Delegated to: Thomas Monjalon
Headers
Series static logtype removal |

Checks

Context Check Description
ci/checkpatch success coding style OK

Commit Message

Stephen Hemminger Feb. 7, 2023, 11:04 p.m. UTC
  Use dynamic log type for power library.
Also replace use of RTE_LOGTYPE_USER1 with lib.power.guest.

Signed-off-by: Stephen Hemminger <stephen@networkplumber.org>
---
 lib/eal/common/eal_common_log.c    |   1 -
 lib/eal/include/rte_log.h          |   2 +-
 lib/power/guest_channel.c          |  48 +++++----
 lib/power/power_acpi_cpufreq.c     | 118 ++++++++++----------
 lib/power/power_common.c           |  11 +-
 lib/power/power_common.h           |   7 +-
 lib/power/power_cppc_cpufreq.c     | 129 +++++++++++-----------
 lib/power/power_kvm_vm.c           |  24 +++--
 lib/power/power_pstate_cpufreq.c   | 166 ++++++++++++++++-------------
 lib/power/rte_power.c              |  25 +++--
 lib/power/rte_power_empty_poll.c   |  36 +++----
 lib/power/rte_power_intel_uncore.c |  75 ++++++-------
 lib/power/rte_power_pmd_mgmt.c     |  37 ++++---
 13 files changed, 365 insertions(+), 314 deletions(-)
  

Patch

diff --git a/lib/eal/common/eal_common_log.c b/lib/eal/common/eal_common_log.c
index 871f2c38298c..7dbf1df3b979 100644
--- a/lib/eal/common/eal_common_log.c
+++ b/lib/eal/common/eal_common_log.c
@@ -355,7 +355,6 @@  static const struct logtype logtype_strings[] = {
 	{RTE_LOGTYPE_HASH,       "lib.hash"},
 	{RTE_LOGTYPE_LPM,        "lib.lpm"},
 	{RTE_LOGTYPE_KNI,        "lib.kni"},
-	{RTE_LOGTYPE_POWER,      "lib.power"},
 	{RTE_LOGTYPE_METER,      "lib.meter"},
 	{RTE_LOGTYPE_SCHED,      "lib.sched"},
 	{RTE_LOGTYPE_PORT,       "lib.port"},
diff --git a/lib/eal/include/rte_log.h b/lib/eal/include/rte_log.h
index d707098b6359..5b7850af4e2b 100644
--- a/lib/eal/include/rte_log.h
+++ b/lib/eal/include/rte_log.h
@@ -36,7 +36,7 @@  extern "C" {
 #define RTE_LOGTYPE_LPM        7 /**< Log related to LPM. */
 #define RTE_LOGTYPE_KNI        8 /**< Log related to KNI. */
 				 /* was RTE_LOGTYPE_ACL */
-#define RTE_LOGTYPE_POWER     10 /**< Log related to power. */
+				 /* was RTE_LOGTYPE_POWER */
 #define RTE_LOGTYPE_METER     11 /**< Log related to QoS meter. */
 #define RTE_LOGTYPE_SCHED     12 /**< Log related to QoS port scheduler. */
 #define RTE_LOGTYPE_PORT      13 /**< Log related to port. */
diff --git a/lib/power/guest_channel.c b/lib/power/guest_channel.c
index 969a9e5aaa06..0e836fc3f578 100644
--- a/lib/power/guest_channel.c
+++ b/lib/power/guest_channel.c
@@ -17,7 +17,11 @@ 
 
 #include "guest_channel.h"
 
-#define RTE_LOGTYPE_GUEST_CHANNEL RTE_LOGTYPE_USER1
+RTE_LOG_REGISTER_SUFFIX(guest_channel_logtype, "power.guest", INFO);
+
+#define GUEST_LOG(level, fmt, args...)				\
+	rte_log(RTE_LOG_ ## level, guest_channel_logtype,	\
+		"%s(): " fmt "\n", __func__, ## args)
 
 /* Timeout for incoming message in milliseconds. */
 #define TIMEOUT 10
@@ -58,38 +62,38 @@  guest_channel_host_connect(const char *path, unsigned int lcore_id)
 	int fd = -1;
 
 	if (lcore_id >= RTE_MAX_LCORE) {
-		RTE_LOG(ERR, GUEST_CHANNEL, "Channel(%u) is out of range 0...%d\n",
+		GUEST_LOG(ERR, "Channel(%u) is out of range 0...%d",
 				lcore_id, RTE_MAX_LCORE-1);
 		return -1;
 	}
 	/* check if path is already open */
 	if (global_fds[lcore_id] != -1) {
-		RTE_LOG(ERR, GUEST_CHANNEL, "Channel(%u) is already open with fd %d\n",
+		GUEST_LOG(ERR, "Channel(%u) is already open with fd %d",
 				lcore_id, global_fds[lcore_id]);
 		return -1;
 	}
 
 	snprintf(fd_path, PATH_MAX, "%s.%u", path, lcore_id);
-	RTE_LOG(INFO, GUEST_CHANNEL, "Opening channel '%s' for lcore %u\n",
+	GUEST_LOG(INFO, "Opening channel '%s' for lcore %u",
 			fd_path, lcore_id);
 	fd = open(fd_path, O_RDWR);
 	if (fd < 0) {
-		RTE_LOG(ERR, GUEST_CHANNEL, "Unable to to connect to '%s' with error "
-				"%s\n", fd_path, strerror(errno));
+		GUEST_LOG(ERR, "Unable to connect to '%s' with error %s",
+			  fd_path, strerror(errno));
 		return -1;
 	}
 
 	flags = fcntl(fd, F_GETFL, 0);
 	if (flags < 0) {
-		RTE_LOG(ERR, GUEST_CHANNEL, "Failed on fcntl get flags for file %s\n",
+		GUEST_LOG(ERR, "Failed on fcntl get flags for file %s",
 				fd_path);
 		goto error;
 	}
 
 	flags |= O_NONBLOCK;
 	if (fcntl(fd, F_SETFL, flags) < 0) {
-		RTE_LOG(ERR, GUEST_CHANNEL, "Failed on setting non-blocking mode for "
-				"file %s", fd_path);
+		GUEST_LOG(ERR, "Failed on setting non-blocking mode for file %s",
+			  fd_path);
 		goto error;
 	}
 	/* QEMU needs a delay after connection */
@@ -102,13 +106,13 @@  guest_channel_host_connect(const char *path, unsigned int lcore_id)
 	global_fds[lcore_id] = fd;
 	ret = guest_channel_send_msg(&pkt, lcore_id);
 	if (ret != 0) {
-		RTE_LOG(ERR, GUEST_CHANNEL,
-				"Error on channel '%s' communications test: %s\n",
-				fd_path, ret > 0 ? strerror(ret) :
-				"channel not connected");
+		GUEST_LOG(ERR,
+			  "Error on channel '%s' communications test: %s",
+			  fd_path, ret > 0 ? strerror(ret) :
+			  "channel not connected");
 		goto error;
 	}
-	RTE_LOG(INFO, GUEST_CHANNEL, "Channel '%s' is now connected\n", fd_path);
+	GUEST_LOG(INFO, "Channel '%s' is now connected", fd_path);
 	return 0;
 error:
 	close(fd);
@@ -124,13 +128,13 @@  guest_channel_send_msg(struct rte_power_channel_packet *pkt,
 	void *buffer = pkt;
 
 	if (lcore_id >= RTE_MAX_LCORE) {
-		RTE_LOG(ERR, GUEST_CHANNEL, "Channel(%u) is out of range 0...%d\n",
+		GUEST_LOG(ERR, "Channel(%u) is out of range 0...%d",
 				lcore_id, RTE_MAX_LCORE-1);
 		return -1;
 	}
 
 	if (global_fds[lcore_id] < 0) {
-		RTE_LOG(ERR, GUEST_CHANNEL, "Channel is not connected\n");
+		GUEST_LOG(ERR, "Channel is not connected");
 		return -1;
 	}
 	while (buffer_len > 0) {
@@ -165,13 +169,13 @@  int power_guest_channel_read_msg(void *pkt,
 		return -1;
 
 	if (lcore_id >= RTE_MAX_LCORE) {
-		RTE_LOG(ERR, GUEST_CHANNEL, "Channel(%u) is out of range 0...%d\n",
+		GUEST_LOG(ERR, "Channel(%u) is out of range 0...%d",
 				lcore_id, RTE_MAX_LCORE-1);
 		return -1;
 	}
 
 	if (global_fds[lcore_id] < 0) {
-		RTE_LOG(ERR, GUEST_CHANNEL, "Channel is not connected\n");
+		GUEST_LOG(ERR, "Channel is not connected");
 		return -1;
 	}
 
@@ -180,10 +184,10 @@  int power_guest_channel_read_msg(void *pkt,
 
 	ret = poll(&fds, 1, TIMEOUT);
 	if (ret == 0) {
-		RTE_LOG(DEBUG, GUEST_CHANNEL, "Timeout occurred during poll function.\n");
+		GUEST_LOG(DEBUG, "Timeout occurred during poll function.");
 		return -1;
 	} else if (ret < 0) {
-		RTE_LOG(ERR, GUEST_CHANNEL, "Error occurred during poll function: %s\n",
+		GUEST_LOG(ERR, "Error occurred during poll function: %s",
 				strerror(errno));
 		return -1;
 	}
@@ -199,7 +203,7 @@  int power_guest_channel_read_msg(void *pkt,
 		}
 
 		if (ret == 0) {
-			RTE_LOG(ERR, GUEST_CHANNEL, "Expected more data, but connection has been closed.\n");
+			GUEST_LOG(ERR, "Expected more data, but connection has been closed.");
 			return -1;
 		}
 		pkt = (char *)pkt + ret;
@@ -220,7 +224,7 @@  void
 guest_channel_host_disconnect(unsigned int lcore_id)
 {
 	if (lcore_id >= RTE_MAX_LCORE) {
-		RTE_LOG(ERR, GUEST_CHANNEL, "Channel(%u) is out of range 0...%d\n",
+		GUEST_LOG(ERR, "Channel(%u) is out of range 0...%d",
 				lcore_id, RTE_MAX_LCORE-1);
 		return;
 	}
diff --git a/lib/power/power_acpi_cpufreq.c b/lib/power/power_acpi_cpufreq.c
index 6e57aca53513..3643044d9ef0 100644
--- a/lib/power/power_acpi_cpufreq.c
+++ b/lib/power/power_acpi_cpufreq.c
@@ -62,8 +62,9 @@  static int
 set_freq_internal(struct acpi_power_info *pi, uint32_t idx)
 {
 	if (idx >= RTE_MAX_LCORE_FREQS || idx >= pi->nb_freqs) {
-		RTE_LOG(ERR, POWER, "Invalid frequency index %u, which "
-				"should be less than %u\n", idx, pi->nb_freqs);
+		POWER_LOG(ERR,
+			  "Invalid frequency index %u, which should be less than %u",
+			  idx, pi->nb_freqs);
 		return -1;
 	}
 
@@ -74,13 +75,15 @@  set_freq_internal(struct acpi_power_info *pi, uint32_t idx)
 	POWER_DEBUG_TRACE("Frequency[%u] %u to be set for lcore %u\n",
 			idx, pi->freqs[idx], pi->lcore_id);
 	if (fseek(pi->f, 0, SEEK_SET) < 0) {
-		RTE_LOG(ERR, POWER, "Fail to set file position indicator to 0 "
-				"for setting frequency for lcore %u\n", pi->lcore_id);
+		POWER_LOG(ERR,
+			  "Fail to set file position indicator to 0 for setting frequency for lcore %u",
+			  pi->lcore_id);
 		return -1;
 	}
 	if (fprintf(pi->f, "%u", pi->freqs[idx]) < 0) {
-		RTE_LOG(ERR, POWER, "Fail to write new frequency for "
-				"lcore %u\n", pi->lcore_id);
+		POWER_LOG(ERR,
+			  "Fail to write new frequency for lcore %u",
+			  pi->lcore_id);
 		return -1;
 	}
 	fflush(pi->f);
@@ -126,14 +129,14 @@  power_get_available_freqs(struct acpi_power_info *pi)
 
 	open_core_sysfs_file(&f, "r", POWER_SYSFILE_AVAIL_FREQ, pi->lcore_id);
 	if (f == NULL) {
-		RTE_LOG(ERR, POWER, "failed to open %s\n",
+		POWER_LOG(ERR, "failed to open %s",
 				POWER_SYSFILE_AVAIL_FREQ);
 		goto out;
 	}
 
 	ret = read_core_sysfs_s(f, buf, sizeof(buf));
 	if ((ret) < 0) {
-		RTE_LOG(ERR, POWER, "Failed to read %s\n",
+		POWER_LOG(ERR, "Failed to read %s",
 				POWER_SYSFILE_AVAIL_FREQ);
 		goto out;
 	}
@@ -142,12 +145,13 @@  power_get_available_freqs(struct acpi_power_info *pi)
 	count = rte_strsplit(buf, sizeof(buf), freqs,
 			RTE_MAX_LCORE_FREQS, ' ');
 	if (count <= 0) {
-		RTE_LOG(ERR, POWER, "No available frequency in "
-				""POWER_SYSFILE_AVAIL_FREQ"\n", pi->lcore_id);
+		POWER_LOG(ERR,
+			  "No available frequency in " POWER_SYSFILE_AVAIL_FREQ,
+			  pi->lcore_id);
 		goto out;
 	}
 	if (count >= RTE_MAX_LCORE_FREQS) {
-		RTE_LOG(ERR, POWER, "Too many available frequencies : %d\n",
+		POWER_LOG(ERR, "Too many available frequencies : %d",
 				count);
 		goto out;
 	}
@@ -195,14 +199,14 @@  power_init_for_setting_freq(struct acpi_power_info *pi)
 
 	open_core_sysfs_file(&f, "rw+", POWER_SYSFILE_SETSPEED, pi->lcore_id);
 	if (f == NULL) {
-		RTE_LOG(ERR, POWER, "Failed to open %s\n",
+		POWER_LOG(ERR, "Failed to open %s",
 				POWER_SYSFILE_SETSPEED);
 		goto err;
 	}
 
 	ret = read_core_sysfs_s(f, buf, sizeof(buf));
 	if ((ret) < 0) {
-		RTE_LOG(ERR, POWER, "Failed to read %s\n",
+		POWER_LOG(ERR, "Failed to read %s",
 				POWER_SYSFILE_SETSPEED);
 		goto err;
 	}
@@ -236,7 +240,7 @@  power_acpi_cpufreq_init(unsigned int lcore_id)
 	uint32_t exp_state;
 
 	if (lcore_id >= RTE_MAX_LCORE) {
-		RTE_LOG(ERR, POWER, "Lcore id %u can not exceeds %u\n",
+		POWER_LOG(ERR, "Lcore id %u can not exceeds %u",
 				lcore_id, RTE_MAX_LCORE - 1U);
 		return -1;
 	}
@@ -252,42 +256,47 @@  power_acpi_cpufreq_init(unsigned int lcore_id)
 	if (!__atomic_compare_exchange_n(&(pi->state), &exp_state,
 					POWER_ONGOING, 0,
 					__ATOMIC_ACQUIRE, __ATOMIC_RELAXED)) {
-		RTE_LOG(INFO, POWER, "Power management of lcore %u is "
-				"in use\n", lcore_id);
+		POWER_LOG(INFO,
+			  "Power management of lcore %u is in use", lcore_id);
 		return -1;
 	}
 
 	pi->lcore_id = lcore_id;
 	/* Check and set the governor */
 	if (power_set_governor_userspace(pi) < 0) {
-		RTE_LOG(ERR, POWER, "Cannot set governor of lcore %u to "
-				"userspace\n", lcore_id);
+		POWER_LOG(ERR,
+			  "Cannot set governor of lcore %u to userspace",
+			  lcore_id);
 		goto fail;
 	}
 
 	/* Get the available frequencies */
 	if (power_get_available_freqs(pi) < 0) {
-		RTE_LOG(ERR, POWER, "Cannot get available frequencies of "
-				"lcore %u\n", lcore_id);
+		POWER_LOG(ERR,
+			  "Cannot get available frequencies of lcore %u",
+			  lcore_id);
 		goto fail;
 	}
 
 	/* Init for setting lcore frequency */
 	if (power_init_for_setting_freq(pi) < 0) {
-		RTE_LOG(ERR, POWER, "Cannot init for setting frequency for "
-				"lcore %u\n", lcore_id);
+		POWER_LOG(ERR,
+			  "Cannot init for setting frequency for lcore %u",
+			  lcore_id);
 		goto fail;
 	}
 
 	/* Set freq to max by default */
 	if (power_acpi_cpufreq_freq_max(lcore_id) < 0) {
-		RTE_LOG(ERR, POWER, "Cannot set frequency of lcore %u "
-				"to max\n", lcore_id);
+		POWER_LOG(ERR,
+			  "Cannot set frequency of lcore %u to max",
+			  lcore_id);
 		goto fail;
 	}
 
-	RTE_LOG(INFO, POWER, "Initialized successfully for lcore %u "
-			"power management\n", lcore_id);
+	POWER_LOG(INFO,
+		  "Initialized successfully for lcore %u power management",
+		  lcore_id);
 	exp_state = POWER_ONGOING;
 	__atomic_compare_exchange_n(&(pi->state), &exp_state, POWER_USED,
 				    0, __ATOMIC_RELEASE, __ATOMIC_RELAXED);
@@ -309,7 +318,7 @@  power_acpi_cpufreq_exit(unsigned int lcore_id)
 	uint32_t exp_state;
 
 	if (lcore_id >= RTE_MAX_LCORE) {
-		RTE_LOG(ERR, POWER, "Lcore id %u can not exceeds %u\n",
+		POWER_LOG(ERR, "Lcore id %u can not exceeds %u",
 				lcore_id, RTE_MAX_LCORE - 1U);
 		return -1;
 	}
@@ -324,8 +333,8 @@  power_acpi_cpufreq_exit(unsigned int lcore_id)
 	if (!__atomic_compare_exchange_n(&(pi->state), &exp_state,
 					POWER_ONGOING, 0,
 					__ATOMIC_ACQUIRE, __ATOMIC_RELAXED)) {
-		RTE_LOG(INFO, POWER, "Power management of lcore %u is "
-				"not used\n", lcore_id);
+		POWER_LOG(INFO,
+			  "Power management of lcore %u is not used", lcore_id);
 		return -1;
 	}
 
@@ -335,14 +344,15 @@  power_acpi_cpufreq_exit(unsigned int lcore_id)
 
 	/* Set the governor back to the original */
 	if (power_set_governor_original(pi) < 0) {
-		RTE_LOG(ERR, POWER, "Cannot set the governor of %u back "
-				"to the original\n", lcore_id);
+		POWER_LOG(ERR,
+			  "Cannot set the governor of %u back to the original",
+			  lcore_id);
 		goto fail;
 	}
 
-	RTE_LOG(INFO, POWER, "Power management of lcore %u has exited from "
-			"'userspace' mode and been set back to the "
-			"original\n", lcore_id);
+	POWER_LOG(INFO,
+		  "Power management of lcore %u has exited from 'userspace' mode and been set back to the original",
+		  lcore_id);
 	exp_state = POWER_ONGOING;
 	__atomic_compare_exchange_n(&(pi->state), &exp_state, POWER_IDLE,
 				    0, __ATOMIC_RELEASE, __ATOMIC_RELAXED);
@@ -363,18 +373,18 @@  power_acpi_cpufreq_freqs(unsigned int lcore_id, uint32_t *freqs, uint32_t num)
 	struct acpi_power_info *pi;
 
 	if (lcore_id >= RTE_MAX_LCORE) {
-		RTE_LOG(ERR, POWER, "Invalid lcore ID\n");
+		POWER_LOG(ERR, "Invalid lcore ID");
 		return 0;
 	}
 
 	if (freqs == NULL) {
-		RTE_LOG(ERR, POWER, "NULL buffer supplied\n");
+		POWER_LOG(ERR, "NULL buffer supplied");
 		return 0;
 	}
 
 	pi = &lcore_power_info[lcore_id];
 	if (num < pi->nb_freqs) {
-		RTE_LOG(ERR, POWER, "Buffer size is not enough\n");
+		POWER_LOG(ERR, "Buffer size is not enough");
 		return 0;
 	}
 	rte_memcpy(freqs, pi->freqs, pi->nb_freqs * sizeof(uint32_t));
@@ -386,7 +396,7 @@  uint32_t
 power_acpi_cpufreq_get_freq(unsigned int lcore_id)
 {
 	if (lcore_id >= RTE_MAX_LCORE) {
-		RTE_LOG(ERR, POWER, "Invalid lcore ID\n");
+		POWER_LOG(ERR, "Invalid lcore ID");
 		return RTE_POWER_INVALID_FREQ_INDEX;
 	}
 
@@ -397,7 +407,7 @@  int
 power_acpi_cpufreq_set_freq(unsigned int lcore_id, uint32_t index)
 {
 	if (lcore_id >= RTE_MAX_LCORE) {
-		RTE_LOG(ERR, POWER, "Invalid lcore ID\n");
+		POWER_LOG(ERR, "Invalid lcore ID");
 		return -1;
 	}
 
@@ -410,7 +420,7 @@  power_acpi_cpufreq_freq_down(unsigned int lcore_id)
 	struct acpi_power_info *pi;
 
 	if (lcore_id >= RTE_MAX_LCORE) {
-		RTE_LOG(ERR, POWER, "Invalid lcore ID\n");
+		POWER_LOG(ERR, "Invalid lcore ID");
 		return -1;
 	}
 
@@ -428,7 +438,7 @@  power_acpi_cpufreq_freq_up(unsigned int lcore_id)
 	struct acpi_power_info *pi;
 
 	if (lcore_id >= RTE_MAX_LCORE) {
-		RTE_LOG(ERR, POWER, "Invalid lcore ID\n");
+		POWER_LOG(ERR, "Invalid lcore ID");
 		return -1;
 	}
 
@@ -445,7 +455,7 @@  int
 power_acpi_cpufreq_freq_max(unsigned int lcore_id)
 {
 	if (lcore_id >= RTE_MAX_LCORE) {
-		RTE_LOG(ERR, POWER, "Invalid lcore ID\n");
+		POWER_LOG(ERR, "Invalid lcore ID");
 		return -1;
 	}
 
@@ -469,7 +479,7 @@  power_acpi_cpufreq_freq_min(unsigned int lcore_id)
 	struct acpi_power_info *pi;
 
 	if (lcore_id >= RTE_MAX_LCORE) {
-		RTE_LOG(ERR, POWER, "Invalid lcore ID\n");
+		POWER_LOG(ERR, "Invalid lcore ID");
 		return -1;
 	}
 
@@ -486,7 +496,7 @@  power_acpi_turbo_status(unsigned int lcore_id)
 	struct acpi_power_info *pi;
 
 	if (lcore_id >= RTE_MAX_LCORE) {
-		RTE_LOG(ERR, POWER, "Invalid lcore ID\n");
+		POWER_LOG(ERR, "Invalid lcore ID");
 		return -1;
 	}
 
@@ -502,7 +512,7 @@  power_acpi_enable_turbo(unsigned int lcore_id)
 	struct acpi_power_info *pi;
 
 	if (lcore_id >= RTE_MAX_LCORE) {
-		RTE_LOG(ERR, POWER, "Invalid lcore ID\n");
+		POWER_LOG(ERR, "Invalid lcore ID");
 		return -1;
 	}
 
@@ -512,16 +522,16 @@  power_acpi_enable_turbo(unsigned int lcore_id)
 		pi->turbo_enable = 1;
 	else {
 		pi->turbo_enable = 0;
-		RTE_LOG(ERR, POWER,
-			"Failed to enable turbo on lcore %u\n",
+		POWER_LOG(ERR,
+			"Failed to enable turbo on lcore %u",
 			lcore_id);
 			return -1;
 	}
 
 	/* Max may have changed, so call to max function */
 	if (power_acpi_cpufreq_freq_max(lcore_id) < 0) {
-		RTE_LOG(ERR, POWER,
-			"Failed to set frequency of lcore %u to max\n",
+		POWER_LOG(ERR,
+			"Failed to set frequency of lcore %u to max",
 			lcore_id);
 			return -1;
 	}
@@ -535,7 +545,7 @@  power_acpi_disable_turbo(unsigned int lcore_id)
 	struct acpi_power_info *pi;
 
 	if (lcore_id >= RTE_MAX_LCORE) {
-		RTE_LOG(ERR, POWER, "Invalid lcore ID\n");
+		POWER_LOG(ERR, "Invalid lcore ID");
 		return -1;
 	}
 
@@ -546,8 +556,8 @@  power_acpi_disable_turbo(unsigned int lcore_id)
 	if ((pi->turbo_available) && (pi->curr_idx <= 1)) {
 		/* Try to set freq to max by default coming out of turbo */
 		if (power_acpi_cpufreq_freq_max(lcore_id) < 0) {
-			RTE_LOG(ERR, POWER,
-				"Failed to set frequency of lcore %u to max\n",
+			POWER_LOG(ERR,
+				"Failed to set frequency of lcore %u to max",
 				lcore_id);
 			return -1;
 		}
@@ -562,11 +572,11 @@  int power_acpi_get_capabilities(unsigned int lcore_id,
 	struct acpi_power_info *pi;
 
 	if (lcore_id >= RTE_MAX_LCORE) {
-		RTE_LOG(ERR, POWER, "Invalid lcore ID\n");
+		POWER_LOG(ERR, "Invalid lcore ID");
 		return -1;
 	}
 	if (caps == NULL) {
-		RTE_LOG(ERR, POWER, "Invalid argument\n");
+		POWER_LOG(ERR, "Invalid argument");
 		return -1;
 	}
 
diff --git a/lib/power/power_common.c b/lib/power/power_common.c
index 1e09facb863f..3a374f6b8431 100644
--- a/lib/power/power_common.c
+++ b/lib/power/power_common.c
@@ -161,14 +161,14 @@  power_set_governor(unsigned int lcore_id, const char *new_governor,
 	open_core_sysfs_file(&f_governor, "rw+", POWER_SYSFILE_GOVERNOR,
 			lcore_id);
 	if (f_governor == NULL) {
-		RTE_LOG(ERR, POWER, "failed to open %s\n",
+		POWER_LOG(ERR, "failed to open %s",
 				POWER_SYSFILE_GOVERNOR);
 		goto out;
 	}
 
 	ret = read_core_sysfs_s(f_governor, buf, sizeof(buf));
 	if (ret < 0) {
-		RTE_LOG(ERR, POWER, "Failed to read %s\n",
+		POWER_LOG(ERR, "Failed to read %s",
 				POWER_SYSFILE_GOVERNOR);
 		goto out;
 	}
@@ -188,14 +188,15 @@  power_set_governor(unsigned int lcore_id, const char *new_governor,
 	/* Write the new governor */
 	ret = write_core_sysfs_s(f_governor, new_governor);
 	if (ret < 0) {
-		RTE_LOG(ERR, POWER, "Failed to write %s\n",
+		POWER_LOG(ERR, "Failed to write %s",
 				POWER_SYSFILE_GOVERNOR);
 		goto out;
 	}
 
 	ret = 0;
-	RTE_LOG(INFO, POWER, "Power management governor of lcore %u has been "
-			"set to '%s' successfully\n", lcore_id, new_governor);
+	POWER_LOG(INFO,
+		  "Power management governor of lcore %u has been set to '%s' successfully",
+		  lcore_id, new_governor);
 out:
 	if (f_governor != NULL)
 		fclose(f_governor);
diff --git a/lib/power/power_common.h b/lib/power/power_common.h
index c1c713927621..8e5309bbbaff 100644
--- a/lib/power/power_common.h
+++ b/lib/power/power_common.h
@@ -10,10 +10,15 @@ 
 
 #define RTE_POWER_INVALID_FREQ_INDEX (~0)
 
+extern int power_logtype;
+
+#define POWER_LOG(level, fmt, args...)			\
+	rte_log(RTE_LOG_ ## level, power_logtype,	\
+		"%s(): " fmt "\n", __func__, ## args)
 
 #ifdef RTE_LIBRTE_POWER_DEBUG
 #define POWER_DEBUG_TRACE(fmt, args...) \
-		RTE_LOG(ERR, POWER, "%s: " fmt, __func__, ## args)
+	POWER_LOG(ERR, fmt, ## args)
 #else
 #define POWER_DEBUG_TRACE(fmt, args...)
 #endif
diff --git a/lib/power/power_cppc_cpufreq.c b/lib/power/power_cppc_cpufreq.c
index fc9cffef91a8..7ffda90ce7a7 100644
--- a/lib/power/power_cppc_cpufreq.c
+++ b/lib/power/power_cppc_cpufreq.c
@@ -72,8 +72,9 @@  static int
 set_freq_internal(struct cppc_power_info *pi, uint32_t idx)
 {
 	if (idx >= RTE_MAX_LCORE_FREQS || idx >= pi->nb_freqs) {
-		RTE_LOG(ERR, POWER, "Invalid frequency index %u, which "
-				"should be less than %u\n", idx, pi->nb_freqs);
+		POWER_LOG(ERR,
+			  "Invalid frequency index %u, which should be less than %u",
+			  idx, pi->nb_freqs);
 		return -1;
 	}
 
@@ -84,13 +85,15 @@  set_freq_internal(struct cppc_power_info *pi, uint32_t idx)
 	POWER_DEBUG_TRACE("Frequency[%u] %u to be set for lcore %u\n",
 			idx, pi->freqs[idx], pi->lcore_id);
 	if (fseek(pi->f, 0, SEEK_SET) < 0) {
-		RTE_LOG(ERR, POWER, "Fail to set file position indicator to 0 "
-			"for setting frequency for lcore %u\n", pi->lcore_id);
+		POWER_LOG(ERR,
+			  "Fail to set file position indicator to 0 for setting frequency for lcore %u",
+			  pi->lcore_id);
 		return -1;
 	}
 	if (fprintf(pi->f, "%u", pi->freqs[idx]) < 0) {
-		RTE_LOG(ERR, POWER, "Fail to write new frequency for "
-				"lcore %u\n", pi->lcore_id);
+		POWER_LOG(ERR,
+			  "Fail to write new frequency for lcore %u",
+			  pi->lcore_id);
 		return -1;
 	}
 	fflush(pi->f);
@@ -121,7 +124,7 @@  power_check_turbo(struct cppc_power_info *pi)
 	open_core_sysfs_file(&f_max, "r", POWER_SYSFILE_HIGHEST_PERF,
 			pi->lcore_id);
 	if (f_max == NULL) {
-		RTE_LOG(ERR, POWER, "failed to open %s\n",
+		POWER_LOG(ERR, "failed to open %s",
 				POWER_SYSFILE_HIGHEST_PERF);
 		goto err;
 	}
@@ -129,7 +132,7 @@  power_check_turbo(struct cppc_power_info *pi)
 	open_core_sysfs_file(&f_nom, "r", POWER_SYSFILE_NOMINAL_PERF,
 			pi->lcore_id);
 	if (f_nom == NULL) {
-		RTE_LOG(ERR, POWER, "failed to open %s\n",
+		POWER_LOG(ERR, "failed to open %s",
 				POWER_SYSFILE_NOMINAL_PERF);
 		goto err;
 	}
@@ -137,28 +140,28 @@  power_check_turbo(struct cppc_power_info *pi)
 	open_core_sysfs_file(&f_cmax, "r", POWER_SYSFILE_SYS_MAX,
 			pi->lcore_id);
 	if (f_cmax == NULL) {
-		RTE_LOG(ERR, POWER, "failed to open %s\n",
+		POWER_LOG(ERR, "failed to open %s",
 				POWER_SYSFILE_SYS_MAX);
 		goto err;
 	}
 
 	ret = read_core_sysfs_u32(f_max, &highest_perf);
 	if (ret < 0) {
-		RTE_LOG(ERR, POWER, "Failed to read %s\n",
+		POWER_LOG(ERR, "Failed to read %s",
 				POWER_SYSFILE_HIGHEST_PERF);
 		goto err;
 	}
 
 	ret = read_core_sysfs_u32(f_nom, &nominal_perf);
 	if (ret < 0) {
-		RTE_LOG(ERR, POWER, "Failed to read %s\n",
+		POWER_LOG(ERR, "Failed to read %s",
 				POWER_SYSFILE_NOMINAL_PERF);
 		goto err;
 	}
 
 	ret = read_core_sysfs_u32(f_cmax, &cpuinfo_max_freq);
 	if (ret < 0) {
-		RTE_LOG(ERR, POWER, "Failed to read %s\n",
+		POWER_LOG(ERR, "Failed to read %s",
 				POWER_SYSFILE_SYS_MAX);
 		goto err;
 	}
@@ -208,7 +211,7 @@  power_get_available_freqs(struct cppc_power_info *pi)
 	open_core_sysfs_file(&f_max, "r", POWER_SYSFILE_SCALING_MAX_FREQ,
 			pi->lcore_id);
 	if (f_max == NULL) {
-		RTE_LOG(ERR, POWER, "failed to open %s\n",
+		POWER_LOG(ERR, "failed to open %s",
 				POWER_SYSFILE_SCALING_MAX_FREQ);
 		goto out;
 	}
@@ -216,21 +219,21 @@  power_get_available_freqs(struct cppc_power_info *pi)
 	open_core_sysfs_file(&f_min, "r", POWER_SYSFILE_SCALING_MIN_FREQ,
 			pi->lcore_id);
 	if (f_min == NULL) {
-		RTE_LOG(ERR, POWER, "failed to open %s\n",
+		POWER_LOG(ERR, "failed to open %s",
 				POWER_SYSFILE_SCALING_MIN_FREQ);
 		goto out;
 	}
 
 	ret = read_core_sysfs_u32(f_max, &scaling_max_freq);
 	if (ret < 0) {
-		RTE_LOG(ERR, POWER, "Failed to read %s\n",
+		POWER_LOG(ERR, "Failed to read %s",
 				POWER_SYSFILE_SCALING_MAX_FREQ);
 		goto out;
 	}
 
 	ret = read_core_sysfs_u32(f_min, &scaling_min_freq);
 	if (ret < 0) {
-		RTE_LOG(ERR, POWER, "Failed to read %s\n",
+		POWER_LOG(ERR, "Failed to read %s",
 				POWER_SYSFILE_SCALING_MIN_FREQ);
 		goto out;
 	}
@@ -248,7 +251,7 @@  power_get_available_freqs(struct cppc_power_info *pi)
 	num_freqs = (nominal_perf - scaling_min_freq) / BUS_FREQ + 1 +
 		pi->turbo_available;
 	if (num_freqs >= RTE_MAX_LCORE_FREQS) {
-		RTE_LOG(ERR, POWER, "Too many available frequencies: %d\n",
+		POWER_LOG(ERR, "Too many available frequencies: %d",
 				num_freqs);
 		goto out;
 	}
@@ -289,14 +292,14 @@  power_init_for_setting_freq(struct cppc_power_info *pi)
 
 	open_core_sysfs_file(&f, "rw+", POWER_SYSFILE_SETSPEED, pi->lcore_id);
 	if (f == NULL) {
-		RTE_LOG(ERR, POWER, "failed to open %s\n",
+		POWER_LOG(ERR, "failed to open %s",
 				POWER_SYSFILE_SETSPEED);
 		goto err;
 	}
 
 	ret = read_core_sysfs_s(f, buf, sizeof(buf));
 	if (ret < 0) {
-		RTE_LOG(ERR, POWER, "Failed to read %s\n",
+		POWER_LOG(ERR, "Failed to read %s",
 				POWER_SYSFILE_SETSPEED);
 		goto err;
 	}
@@ -340,7 +343,7 @@  power_cppc_cpufreq_init(unsigned int lcore_id)
 	uint32_t exp_state;
 
 	if (lcore_id >= RTE_MAX_LCORE) {
-		RTE_LOG(ERR, POWER, "Lcore id %u can not exceeds %u\n",
+		POWER_LOG(ERR, "Lcore id %u can not exceeds %u",
 				lcore_id, RTE_MAX_LCORE - 1U);
 		return -1;
 	}
@@ -356,42 +359,46 @@  power_cppc_cpufreq_init(unsigned int lcore_id)
 	if (!__atomic_compare_exchange_n(&(pi->state), &exp_state,
 					POWER_ONGOING, 0,
 					__ATOMIC_ACQUIRE, __ATOMIC_RELAXED)) {
-		RTE_LOG(INFO, POWER, "Power management of lcore %u is "
-				"in use\n", lcore_id);
+		POWER_LOG(INFO,
+			  "Power management of lcore %u is in use", lcore_id);
 		return -1;
 	}
 
 	pi->lcore_id = lcore_id;
 	/* Check and set the governor */
 	if (power_set_governor_userspace(pi) < 0) {
-		RTE_LOG(ERR, POWER, "Cannot set governor of lcore %u to "
-				"userspace\n", lcore_id);
+		POWER_LOG(ERR, "Cannot set governor of lcore %u to userspace",
+			  lcore_id);
 		goto fail;
 	}
 
 	/* Get the available frequencies */
 	if (power_get_available_freqs(pi) < 0) {
-		RTE_LOG(ERR, POWER, "Cannot get available frequencies of "
-				"lcore %u\n", lcore_id);
+		POWER_LOG(ERR,
+			  "Cannot get available frequencies of lcore %u",
+			  lcore_id);
 		goto fail;
 	}
 
 	/* Init for setting lcore frequency */
 	if (power_init_for_setting_freq(pi) < 0) {
-		RTE_LOG(ERR, POWER, "Cannot init for setting frequency for "
-				"lcore %u\n", lcore_id);
+		POWER_LOG(ERR,
+			  "Cannot init for setting frequency for lcore %u",
+			  lcore_id);
 		goto fail;
 	}
 
 	/* Set freq to max by default */
 	if (power_cppc_cpufreq_freq_max(lcore_id) < 0) {
-		RTE_LOG(ERR, POWER, "Cannot set frequency of lcore %u "
-				"to max\n", lcore_id);
+		POWER_LOG(ERR,
+			  "Cannot set frequency of lcore %u to max",
+			  lcore_id);
 		goto fail;
 	}
 
-	RTE_LOG(INFO, POWER, "Initialized successfully for lcore %u "
-			"power management\n", lcore_id);
+	POWER_LOG(INFO,
+		  "Initialized successfully for lcore %u power management",
+		  lcore_id);
 
 	__atomic_store_n(&(pi->state), POWER_USED, __ATOMIC_RELEASE);
 
@@ -419,7 +426,7 @@  power_cppc_cpufreq_exit(unsigned int lcore_id)
 	uint32_t exp_state;
 
 	if (lcore_id >= RTE_MAX_LCORE) {
-		RTE_LOG(ERR, POWER, "Lcore id %u can not exceeds %u\n",
+		POWER_LOG(ERR, "Lcore id %u can not exceeds %u",
 				lcore_id, RTE_MAX_LCORE - 1U);
 		return -1;
 	}
@@ -434,8 +441,9 @@  power_cppc_cpufreq_exit(unsigned int lcore_id)
 	if (!__atomic_compare_exchange_n(&(pi->state), &exp_state,
 					POWER_ONGOING, 0,
 					__ATOMIC_ACQUIRE, __ATOMIC_RELAXED)) {
-		RTE_LOG(INFO, POWER, "Power management of lcore %u is "
-				"not used\n", lcore_id);
+		POWER_LOG(INFO,
+			  "Power management of lcore %u is not used",
+			  lcore_id);
 		return -1;
 	}
 
@@ -445,14 +453,15 @@  power_cppc_cpufreq_exit(unsigned int lcore_id)
 
 	/* Set the governor back to the original */
 	if (power_set_governor_original(pi) < 0) {
-		RTE_LOG(ERR, POWER, "Cannot set the governor of %u back "
-				"to the original\n", lcore_id);
+		POWER_LOG(ERR,
+			  "Cannot set the governor of %u back to the original",
+			  lcore_id);
 		goto fail;
 	}
 
-	RTE_LOG(INFO, POWER, "Power management of lcore %u has exited from "
-			"'userspace' mode and been set back to the "
-			"original\n", lcore_id);
+	POWER_LOG(INFO,
+		  "Power management of lcore %u has exited from 'userspace' mode and been set back to the original",
+		  lcore_id);
 	__atomic_store_n(&(pi->state), POWER_IDLE, __ATOMIC_RELEASE);
 
 	return 0;
@@ -469,18 +478,18 @@  power_cppc_cpufreq_freqs(unsigned int lcore_id, uint32_t *freqs, uint32_t num)
 	struct cppc_power_info *pi;
 
 	if (lcore_id >= RTE_MAX_LCORE) {
-		RTE_LOG(ERR, POWER, "Invalid lcore ID\n");
+		POWER_LOG(ERR, "Invalid lcore ID");
 		return 0;
 	}
 
 	if (freqs == NULL) {
-		RTE_LOG(ERR, POWER, "NULL buffer supplied\n");
+		POWER_LOG(ERR, "NULL buffer supplied");
 		return 0;
 	}
 
 	pi = &lcore_power_info[lcore_id];
 	if (num < pi->nb_freqs) {
-		RTE_LOG(ERR, POWER, "Buffer size is not enough\n");
+		POWER_LOG(ERR, "Buffer size is not enough");
 		return 0;
 	}
 	rte_memcpy(freqs, pi->freqs, pi->nb_freqs * sizeof(uint32_t));
@@ -492,7 +501,7 @@  uint32_t
 power_cppc_cpufreq_get_freq(unsigned int lcore_id)
 {
 	if (lcore_id >= RTE_MAX_LCORE) {
-		RTE_LOG(ERR, POWER, "Invalid lcore ID\n");
+		POWER_LOG(ERR, "Invalid lcore ID");
 		return RTE_POWER_INVALID_FREQ_INDEX;
 	}
 
@@ -503,7 +512,7 @@  int
 power_cppc_cpufreq_set_freq(unsigned int lcore_id, uint32_t index)
 {
 	if (lcore_id >= RTE_MAX_LCORE) {
-		RTE_LOG(ERR, POWER, "Invalid lcore ID\n");
+		POWER_LOG(ERR, "Invalid lcore ID");
 		return -1;
 	}
 
@@ -516,7 +525,7 @@  power_cppc_cpufreq_freq_down(unsigned int lcore_id)
 	struct cppc_power_info *pi;
 
 	if (lcore_id >= RTE_MAX_LCORE) {
-		RTE_LOG(ERR, POWER, "Invalid lcore ID\n");
+		POWER_LOG(ERR, "Invalid lcore ID");
 		return -1;
 	}
 
@@ -534,7 +543,7 @@  power_cppc_cpufreq_freq_up(unsigned int lcore_id)
 	struct cppc_power_info *pi;
 
 	if (lcore_id >= RTE_MAX_LCORE) {
-		RTE_LOG(ERR, POWER, "Invalid lcore ID\n");
+		POWER_LOG(ERR, "Invalid lcore ID");
 		return -1;
 	}
 
@@ -551,7 +560,7 @@  int
 power_cppc_cpufreq_freq_max(unsigned int lcore_id)
 {
 	if (lcore_id >= RTE_MAX_LCORE) {
-		RTE_LOG(ERR, POWER, "Invalid lcore ID\n");
+		POWER_LOG(ERR, "Invalid lcore ID");
 		return -1;
 	}
 
@@ -575,7 +584,7 @@  power_cppc_cpufreq_freq_min(unsigned int lcore_id)
 	struct cppc_power_info *pi;
 
 	if (lcore_id >= RTE_MAX_LCORE) {
-		RTE_LOG(ERR, POWER, "Invalid lcore ID\n");
+		POWER_LOG(ERR, "Invalid lcore ID");
 		return -1;
 	}
 
@@ -591,7 +600,7 @@  power_cppc_turbo_status(unsigned int lcore_id)
 	struct cppc_power_info *pi;
 
 	if (lcore_id >= RTE_MAX_LCORE) {
-		RTE_LOG(ERR, POWER, "Invalid lcore ID\n");
+		POWER_LOG(ERR, "Invalid lcore ID");
 		return -1;
 	}
 
@@ -606,7 +615,7 @@  power_cppc_enable_turbo(unsigned int lcore_id)
 	struct cppc_power_info *pi;
 
 	if (lcore_id >= RTE_MAX_LCORE) {
-		RTE_LOG(ERR, POWER, "Invalid lcore ID\n");
+		POWER_LOG(ERR, "Invalid lcore ID");
 		return -1;
 	}
 
@@ -616,8 +625,8 @@  power_cppc_enable_turbo(unsigned int lcore_id)
 		pi->turbo_enable = 1;
 	else {
 		pi->turbo_enable = 0;
-		RTE_LOG(ERR, POWER,
-			"Failed to enable turbo on lcore %u\n",
+		POWER_LOG(ERR,
+			"Failed to enable turbo on lcore %u",
 			lcore_id);
 		return -1;
 	}
@@ -627,8 +636,8 @@  power_cppc_enable_turbo(unsigned int lcore_id)
 	 */
 	/* Max may have changed, so call to max function */
 	if (power_cppc_cpufreq_freq_max(lcore_id) < 0) {
-		RTE_LOG(ERR, POWER,
-			"Failed to set frequency of lcore %u to max\n",
+		POWER_LOG(ERR,
+			"Failed to set frequency of lcore %u to max",
 			lcore_id);
 		return -1;
 	}
@@ -642,7 +651,7 @@  power_cppc_disable_turbo(unsigned int lcore_id)
 	struct cppc_power_info *pi;
 
 	if (lcore_id >= RTE_MAX_LCORE) {
-		RTE_LOG(ERR, POWER, "Invalid lcore ID\n");
+		POWER_LOG(ERR, "Invalid lcore ID");
 		return -1;
 	}
 
@@ -653,8 +662,8 @@  power_cppc_disable_turbo(unsigned int lcore_id)
 	if ((pi->turbo_available) && (pi->curr_idx <= 1)) {
 		/* Try to set freq to max by default coming out of turbo */
 		if (power_cppc_cpufreq_freq_max(lcore_id) < 0) {
-			RTE_LOG(ERR, POWER,
-				"Failed to set frequency of lcore %u to max\n",
+			POWER_LOG(ERR,
+				"Failed to set frequency of lcore %u to max",
 				lcore_id);
 			return -1;
 		}
@@ -670,11 +679,11 @@  power_cppc_get_capabilities(unsigned int lcore_id,
 	struct cppc_power_info *pi;
 
 	if (lcore_id >= RTE_MAX_LCORE) {
-		RTE_LOG(ERR, POWER, "Invalid lcore ID\n");
+		POWER_LOG(ERR, "Invalid lcore ID");
 		return -1;
 	}
 	if (caps == NULL) {
-		RTE_LOG(ERR, POWER, "Invalid argument\n");
+		POWER_LOG(ERR, "Invalid argument");
 		return -1;
 	}
 
diff --git a/lib/power/power_kvm_vm.c b/lib/power/power_kvm_vm.c
index 6a8109d44959..74a1094ffaa0 100644
--- a/lib/power/power_kvm_vm.c
+++ b/lib/power/power_kvm_vm.c
@@ -8,6 +8,7 @@ 
 
 #include "rte_power_guest_channel.h"
 #include "guest_channel.h"
+#include "power_common.h"
 #include "power_kvm_vm.h"
 
 #define FD_PATH "/dev/virtio-ports/virtio.serial.port.poweragent"
@@ -24,7 +25,7 @@  int
 power_kvm_vm_init(unsigned int lcore_id)
 {
 	if (lcore_id >= RTE_MAX_LCORE) {
-		RTE_LOG(ERR, POWER, "Core(%u) is out of range 0...%d\n",
+		POWER_LOG(ERR, "Core(%u) is out of range 0...%d",
 				lcore_id, RTE_MAX_LCORE-1);
 		return -1;
 	}
@@ -45,16 +46,16 @@  power_kvm_vm_freqs(__rte_unused unsigned int lcore_id,
 		__rte_unused uint32_t *freqs,
 		__rte_unused uint32_t num)
 {
-	RTE_LOG(ERR, POWER, "rte_power_freqs is not implemented "
-			"for Virtual Machine Power Management\n");
+	POWER_LOG(ERR,
+		  "not implemented for Virtual Machine Power Management");
 	return -ENOTSUP;
 }
 
 uint32_t
 power_kvm_vm_get_freq(__rte_unused unsigned int lcore_id)
 {
-	RTE_LOG(ERR, POWER, "rte_power_get_freq is not implemented "
-			"for Virtual Machine Power Management\n");
+	POWER_LOG(ERR,
+		  "not implemented for Virtual Machine Power Management");
 	return -ENOTSUP;
 }
 
@@ -62,8 +63,8 @@  int
 power_kvm_vm_set_freq(__rte_unused unsigned int lcore_id,
 		__rte_unused uint32_t index)
 {
-	RTE_LOG(ERR, POWER, "rte_power_set_freq is not implemented "
-			"for Virtual Machine Power Management\n");
+	POWER_LOG(ERR,
+		  "not implemented for Virtual Machine Power Management");
 	return -ENOTSUP;
 }
 
@@ -73,7 +74,7 @@  send_msg(unsigned int lcore_id, uint32_t scale_direction)
 	int ret;
 
 	if (lcore_id >= RTE_MAX_LCORE) {
-		RTE_LOG(ERR, POWER, "Core(%u) is out of range 0...%d\n",
+		POWER_LOG(ERR, "Core(%u) is out of range 0...%d",
 				lcore_id, RTE_MAX_LCORE-1);
 		return -1;
 	}
@@ -81,7 +82,7 @@  send_msg(unsigned int lcore_id, uint32_t scale_direction)
 	ret = guest_channel_send_msg(&pkt[lcore_id], lcore_id);
 	if (ret == 0)
 		return 1;
-	RTE_LOG(DEBUG, POWER, "Error sending message: %s\n",
+	POWER_LOG(DEBUG, "Error sending message: %s",
 			ret > 0 ? strerror(ret) : "channel not connected");
 	return -1;
 }
@@ -113,7 +114,7 @@  power_kvm_vm_freq_min(unsigned int lcore_id)
 int
 power_kvm_vm_turbo_status(__rte_unused unsigned int lcore_id)
 {
-	RTE_LOG(ERR, POWER, "rte_power_turbo_status is not implemented for Virtual Machine Power Management\n");
+	POWER_LOG(ERR, "rte_power_turbo_status is not implemented for Virtual Machine Power Management");
 	return -ENOTSUP;
 }
 
@@ -133,6 +134,7 @@  struct rte_power_core_capabilities;
 int power_kvm_vm_get_capabilities(__rte_unused unsigned int lcore_id,
 		__rte_unused struct rte_power_core_capabilities *caps)
 {
-	RTE_LOG(ERR, POWER, "rte_power_get_capabilities is not implemented for Virtual Machine Power Management\n");
+	POWER_LOG(ERR,
+		  "rte_power_get_capabilities is not implemented for Virtual Machine Power Management");
 	return -ENOTSUP;
 }
diff --git a/lib/power/power_pstate_cpufreq.c b/lib/power/power_pstate_cpufreq.c
index 52aa64510e21..c6869bbd3c59 100644
--- a/lib/power/power_pstate_cpufreq.c
+++ b/lib/power/power_pstate_cpufreq.c
@@ -81,7 +81,7 @@  power_read_turbo_pct(uint64_t *outVal)
 	fd = open(POWER_SYSFILE_TURBO_PCT, O_RDONLY);
 
 	if (fd < 0) {
-		RTE_LOG(ERR, POWER, "Error opening '%s': %s\n", POWER_SYSFILE_TURBO_PCT,
+		POWER_LOG(ERR, "Error opening '%s': %s", POWER_SYSFILE_TURBO_PCT,
 				 strerror(errno));
 		return fd;
 	}
@@ -89,7 +89,7 @@  power_read_turbo_pct(uint64_t *outVal)
 	ret = read(fd, val, sizeof(val));
 
 	if (ret < 0) {
-		RTE_LOG(ERR, POWER, "Error reading '%s': %s\n", POWER_SYSFILE_TURBO_PCT,
+		POWER_LOG(ERR, "Error reading '%s': %s", POWER_SYSFILE_TURBO_PCT,
 				 strerror(errno));
 		goto out;
 	}
@@ -97,7 +97,7 @@  power_read_turbo_pct(uint64_t *outVal)
 	errno = 0;
 	*outVal = (uint64_t) strtol(val, &endptr, 10);
 	if (errno != 0 || (*endptr != 0 && *endptr != '\n')) {
-		RTE_LOG(ERR, POWER, "Error converting str to digits, read from %s: %s\n",
+		POWER_LOG(ERR, "Error converting str to digits, read from %s: %s",
 				 POWER_SYSFILE_TURBO_PCT, strerror(errno));
 		ret = -1;
 		goto out;
@@ -125,7 +125,7 @@  power_init_for_setting_freq(struct pstate_power_info *pi)
 	open_core_sysfs_file(&f_base_max, "r", POWER_SYSFILE_BASE_MAX_FREQ,
 			pi->lcore_id);
 	if (f_base_max == NULL) {
-		RTE_LOG(ERR, POWER, "failed to open %s\n",
+		POWER_LOG(ERR, "failed to open %s",
 				POWER_SYSFILE_BASE_MAX_FREQ);
 		goto err;
 	}
@@ -133,7 +133,7 @@  power_init_for_setting_freq(struct pstate_power_info *pi)
 	open_core_sysfs_file(&f_base_min, "r", POWER_SYSFILE_BASE_MIN_FREQ,
 			pi->lcore_id);
 	if (f_base_min == NULL) {
-		RTE_LOG(ERR, POWER, "failed to open %s\n",
+		POWER_LOG(ERR, "failed to open %s",
 				POWER_SYSFILE_BASE_MIN_FREQ);
 		goto err;
 	}
@@ -141,7 +141,7 @@  power_init_for_setting_freq(struct pstate_power_info *pi)
 	open_core_sysfs_file(&f_min, "rw+", POWER_SYSFILE_MIN_FREQ,
 			pi->lcore_id);
 	if (f_min == NULL) {
-		RTE_LOG(ERR, POWER, "failed to open %s\n",
+		POWER_LOG(ERR, "failed to open %s",
 				POWER_SYSFILE_MIN_FREQ);
 		goto err;
 	}
@@ -149,7 +149,7 @@  power_init_for_setting_freq(struct pstate_power_info *pi)
 	open_core_sysfs_file(&f_max, "rw+", POWER_SYSFILE_MAX_FREQ,
 			pi->lcore_id);
 	if (f_max == NULL) {
-		RTE_LOG(ERR, POWER, "failed to open %s\n",
+		POWER_LOG(ERR, "failed to open %s",
 				POWER_SYSFILE_MAX_FREQ);
 		goto err;
 	}
@@ -161,7 +161,7 @@  power_init_for_setting_freq(struct pstate_power_info *pi)
 	/* read base max ratio */
 	ret = read_core_sysfs_u32(f_base_max, &base_max_ratio);
 	if (ret < 0) {
-		RTE_LOG(ERR, POWER, "Failed to read %s\n",
+		POWER_LOG(ERR, "Failed to read %s",
 				POWER_SYSFILE_BASE_MAX_FREQ);
 		goto err;
 	}
@@ -169,7 +169,7 @@  power_init_for_setting_freq(struct pstate_power_info *pi)
 	/* read base min ratio */
 	ret = read_core_sysfs_u32(f_base_min, &base_min_ratio);
 	if (ret < 0) {
-		RTE_LOG(ERR, POWER, "Failed to read %s\n",
+		POWER_LOG(ERR, "Failed to read %s",
 				POWER_SYSFILE_BASE_MIN_FREQ);
 		goto err;
 	}
@@ -178,7 +178,7 @@  power_init_for_setting_freq(struct pstate_power_info *pi)
 	if (f_base != NULL) {
 		ret = read_core_sysfs_u32(f_base, &base_ratio);
 		if (ret < 0) {
-			RTE_LOG(ERR, POWER, "Failed to read %s\n",
+			POWER_LOG(ERR, "Failed to read %s",
 					POWER_SYSFILE_BASE_FREQ);
 			goto err;
 		}
@@ -256,8 +256,9 @@  set_freq_internal(struct pstate_power_info *pi, uint32_t idx)
 	uint32_t target_freq = 0;
 
 	if (idx >= RTE_MAX_LCORE_FREQS || idx >= pi->nb_freqs) {
-		RTE_LOG(ERR, POWER, "Invalid frequency index %u, which "
-				"should be less than %u\n", idx, pi->nb_freqs);
+		POWER_LOG(ERR,
+			  "Invalid frequency index %u, which should be less than %u",
+			  idx, pi->nb_freqs);
 		return -1;
 	}
 
@@ -269,16 +270,16 @@  set_freq_internal(struct pstate_power_info *pi, uint32_t idx)
 	 * User need change the min/max as same value.
 	 */
 	if (fseek(pi->f_cur_min, 0, SEEK_SET) < 0) {
-		RTE_LOG(ERR, POWER, "Fail to set file position indicator to 0 "
-				"for setting frequency for lcore %u\n",
-				pi->lcore_id);
+		POWER_LOG(ERR,
+			  "Fail to set file position indicator to 0 for setting frequency for lcore %u",
+			  pi->lcore_id);
 		return -1;
 	}
 
 	if (fseek(pi->f_cur_max, 0, SEEK_SET) < 0) {
-		RTE_LOG(ERR, POWER, "Fail to set file position indicator to 0 "
-				"for setting frequency for lcore %u\n",
-				pi->lcore_id);
+		POWER_LOG(ERR,
+			  "Fail to set file position indicator to 0 for setting frequency for lcore %u",
+			  pi->lcore_id);
 		return -1;
 	}
 
@@ -287,7 +288,8 @@  set_freq_internal(struct pstate_power_info *pi, uint32_t idx)
 		if (pi->turbo_enable)
 			target_freq = pi->sys_max_freq;
 		else {
-			RTE_LOG(ERR, POWER, "Turbo is off, frequency can't be scaled up more %u\n",
+			POWER_LOG(ERR,
+				  "Turbo is off, frequency can't be scaled up more %u",
 					pi->lcore_id);
 			return -1;
 		}
@@ -298,14 +300,16 @@  set_freq_internal(struct pstate_power_info *pi, uint32_t idx)
 	if (idx  >  pi->curr_idx) {
 
 		if (fprintf(pi->f_cur_min, "%u", target_freq) < 0) {
-			RTE_LOG(ERR, POWER, "Fail to write new frequency for "
-					"lcore %u\n", pi->lcore_id);
+			POWER_LOG(ERR,
+				  "Fail to write new frequency for lcore %u",
+				  pi->lcore_id);
 			return -1;
 		}
 
 		if (fprintf(pi->f_cur_max, "%u", target_freq) < 0) {
-			RTE_LOG(ERR, POWER, "Fail to write new frequency for "
-					"lcore %u\n", pi->lcore_id);
+			POWER_LOG(ERR,
+				  "Fail to write new frequency for lcore %u",
+				  pi->lcore_id);
 			return -1;
 		}
 
@@ -321,14 +325,16 @@  set_freq_internal(struct pstate_power_info *pi, uint32_t idx)
 	if (idx  <  pi->curr_idx) {
 
 		if (fprintf(pi->f_cur_max, "%u", target_freq) < 0) {
-			RTE_LOG(ERR, POWER, "Fail to write new frequency for "
-					"lcore %u\n", pi->lcore_id);
+			POWER_LOG(ERR,
+				  "Fail to write new frequency for lcore %u",
+				  pi->lcore_id);
 			return -1;
 		}
 
 		if (fprintf(pi->f_cur_min, "%u", target_freq) < 0) {
-			RTE_LOG(ERR, POWER, "Fail to write new frequency for "
-					"lcore %u\n", pi->lcore_id);
+			POWER_LOG(ERR,
+				  "Fail to write new frequency for lcore %u",
+				  pi->lcore_id);
 			return -1;
 		}
 
@@ -383,7 +389,7 @@  power_get_available_freqs(struct pstate_power_info *pi)
 	open_core_sysfs_file(&f_max, "r", POWER_SYSFILE_BASE_MAX_FREQ,
 			pi->lcore_id);
 	if (f_max == NULL) {
-		RTE_LOG(ERR, POWER, "failed to open %s\n",
+		POWER_LOG(ERR, "failed to open %s",
 				POWER_SYSFILE_BASE_MAX_FREQ);
 		goto out;
 	}
@@ -391,7 +397,7 @@  power_get_available_freqs(struct pstate_power_info *pi)
 	open_core_sysfs_file(&f_min, "r", POWER_SYSFILE_BASE_MIN_FREQ,
 			pi->lcore_id);
 	if (f_min == NULL) {
-		RTE_LOG(ERR, POWER, "failed to open %s\n",
+		POWER_LOG(ERR, "failed to open %s",
 				POWER_SYSFILE_BASE_MIN_FREQ);
 		goto out;
 	}
@@ -399,14 +405,14 @@  power_get_available_freqs(struct pstate_power_info *pi)
 	/* read base ratios */
 	ret = read_core_sysfs_u32(f_max, &sys_max_freq);
 	if (ret < 0) {
-		RTE_LOG(ERR, POWER, "Failed to read %s\n",
+		POWER_LOG(ERR, "Failed to read %s",
 				POWER_SYSFILE_BASE_MAX_FREQ);
 		goto out;
 	}
 
 	ret = read_core_sysfs_u32(f_min, &sys_min_freq);
 	if (ret < 0) {
-		RTE_LOG(ERR, POWER, "Failed to read %s\n",
+		POWER_LOG(ERR, "Failed to read %s",
 				POWER_SYSFILE_BASE_MIN_FREQ);
 		goto out;
 	}
@@ -449,7 +455,7 @@  power_get_available_freqs(struct pstate_power_info *pi)
 	num_freqs = (RTE_MIN(base_max_freq, sys_max_freq) - sys_min_freq) / BUS_FREQ
 			+ 1 + pi->turbo_available;
 	if (num_freqs >= RTE_MAX_LCORE_FREQS) {
-		RTE_LOG(ERR, POWER, "Too many available frequencies: %d\n",
+		POWER_LOG(ERR, "Too many available frequencies: %d",
 				num_freqs);
 		goto out;
 	}
@@ -493,14 +499,14 @@  power_get_cur_idx(struct pstate_power_info *pi)
 	open_core_sysfs_file(&f_cur, "r", POWER_SYSFILE_CUR_FREQ,
 			pi->lcore_id);
 	if (f_cur == NULL) {
-		RTE_LOG(ERR, POWER, "failed to open %s\n",
+		POWER_LOG(ERR, "failed to open %s",
 				POWER_SYSFILE_CUR_FREQ);
 		goto fail;
 	}
 
 	ret = read_core_sysfs_u32(f_cur, &sys_cur_freq);
 	if (ret < 0) {
-		RTE_LOG(ERR, POWER, "Failed to read %s\n",
+		POWER_LOG(ERR, "Failed to read %s",
 				POWER_SYSFILE_CUR_FREQ);
 		goto fail;
 	}
@@ -542,7 +548,7 @@  power_pstate_cpufreq_init(unsigned int lcore_id)
 	uint32_t exp_state;
 
 	if (lcore_id >= RTE_MAX_LCORE) {
-		RTE_LOG(ERR, POWER, "Lcore id %u can not exceed %u\n",
+		POWER_LOG(ERR, "Lcore id %u can not exceed %u",
 				lcore_id, RTE_MAX_LCORE - 1U);
 		return -1;
 	}
@@ -558,47 +564,52 @@  power_pstate_cpufreq_init(unsigned int lcore_id)
 	if (!__atomic_compare_exchange_n(&(pi->state), &exp_state,
 					POWER_ONGOING, 0,
 					__ATOMIC_ACQUIRE, __ATOMIC_RELAXED)) {
-		RTE_LOG(INFO, POWER, "Power management of lcore %u is "
-				"in use\n", lcore_id);
+		POWER_LOG(INFO,
+			  "Power management of lcore %u is in use", lcore_id);
 		return -1;
 	}
 
 	pi->lcore_id = lcore_id;
 	/* Check and set the governor */
 	if (power_set_governor_performance(pi) < 0) {
-		RTE_LOG(ERR, POWER, "Cannot set governor of lcore %u to "
-				"performance\n", lcore_id);
+		POWER_LOG(ERR,
+			  "Cannot set governor of lcore %u to performance",
+			  lcore_id);
 		goto fail;
 	}
 	/* Init for setting lcore frequency */
 	if (power_init_for_setting_freq(pi) < 0) {
-		RTE_LOG(ERR, POWER, "Cannot init for setting frequency for "
-				"lcore %u\n", lcore_id);
+		POWER_LOG(ERR,
+			  "Cannot init for setting frequency for lcore %u",
+			  lcore_id);
 		goto fail;
 	}
 
 	/* Get the available frequencies */
 	if (power_get_available_freqs(pi) < 0) {
-		RTE_LOG(ERR, POWER, "Cannot get available frequencies of "
-				"lcore %u\n", lcore_id);
+		POWER_LOG(ERR,
+			  "Cannot get available frequencies of lcore %u",
+			  lcore_id);
 		goto fail;
 	}
 
 	if (power_get_cur_idx(pi) < 0) {
-		RTE_LOG(ERR, POWER, "Cannot get current frequency "
-				"index of lcore %u\n", lcore_id);
+		POWER_LOG(ERR,
+			  "Cannot get current frequency index of lcore %u",
+			  lcore_id);
 		goto fail;
 	}
 
 	/* Set freq to max by default */
 	if (power_pstate_cpufreq_freq_max(lcore_id) < 0) {
-		RTE_LOG(ERR, POWER, "Cannot set frequency of lcore %u "
-				"to max\n", lcore_id);
+		POWER_LOG(ERR,
+			  "Cannot set frequency of lcore %u to max", lcore_id);
 		goto fail;
 	}
 
-	RTE_LOG(INFO, POWER, "Initialized successfully for lcore %u "
-			"power management\n", lcore_id);
+	POWER_LOG(INFO,
+		  "Initialized successfully for lcore %u power management",
+		  lcore_id);
 	exp_state = POWER_ONGOING;
 	__atomic_compare_exchange_n(&(pi->state), &exp_state, POWER_USED,
 				    0, __ATOMIC_RELEASE, __ATOMIC_RELAXED);
@@ -620,7 +631,7 @@  power_pstate_cpufreq_exit(unsigned int lcore_id)
 	uint32_t exp_state;
 
 	if (lcore_id >= RTE_MAX_LCORE) {
-		RTE_LOG(ERR, POWER, "Lcore id %u can not exceeds %u\n",
+		POWER_LOG(ERR, "Lcore id %u can not exceeds %u",
 				lcore_id, RTE_MAX_LCORE - 1U);
 		return -1;
 	}
@@ -636,8 +647,8 @@  power_pstate_cpufreq_exit(unsigned int lcore_id)
 	if (!__atomic_compare_exchange_n(&(pi->state), &exp_state,
 					POWER_ONGOING, 0,
 					__ATOMIC_ACQUIRE, __ATOMIC_RELAXED)) {
-		RTE_LOG(INFO, POWER, "Power management of lcore %u is "
-				"not used\n", lcore_id);
+		POWER_LOG(INFO,
+			  "Power management of lcore %u is not used", lcore_id);
 		return -1;
 	}
 
@@ -649,14 +660,15 @@  power_pstate_cpufreq_exit(unsigned int lcore_id)
 
 	/* Set the governor back to the original */
 	if (power_set_governor_original(pi) < 0) {
-		RTE_LOG(ERR, POWER, "Cannot set the governor of %u back "
-				"to the original\n", lcore_id);
+		POWER_LOG(ERR,
+			  "Cannot set the governor of %u back to the original",
+			  lcore_id);
 		goto fail;
 	}
 
-	RTE_LOG(INFO, POWER, "Power management of lcore %u has exited from "
-			"'performance' mode and been set back to the "
-			"original\n", lcore_id);
+	POWER_LOG(INFO,
+		  "Power management of lcore %u has exited from 'performance' mode and been set back to the original",
+		  lcore_id);
 	exp_state = POWER_ONGOING;
 	__atomic_compare_exchange_n(&(pi->state), &exp_state, POWER_IDLE,
 				    0, __ATOMIC_RELEASE, __ATOMIC_RELAXED);
@@ -678,18 +690,18 @@  power_pstate_cpufreq_freqs(unsigned int lcore_id, uint32_t *freqs, uint32_t num)
 	struct pstate_power_info *pi;
 
 	if (lcore_id >= RTE_MAX_LCORE) {
-		RTE_LOG(ERR, POWER, "Invalid lcore ID\n");
+		POWER_LOG(ERR, "Invalid lcore ID");
 		return 0;
 	}
 
 	if (freqs == NULL) {
-		RTE_LOG(ERR, POWER, "NULL buffer supplied\n");
+		POWER_LOG(ERR, "NULL buffer supplied");
 		return 0;
 	}
 
 	pi = &lcore_power_info[lcore_id];
 	if (num < pi->nb_freqs) {
-		RTE_LOG(ERR, POWER, "Buffer size is not enough\n");
+		POWER_LOG(ERR, "Buffer size is not enough");
 		return 0;
 	}
 	rte_memcpy(freqs, pi->freqs, pi->nb_freqs * sizeof(uint32_t));
@@ -701,7 +713,7 @@  uint32_t
 power_pstate_cpufreq_get_freq(unsigned int lcore_id)
 {
 	if (lcore_id >= RTE_MAX_LCORE) {
-		RTE_LOG(ERR, POWER, "Invalid lcore ID\n");
+		POWER_LOG(ERR, "Invalid lcore ID");
 		return RTE_POWER_INVALID_FREQ_INDEX;
 	}
 
@@ -713,7 +725,7 @@  int
 power_pstate_cpufreq_set_freq(unsigned int lcore_id, uint32_t index)
 {
 	if (lcore_id >= RTE_MAX_LCORE) {
-		RTE_LOG(ERR, POWER, "Invalid lcore ID\n");
+		POWER_LOG(ERR, "Invalid lcore ID");
 		return -1;
 	}
 
@@ -726,7 +738,7 @@  power_pstate_cpufreq_freq_up(unsigned int lcore_id)
 	struct pstate_power_info *pi;
 
 	if (lcore_id >= RTE_MAX_LCORE) {
-		RTE_LOG(ERR, POWER, "Invalid lcore ID\n");
+		POWER_LOG(ERR, "Invalid lcore ID");
 		return -1;
 	}
 
@@ -745,7 +757,7 @@  power_pstate_cpufreq_freq_down(unsigned int lcore_id)
 	struct pstate_power_info *pi;
 
 	if (lcore_id >= RTE_MAX_LCORE) {
-		RTE_LOG(ERR, POWER, "Invalid lcore ID\n");
+		POWER_LOG(ERR, "Invalid lcore ID");
 		return -1;
 	}
 
@@ -761,7 +773,7 @@  int
 power_pstate_cpufreq_freq_max(unsigned int lcore_id)
 {
 	if (lcore_id >= RTE_MAX_LCORE) {
-		RTE_LOG(ERR, POWER, "Invalid lcore ID\n");
+		POWER_LOG(ERR, "Invalid lcore ID");
 		return -1;
 	}
 
@@ -786,7 +798,7 @@  power_pstate_cpufreq_freq_min(unsigned int lcore_id)
 	struct pstate_power_info *pi;
 
 	if (lcore_id >= RTE_MAX_LCORE) {
-		RTE_LOG(ERR, POWER, "Invalid lcore ID\n");
+		POWER_LOG(ERR, "Invalid lcore ID");
 		return -1;
 	}
 
@@ -803,7 +815,7 @@  power_pstate_turbo_status(unsigned int lcore_id)
 	struct pstate_power_info *pi;
 
 	if (lcore_id >= RTE_MAX_LCORE) {
-		RTE_LOG(ERR, POWER, "Invalid lcore ID\n");
+		POWER_LOG(ERR, "Invalid lcore ID");
 		return -1;
 	}
 
@@ -818,7 +830,7 @@  power_pstate_enable_turbo(unsigned int lcore_id)
 	struct pstate_power_info *pi;
 
 	if (lcore_id >= RTE_MAX_LCORE) {
-		RTE_LOG(ERR, POWER, "Invalid lcore ID\n");
+		POWER_LOG(ERR, "Invalid lcore ID");
 		return -1;
 	}
 
@@ -828,10 +840,10 @@  power_pstate_enable_turbo(unsigned int lcore_id)
 		pi->turbo_enable = 1;
 	else {
 		pi->turbo_enable = 0;
-		RTE_LOG(ERR, POWER,
-			"Failed to enable turbo on lcore %u\n",
-			lcore_id);
-			return -1;
+		POWER_LOG(ERR,
+			  "Failed to enable turbo on lcore %u",
+			  lcore_id);
+		return -1;
 	}
 
 	return 0;
@@ -844,7 +856,7 @@  power_pstate_disable_turbo(unsigned int lcore_id)
 	struct pstate_power_info *pi;
 
 	if (lcore_id >= RTE_MAX_LCORE) {
-		RTE_LOG(ERR, POWER, "Invalid lcore ID\n");
+		POWER_LOG(ERR, "Invalid lcore ID");
 		return -1;
 	}
 
@@ -855,8 +867,8 @@  power_pstate_disable_turbo(unsigned int lcore_id)
 	if (pi->turbo_available && pi->curr_idx <= 1) {
 		/* Try to set freq to max by default coming out of turbo */
 		if (power_pstate_cpufreq_freq_max(lcore_id) < 0) {
-			RTE_LOG(ERR, POWER,
-				"Failed to set frequency of lcore %u to max\n",
+			POWER_LOG(ERR,
+				"Failed to set frequency of lcore %u to max",
 				lcore_id);
 			return -1;
 		}
@@ -872,11 +884,11 @@  int power_pstate_get_capabilities(unsigned int lcore_id,
 	struct pstate_power_info *pi;
 
 	if (lcore_id >= RTE_MAX_LCORE) {
-		RTE_LOG(ERR, POWER, "Invalid lcore ID\n");
+		POWER_LOG(ERR, "Invalid lcore ID");
 		return -1;
 	}
 	if (caps == NULL) {
-		RTE_LOG(ERR, POWER, "Invalid argument\n");
+		POWER_LOG(ERR, "Invalid argument");
 		return -1;
 	}
 
diff --git a/lib/power/rte_power.c b/lib/power/rte_power.c
index 63a43bd8f5ae..23a97fa77f53 100644
--- a/lib/power/rte_power.c
+++ b/lib/power/rte_power.c
@@ -10,6 +10,7 @@ 
 #include "rte_power.h"
 #include "power_acpi_cpufreq.h"
 #include "power_cppc_cpufreq.h"
+#include "power_common.h"
 #include "power_kvm_vm.h"
 #include "power_pstate_cpufreq.h"
 
@@ -70,7 +71,7 @@  rte_power_set_env(enum power_management_env env)
 	rte_spinlock_lock(&global_env_cfg_lock);
 
 	if (global_default_env != PM_ENV_NOT_SET) {
-		RTE_LOG(ERR, POWER, "Power Management Environment already set.\n");
+		POWER_LOG(ERR, "Power Management Environment already set.");
 		rte_spinlock_unlock(&global_env_cfg_lock);
 		return -1;
 	}
@@ -127,7 +128,7 @@  rte_power_set_env(enum power_management_env env)
 		rte_power_freq_disable_turbo = power_cppc_disable_turbo;
 		rte_power_get_capabilities = power_cppc_get_capabilities;
 	} else {
-		RTE_LOG(ERR, POWER, "Invalid Power Management Environment(%d) set\n",
+		POWER_LOG(ERR, "Invalid Power Management Environment(%d) set",
 				env);
 		ret = -1;
 	}
@@ -172,39 +173,40 @@  rte_power_init(unsigned int lcore_id)
 	case PM_ENV_CPPC_CPUFREQ:
 		return power_cppc_cpufreq_init(lcore_id);
 	default:
-		RTE_LOG(INFO, POWER, "Env isn't set yet!\n");
+		POWER_LOG(INFO, "Env isn't set yet!");
 	}
 
 	/* Auto detect Environment */
-	RTE_LOG(INFO, POWER, "Attempting to initialise ACPI cpufreq power management...\n");
+	POWER_LOG(INFO, "Attempting to initialise ACPI cpufreq power management...");
 	ret = power_acpi_cpufreq_init(lcore_id);
 	if (ret == 0) {
 		rte_power_set_env(PM_ENV_ACPI_CPUFREQ);
 		goto out;
 	}
 
-	RTE_LOG(INFO, POWER, "Attempting to initialise PSTAT power management...\n");
+	POWER_LOG(INFO, "Attempting to initialise PSTAT power management...");
 	ret = power_pstate_cpufreq_init(lcore_id);
 	if (ret == 0) {
 		rte_power_set_env(PM_ENV_PSTATE_CPUFREQ);
 		goto out;
 	}
 
-	RTE_LOG(INFO, POWER, "Attempting to initialise CPPC power management...\n");
+	POWER_LOG(INFO, "Attempting to initialise CPPC power management...");
 	ret = power_cppc_cpufreq_init(lcore_id);
 	if (ret == 0) {
 		rte_power_set_env(PM_ENV_CPPC_CPUFREQ);
 		goto out;
 	}
 
-	RTE_LOG(INFO, POWER, "Attempting to initialise VM power management...\n");
+	POWER_LOG(INFO, "Attempting to initialise VM power management...");
 	ret = power_kvm_vm_init(lcore_id);
 	if (ret == 0) {
 		rte_power_set_env(PM_ENV_KVM_VM);
 		goto out;
 	}
-	RTE_LOG(ERR, POWER, "Unable to set Power Management Environment for lcore "
-			"%u\n", lcore_id);
+	POWER_LOG(ERR,
+		  "Unable to set Power Management Environment for lcore %u",
+		  lcore_id);
 out:
 	return ret;
 }
@@ -222,9 +224,12 @@  rte_power_exit(unsigned int lcore_id)
 	case PM_ENV_CPPC_CPUFREQ:
 		return power_cppc_cpufreq_exit(lcore_id);
 	default:
-		RTE_LOG(ERR, POWER, "Environment has not been set, unable to exit gracefully\n");
+		POWER_LOG(ERR,
+			  "Environment has not been set, unable to exit gracefully");
 
 	}
 	return -1;
 
 }
+
+RTE_LOG_REGISTER_DEFAULT(power_logtype, INFO);
diff --git a/lib/power/rte_power_empty_poll.c b/lib/power/rte_power_empty_poll.c
index 4a4db512474e..da4b1ec3068a 100644
--- a/lib/power/rte_power_empty_poll.c
+++ b/lib/power/rte_power_empty_poll.c
@@ -10,6 +10,7 @@ 
 
 #include "rte_power.h"
 #include "rte_power_empty_poll.h"
+#include "power_common.h"
 
 #define INTERVALS_PER_SECOND 100     /* (10ms) */
 #define SECONDS_TO_TRAIN_FOR 2
@@ -75,7 +76,7 @@  enter_normal_state(struct priority_worker *poll_stats)
 	poll_stats->iter_counter = 0;
 	poll_stats->threshold_ctr = 0;
 	poll_stats->queue_state = MED_NORMAL;
-	RTE_LOG(INFO, POWER, "Set the power freq to MED\n");
+	POWER_LOG(INFO, "Set the power freq to MED");
 	set_power_freq(poll_stats->lcore_id, MED, false);
 
 	poll_stats->thresh[MED].threshold_percent = med_to_high_threshold;
@@ -213,11 +214,9 @@  update_stats(struct priority_worker *poll_stats)
 	if (s->thresh[s->cur_freq].base_edpi < cur_edpi) {
 
 		/* edpi mean empty poll counter difference per interval */
-		RTE_LOG(DEBUG, POWER, "cur_edpi is too large "
-				"cur edpi %"PRId64" "
-				"base edpi %"PRId64"\n",
-				cur_edpi,
-				s->thresh[s->cur_freq].base_edpi);
+		POWER_LOG(DEBUG,
+			  "cur_edpi is too large cur edpi %"PRId64" base edpi %"PRId64,
+			  cur_edpi, s->thresh[s->cur_freq].base_edpi);
 		/* Value to make us fail need debug log*/
 		return 1000UL;
 	}
@@ -247,7 +246,7 @@  update_stats_normal(struct priority_worker *poll_stats)
 		enum freq_val cur_freq = poll_stats->cur_freq;
 
 		/* edpi mean empty poll counter difference per interval */
-		RTE_LOG(DEBUG, POWER, "cure freq is %d, edpi is %"PRIu64"\n",
+		POWER_LOG(DEBUG, "cure freq is %d, edpi is %"PRIu64"",
 				cur_freq,
 				poll_stats->thresh[cur_freq].base_edpi);
 		return;
@@ -257,12 +256,12 @@  update_stats_normal(struct priority_worker *poll_stats)
 
 	if (percent > 100) {
 		/* edpi mean empty poll counter difference per interval */
-		RTE_LOG(DEBUG, POWER, "Edpi is bigger than threshold\n");
+		POWER_LOG(DEBUG, "Edpi is bigger than threshold");
 		return;
 	}
 
 	if (poll_stats->cur_freq == LOW)
-		RTE_LOG(INFO, POWER, "Purge Mode is not currently supported\n");
+		POWER_LOG(INFO, "Purge Mode is not currently supported");
 	else if (poll_stats->cur_freq == MED) {
 
 		if (percent >
@@ -272,7 +271,7 @@  update_stats_normal(struct priority_worker *poll_stats)
 				poll_stats->threshold_ctr++;
 			else {
 				set_state(poll_stats, HGH_BUSY);
-				RTE_LOG(INFO, POWER, "MOVE to HGH\n");
+				POWER_LOG(INFO, "MOVE to HGH");
 			}
 
 		} else {
@@ -289,7 +288,7 @@  update_stats_normal(struct priority_worker *poll_stats)
 				poll_stats->threshold_ctr++;
 			else {
 				set_state(poll_stats, MED_NORMAL);
-				RTE_LOG(INFO, POWER, "MOVE to MED\n");
+				POWER_LOG(INFO, "MOVE to MED");
 			}
 		} else {
 			/* reset */
@@ -332,17 +331,17 @@  empty_poll_training(struct priority_worker *poll_stats,
 
 		set_state(poll_stats, MED_NORMAL);
 
-		RTE_LOG(INFO, POWER, "LOW threshold is %"PRIu64"\n",
+		POWER_LOG(INFO, "LOW threshold is %"PRIu64"",
 				poll_stats->thresh[LOW].base_edpi);
 
-		RTE_LOG(INFO, POWER, "MED threshold is %"PRIu64"\n",
+		POWER_LOG(INFO, "MED threshold is %"PRIu64"",
 				poll_stats->thresh[MED].base_edpi);
 
 
-		RTE_LOG(INFO, POWER, "HIGH threshold is %"PRIu64"\n",
+		POWER_LOG(INFO, "HIGH threshold is %"PRIu64"",
 				poll_stats->thresh[HGH].base_edpi);
 
-		RTE_LOG(INFO, POWER, "Training is Complete for %d\n",
+		POWER_LOG(INFO, "Training is Complete for %d",
 				poll_stats->lcore_id);
 	}
 
@@ -414,7 +413,7 @@  rte_power_empty_poll_stat_init(struct ep_params **eptr, uint8_t *freq_tlb,
 		freq_index[HGH] = freq_tlb[HGH];
 	}
 
-	RTE_LOG(INFO, POWER, "Initialize the Empty Poll\n");
+	POWER_LOG(INFO, "Initialize the Empty Poll");
 
 	/* Train for pre-defined period */
 	ep_params->max_train_iter = INTERVALS_PER_SECOND * SECONDS_TO_TRAIN_FOR;
@@ -433,7 +432,7 @@  rte_power_empty_poll_stat_init(struct ep_params **eptr, uint8_t *freq_tlb,
 				avail_freqs[i],
 				NUM_FREQS);
 
-		RTE_LOG(INFO, POWER, "total avail freq is %d , lcoreid %d\n",
+		POWER_LOG(INFO, "total avail freq is %d , lcoreid %d",
 				total_avail_freqs[i],
 				i);
 
@@ -452,8 +451,7 @@  rte_power_empty_poll_stat_init(struct ep_params **eptr, uint8_t *freq_tlb,
 void
 rte_power_empty_poll_stat_free(void)
 {
-
-	RTE_LOG(INFO, POWER, "Close the Empty Poll\n");
+	POWER_LOG(INFO, "Close the Empty Poll");
 
 	rte_free(ep_params);
 }
diff --git a/lib/power/rte_power_intel_uncore.c b/lib/power/rte_power_intel_uncore.c
index 3b8724385fb7..ee6412a3ed34 100644
--- a/lib/power/rte_power_intel_uncore.c
+++ b/lib/power/rte_power_intel_uncore.c
@@ -52,8 +52,9 @@  set_uncore_freq_internal(struct uncore_power_info *ui, uint32_t idx)
 	int ret;
 
 	if (idx >= MAX_UNCORE_FREQS || idx >= ui->nb_freqs) {
-		RTE_LOG(DEBUG, POWER, "Invalid uncore frequency index %u, which "
-				"should be less than %u\n", idx, ui->nb_freqs);
+		POWER_LOG(DEBUG,
+			  "Invalid uncore frequency index %u, which should be less than %u",
+			  idx, ui->nb_freqs);
 		return -1;
 	}
 
@@ -65,13 +66,13 @@  set_uncore_freq_internal(struct uncore_power_info *ui, uint32_t idx)
 	open_core_sysfs_file(&ui->f_cur_max, "rw+", POWER_INTEL_UNCORE_SYSFILE_MAX_FREQ,
 			ui->pkg, ui->die);
 	if (ui->f_cur_max == NULL) {
-		RTE_LOG(DEBUG, POWER, "failed to open %s\n",
+		POWER_LOG(DEBUG, "failed to open %s",
 				POWER_INTEL_UNCORE_SYSFILE_MAX_FREQ);
 		return -1;
 	}
 	ret = read_core_sysfs_u32(ui->f_cur_max, &curr_max_freq);
 	if (ret < 0) {
-		RTE_LOG(DEBUG, POWER, "Failed to read %s\n",
+		POWER_LOG(DEBUG, "Failed to read %s",
 				POWER_INTEL_UNCORE_SYSFILE_MAX_FREQ);
 		fclose(ui->f_cur_max);
 		return -1;
@@ -79,14 +80,16 @@  set_uncore_freq_internal(struct uncore_power_info *ui, uint32_t idx)
 
 	/* check this value first before fprintf value to f_cur_max, so value isn't overwritten */
 	if (fprintf(ui->f_cur_min, "%u", target_uncore_freq) < 0) {
-		RTE_LOG(ERR, POWER, "Fail to write new uncore frequency for "
-				"pkg %02u die %02u\n", ui->pkg, ui->die);
+		POWER_LOG(ERR,
+			  "Fail to write new uncore frequency for pkg %02u die %02u",
+			  ui->pkg, ui->die);
 		return -1;
 	}
 
 	if (fprintf(ui->f_cur_max, "%u", target_uncore_freq) < 0) {
-		RTE_LOG(ERR, POWER, "Fail to write new uncore frequency for "
-				"pkg %02u die %02u\n", ui->pkg, ui->die);
+		POWER_LOG(ERR,
+			  "Fail to write new uncore frequency for pkg %02u die %02u",
+			  ui->pkg, ui->die);
 		return -1;
 	}
 
@@ -121,13 +124,13 @@  power_init_for_setting_uncore_freq(struct uncore_power_info *ui)
 	open_core_sysfs_file(&f_base_max, "r", POWER_INTEL_UNCORE_SYSFILE_BASE_MAX_FREQ,
 			ui->pkg, ui->die);
 	if (f_base_max == NULL) {
-		RTE_LOG(DEBUG, POWER, "failed to open %s\n",
+		POWER_LOG(DEBUG, "failed to open %s",
 				POWER_INTEL_UNCORE_SYSFILE_BASE_MAX_FREQ);
 		goto err;
 	}
 	ret = read_core_sysfs_u32(f_base_max, &base_max_freq);
 	if (ret < 0) {
-		RTE_LOG(DEBUG, POWER, "Failed to read %s\n",
+		POWER_LOG(DEBUG, "Failed to read %s",
 				POWER_INTEL_UNCORE_SYSFILE_BASE_MAX_FREQ);
 		goto err;
 	}
@@ -136,14 +139,14 @@  power_init_for_setting_uncore_freq(struct uncore_power_info *ui)
 	open_core_sysfs_file(&f_base_min, "r", POWER_INTEL_UNCORE_SYSFILE_BASE_MIN_FREQ,
 		ui->pkg, ui->die);
 	if (f_base_min == NULL) {
-		RTE_LOG(DEBUG, POWER, "failed to open %s\n",
+		POWER_LOG(DEBUG, "failed to open %s",
 				POWER_INTEL_UNCORE_SYSFILE_BASE_MIN_FREQ);
 		goto err;
 	}
 	if (f_base_min != NULL) {
 		ret = read_core_sysfs_u32(f_base_min, &base_min_freq);
 		if (ret < 0) {
-			RTE_LOG(DEBUG, POWER, "Failed to read %s\n",
+			POWER_LOG(DEBUG, "Failed to read %s",
 					POWER_INTEL_UNCORE_SYSFILE_BASE_MIN_FREQ);
 			goto err;
 		}
@@ -153,14 +156,14 @@  power_init_for_setting_uncore_freq(struct uncore_power_info *ui)
 	open_core_sysfs_file(&f_min, "rw+", POWER_INTEL_UNCORE_SYSFILE_MIN_FREQ,
 			ui->pkg, ui->die);
 	if (f_min == NULL) {
-		RTE_LOG(DEBUG, POWER, "failed to open %s\n",
+		POWER_LOG(DEBUG, "failed to open %s",
 				POWER_INTEL_UNCORE_SYSFILE_MIN_FREQ);
 		goto err;
 	}
 	if (f_min != NULL) {
 		ret = read_core_sysfs_u32(f_min, &min_freq);
 		if (ret < 0) {
-			RTE_LOG(DEBUG, POWER, "Failed to read %s\n",
+			POWER_LOG(DEBUG, "Failed to read %s",
 					POWER_INTEL_UNCORE_SYSFILE_MIN_FREQ);
 			goto err;
 		}
@@ -170,14 +173,14 @@  power_init_for_setting_uncore_freq(struct uncore_power_info *ui)
 	open_core_sysfs_file(&f_max, "rw+", POWER_INTEL_UNCORE_SYSFILE_MAX_FREQ,
 			ui->pkg, ui->die);
 	if (f_max == NULL) {
-		RTE_LOG(DEBUG, POWER, "failed to open %s\n",
+		POWER_LOG(DEBUG, "failed to open %s",
 				POWER_INTEL_UNCORE_SYSFILE_MAX_FREQ);
 		goto err;
 	}
 	if (f_max != NULL) {
 		ret = read_core_sysfs_u32(f_max, &max_freq);
 		if (ret < 0) {
-			RTE_LOG(DEBUG, POWER, "Failed to read %s\n",
+			POWER_LOG(DEBUG, "Failed to read %s",
 					POWER_INTEL_UNCORE_SYSFILE_MAX_FREQ);
 			goto err;
 		}
@@ -222,7 +225,7 @@  power_get_available_uncore_freqs(struct uncore_power_info *ui)
 
 	num_uncore_freqs = (ui->init_max_freq - ui->init_min_freq) / BUS_FREQ + 1;
 	if (num_uncore_freqs >= MAX_UNCORE_FREQS) {
-		RTE_LOG(ERR, POWER, "Too many available uncore frequencies: %d\n",
+		POWER_LOG(ERR, "Too many available uncore frequencies: %d",
 				num_uncore_freqs);
 		goto out;
 	}
@@ -250,7 +253,7 @@  check_pkg_die_values(unsigned int pkg, unsigned int die)
 	if (max_pkgs == 0)
 		return -1;
 	if (pkg >= max_pkgs) {
-		RTE_LOG(DEBUG, POWER, "Package number %02u can not exceed %u\n",
+		POWER_LOG(DEBUG, "Package number %02u can not exceed %u",
 				pkg, max_pkgs);
 		return -1;
 	}
@@ -259,7 +262,7 @@  check_pkg_die_values(unsigned int pkg, unsigned int die)
 	if (max_dies == 0)
 		return -1;
 	if (die >= max_dies) {
-		RTE_LOG(DEBUG, POWER, "Die number %02u can not exceed %u\n",
+		POWER_LOG(DEBUG, "Die number %02u can not exceed %u",
 				die, max_dies);
 		return -1;
 	}
@@ -282,15 +285,17 @@  rte_power_uncore_init(unsigned int pkg, unsigned int die)
 
 	/* Init for setting uncore die frequency */
 	if (power_init_for_setting_uncore_freq(ui) < 0) {
-		RTE_LOG(DEBUG, POWER, "Cannot init for setting uncore frequency for "
-				"pkg %02u die %02u\n", pkg, die);
+		POWER_LOG(DEBUG,
+			  "Cannot init for setting uncore frequency for pkg %02u die %02u",
+			  pkg, die);
 		return -1;
 	}
 
 	/* Get the available frequencies */
 	if (power_get_available_uncore_freqs(ui) < 0) {
-		RTE_LOG(DEBUG, POWER, "Cannot get available uncore frequencies of "
-				"pkg %02u die %02u\n", pkg, die);
+		POWER_LOG(DEBUG,
+			  "Cannot get available uncore frequencies of pkg %02u die %02u",
+			  pkg, die);
 		return -1;
 	}
 
@@ -309,14 +314,16 @@  rte_power_uncore_exit(unsigned int pkg, unsigned int die)
 	ui = &uncore_info[pkg][die];
 
 	if (fprintf(ui->f_cur_min, "%u", ui->org_min_freq) < 0) {
-		RTE_LOG(ERR, POWER, "Fail to write original uncore frequency for "
-				"pkg %02u die %02u\n", ui->pkg, ui->die);
+		POWER_LOG(ERR,
+			  "Fail to write original uncore frequency for pkg %02u die %02u",
+			  ui->pkg, ui->die);
 		return -1;
 	}
 
 	if (fprintf(ui->f_cur_max, "%u", ui->org_max_freq) < 0) {
-		RTE_LOG(ERR, POWER, "Fail to write original uncore frequency for "
-				"pkg %02u die %02u\n", ui->pkg, ui->die);
+		POWER_LOG(ERR,
+			  "Fail to write original uncore frequency for pkg %02u die %02u",
+			  ui->pkg, ui->die);
 		return -1;
 	}
 
@@ -395,10 +402,8 @@  rte_power_uncore_get_num_pkgs(void)
 
 	d = opendir(INTEL_UNCORE_FREQUENCY_DIR);
 	if (d == NULL) {
-		RTE_LOG(ERR, POWER,
-		"Uncore frequency management not supported/enabled on this kernel. "
-		"Please enable CONFIG_INTEL_UNCORE_FREQ_CONTROL if on x86 with linux kernel"
-		" >= 5.6\n");
+		POWER_LOG(ERR,
+			  "Uncore frequency management not supported/enabled on this kernel");
 		return 0;
 	}
 
@@ -427,16 +432,14 @@  rte_power_uncore_get_num_dies(unsigned int pkg)
 	if (max_pkgs == 0)
 		return 0;
 	if (pkg >= max_pkgs) {
-		RTE_LOG(DEBUG, POWER, "Invalid package number\n");
+		POWER_LOG(DEBUG, "Invalid package number");
 		return 0;
 	}
 
 	d = opendir(INTEL_UNCORE_FREQUENCY_DIR);
 	if (d == NULL) {
-		RTE_LOG(ERR, POWER,
-		"Uncore frequency management not supported/enabled on this kernel. "
-		"Please enable CONFIG_INTEL_UNCORE_FREQ_CONTROL if on x86 with linux kernel"
-		" >= 5.6\n");
+		POWER_LOG(ERR,
+			  "Uncore frequency management not supported/enabled on this kernel");
 		return 0;
 	}
 
diff --git a/lib/power/rte_power_pmd_mgmt.c b/lib/power/rte_power_pmd_mgmt.c
index ca1840387c74..e691e754ccb0 100644
--- a/lib/power/rte_power_pmd_mgmt.c
+++ b/lib/power/rte_power_pmd_mgmt.c
@@ -146,7 +146,7 @@  get_monitor_addresses(struct pmd_core_cfg *cfg,
 
 		/* attempted out of bounds access */
 		if (i >= len) {
-			RTE_LOG(ERR, POWER, "Too many queues being monitored\n");
+			POWER_LOG(ERR, "Too many queues being monitored");
 			return -1;
 		}
 
@@ -422,7 +422,7 @@  check_scale(unsigned int lcore)
 	/* only PSTATE and ACPI modes are supported */
 	if (!rte_power_check_env_supported(PM_ENV_ACPI_CPUFREQ) &&
 	    !rte_power_check_env_supported(PM_ENV_PSTATE_CPUFREQ)) {
-		RTE_LOG(DEBUG, POWER, "Neither ACPI nor PSTATE modes are supported\n");
+		POWER_LOG(DEBUG, "Neither ACPI nor PSTATE modes are supported");
 		return -ENOTSUP;
 	}
 	/* ensure we could initialize the power library */
@@ -432,7 +432,7 @@  check_scale(unsigned int lcore)
 	/* ensure we initialized the correct env */
 	env = rte_power_get_env();
 	if (env != PM_ENV_ACPI_CPUFREQ && env != PM_ENV_PSTATE_CPUFREQ) {
-		RTE_LOG(DEBUG, POWER, "Neither ACPI nor PSTATE modes were initialized\n");
+		POWER_LOG(DEBUG, "Neither ACPI nor PSTATE modes were initialized");
 		return -ENOTSUP;
 	}
 
@@ -448,7 +448,7 @@  check_monitor(struct pmd_core_cfg *cfg, const union queue *qdata)
 
 	/* check if rte_power_monitor is supported */
 	if (!global_data.intrinsics_support.power_monitor) {
-		RTE_LOG(DEBUG, POWER, "Monitoring intrinsics are not supported\n");
+		POWER_LOG(DEBUG, "Monitoring intrinsics are not supported");
 		return -ENOTSUP;
 	}
 	/* check if multi-monitor is supported */
@@ -457,14 +457,14 @@  check_monitor(struct pmd_core_cfg *cfg, const union queue *qdata)
 
 	/* 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");
+		POWER_LOG(DEBUG, "Monitoring multiple queues is not supported");
 		return -ENOTSUP;
 	}
 
 	/* check if the device supports the necessary PMD API */
 	if (rte_eth_get_monitor_addr(qdata->portid, qdata->qid,
 			&dummy) == -ENOTSUP) {
-		RTE_LOG(DEBUG, POWER, "The device does not support rte_eth_get_monitor_addr\n");
+		POWER_LOG(DEBUG, "The device does not support rte_eth_get_monitor_addr");
 		return -ENOTSUP;
 	}
 
@@ -564,14 +564,14 @@  rte_power_ethdev_pmgmt_queue_enable(unsigned int lcore_id, uint16_t port_id,
 		clb = clb_pause;
 		break;
 	default:
-		RTE_LOG(DEBUG, POWER, "Invalid power management type\n");
+		POWER_LOG(DEBUG, "Invalid power management type");
 		ret = -EINVAL;
 		goto end;
 	}
 	/* add this queue to the list */
 	ret = queue_list_add(lcore_cfg, &qdata);
 	if (ret < 0) {
-		RTE_LOG(DEBUG, POWER, "Failed to add queue to list: %s\n",
+		POWER_LOG(DEBUG, "Failed to add queue to list: %s",
 				strerror(-ret));
 		goto end;
 	}
@@ -684,7 +684,8 @@  int
 rte_power_pmd_mgmt_set_pause_duration(unsigned int duration)
 {
 	if (duration == 0) {
-		RTE_LOG(ERR, POWER, "Pause duration must be greater than 0, value unchanged");
+		POWER_LOG(ERR,
+			  "Pause duration must be greater than 0, value unchanged");
 		return -EINVAL;
 	}
 	pause_duration = duration;
@@ -702,12 +703,13 @@  int
 rte_power_pmd_mgmt_set_scaling_freq_min(unsigned int lcore, unsigned int min)
 {
 	if (lcore >= RTE_MAX_LCORE) {
-		RTE_LOG(ERR, POWER, "Invalid lcore ID: %u\n", lcore);
+		POWER_LOG(ERR, "Invalid lcore ID: %u", lcore);
 		return -EINVAL;
 	}
 
 	if (min > scale_freq_max[lcore]) {
-		RTE_LOG(ERR, POWER, "Invalid min frequency: Cannot be greater than max frequency");
+		POWER_LOG(ERR,
+			  "Invalid min frequency: Cannot be greater than max frequency");
 		return -EINVAL;
 	}
 	scale_freq_min[lcore] = min;
@@ -719,7 +721,7 @@  int
 rte_power_pmd_mgmt_set_scaling_freq_max(unsigned int lcore, unsigned int max)
 {
 	if (lcore >= RTE_MAX_LCORE) {
-		RTE_LOG(ERR, POWER, "Invalid lcore ID: %u\n", lcore);
+		POWER_LOG(ERR, "Invalid lcore ID: %u", lcore);
 		return -EINVAL;
 	}
 
@@ -727,7 +729,8 @@  rte_power_pmd_mgmt_set_scaling_freq_max(unsigned int lcore, unsigned int max)
 	if (max == 0)
 		max = UINT32_MAX;
 	if (max < scale_freq_min[lcore]) {
-		RTE_LOG(ERR, POWER, "Invalid max frequency: Cannot be less than min frequency");
+		POWER_LOG(ERR,
+			  "Invalid max frequency: Cannot be less than min frequency");
 		return -EINVAL;
 	}
 
@@ -740,12 +743,12 @@  int
 rte_power_pmd_mgmt_get_scaling_freq_min(unsigned int lcore)
 {
 	if (lcore >= RTE_MAX_LCORE) {
-		RTE_LOG(ERR, POWER, "Invalid lcore ID: %u\n", lcore);
+		POWER_LOG(ERR, "Invalid lcore ID: %u", lcore);
 		return -EINVAL;
 	}
 
 	if (scale_freq_max[lcore] == 0)
-		RTE_LOG(DEBUG, POWER, "Scaling freq min config not set. Using sysfs min freq.\n");
+		POWER_LOG(DEBUG, "Scaling freq min config not set. Using sysfs min freq.");
 
 	return scale_freq_min[lcore];
 }
@@ -754,12 +757,12 @@  int
 rte_power_pmd_mgmt_get_scaling_freq_max(unsigned int lcore)
 {
 	if (lcore >= RTE_MAX_LCORE) {
-		RTE_LOG(ERR, POWER, "Invalid lcore ID: %u\n", lcore);
+		POWER_LOG(ERR, "Invalid lcore ID: %u", lcore);
 		return -EINVAL;
 	}
 
 	if (scale_freq_max[lcore] == UINT32_MAX) {
-		RTE_LOG(DEBUG, POWER, "Scaling freq max config not set. Using sysfs max freq.\n");
+		POWER_LOG(DEBUG, "Scaling freq max config not set. Using sysfs max freq.");
 		return 0;
 	}