From 0fad1762fe0fce0ae920efac6c191d058267453d Mon Sep 17 00:00:00 2001 From: Rajeev Kumar Date: Mon, 12 Sep 2016 14:49:54 -0700 Subject: qcacld-3.0: Do not log current->comm from hw/sw irq context Interrupt handlers do not have valid process context and hence current pointer is not valid for software/hardware interrupt handlers. In WLAN log to user space API current process name is logged using current->comm but hardware/software interrupts do not have corresponding current pointer because they use current pointer of interrupted process. Make changes to not to log process name when log message is generated from hardware/software interrupt handlers. Change-Id: I42420c501f9e7161112c5210909f83755ba4813e CRs-Fixed: 1065898 --- core/utils/logging/src/wlan_logging_sock_svc.c | 17 ++++++++++++++--- 1 file changed, 14 insertions(+), 3 deletions(-) (limited to 'core/utils') diff --git a/core/utils/logging/src/wlan_logging_sock_svc.c b/core/utils/logging/src/wlan_logging_sock_svc.c index 8afe7b5b1129..61cded5a3e5f 100644 --- a/core/utils/logging/src/wlan_logging_sock_svc.c +++ b/core/utils/logging/src/wlan_logging_sock_svc.c @@ -258,14 +258,19 @@ static int wlan_queue_logmsg_for_app(void) * * For discrete solution e.g rome use system tick and convert it into * seconds.milli seconds + * + * Return: number of characters written in target buffer not including + * trailing '/0' */ static int wlan_add_user_log_radio_time_stamp(char *tbuf, size_t tbuf_sz, uint64_t ts, int radio) { int tlen; - tlen = scnprintf(tbuf, tbuf_sz, "R%d: [%s][%llu] ", - radio, current->comm, ts); + tlen = scnprintf(tbuf, tbuf_sz, "R%d: [%s][%llu] ", radio, + ((in_irq() ? "irq" : in_softirq() ? "soft_irq" : + current->comm)), + ts); return tlen; } #else @@ -281,6 +286,9 @@ static int wlan_add_user_log_radio_time_stamp(char *tbuf, size_t tbuf_sz, * * For discrete solution e.g rome use system tick and convert it into * seconds.milli seconds + * + * Return: number of characters written in target buffer not including + * trailing '/0' */ static int wlan_add_user_log_radio_time_stamp(char *tbuf, size_t tbuf_sz, uint64_t ts, int radio) @@ -290,7 +298,10 @@ static int wlan_add_user_log_radio_time_stamp(char *tbuf, size_t tbuf_sz, rem = do_div(ts, QDF_MC_TIMER_TO_SEC_UNIT); tlen = scnprintf(tbuf, tbuf_sz, "R%d: [%s][%lu.%06lu] ", radio, - current->comm, (unsigned long) ts, (unsigned long)rem); + ((in_irq() ? "irq" : in_softirq() ? "soft_irq" : + current->comm)), + (unsigned long) ts, + (unsigned long)rem); return tlen; } #endif -- cgit v1.2.3