Skip to contentSkip to conversation

kernel/workqueue.c: pr_warning/pr_warn & printk/pr_info

PATCH Applied Fabian Frederick 3 participants 5 messages May 12, 2014 Workqueue

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 kernel/workqueue.c: pr_warning/pr_warn & printk/pr_info

---
 kernel/workqueue.c | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)
kernel/workqueue.c +3 -3
index 0ee63af..6824afc 100644
@@ -4098,8 +4098,8 @@ static void wq_update_unbound_numa(struct workqueue_struct *wq, int cpu,
 	/* create a new pwq */
 	pwq = alloc_unbound_pwq(wq, target_attrs);
 	if (!pwq) {
-		pr_warning("workqueue: allocation failed while updating NUMA affinity of \"%s\"\n",
-			   wq->name);
+		pr_warn("workqueue: allocation failed while updating NUMA affinity of \"%s\"\n",
+			wq->name);
 		goto out_unlock;
 	}
 
@@ -4548,7 +4548,7 @@ void print_worker_info(const char *log_lvl, struct task_struct *task)
 		probe_kernel_read(desc, worker->desc, sizeof(desc) - 1);
 
 	if (fn || name[0] || desc[0]) {
-		printk("%sWorkqueue: %s %pf", log_lvl, name, fn);
+		pr_info("%sWorkqueue: %s %pf", log_lvl, name, fn);
 		if (desc[0])
 			pr_cont(" (%s)", desc);
 		pr_cont("\n");
Signature · 1 line
1.9.1
#2 lore raw
In reply to Fabian Frederick
Quoted 23 lines · Fabian Frederick
---
 kernel/workqueue.c | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)
kernel/workqueue.c +2 -2
index 0ee63af..6824afc 100644
@@ -4098,8 +4098,8 @@ static void wq_update_unbound_numa(struct workqueue_struct *wq, int cpu,
 	/* create a new pwq */
 	pwq = alloc_unbound_pwq(wq, target_attrs);
 	if (!pwq) {
-		pr_warning("workqueue: allocation failed while updating NUMA affinity of \"%s\"\n",
-			   wq->name);
+		pr_warn("workqueue: allocation failed while updating NUMA affinity of \"%s\"\n",
+			wq->name);
 		goto out_unlock;
 	}
 

kernel/workqueue.c void print_worker_info(const char *log_lvl, struct task_struct *task) · line 4551

Quoted 5 lines
kernel/workqueue.c +1 -1
@@ -4548,7 +4548,7 @@ void print_worker_info(const char *log_lvl, struct task_struct *task)
 		probe_kernel_read(desc, worker->desc, sizeof(desc) - 1);
 
 	if (fn || name[0] || desc[0]) {
-		printk("%sWorkqueue: %s %pf", log_lvl, name, fn);
+		pr_info("%sWorkqueue: %s %pf", log_lvl, name, fn);

Not correct.

log_lvl already emits the appropriate level
and this overrides it with KERN_INFO.

The output will now be incorrect emitting
at KERN_INFO followed by an SOH and the
desired log level.

kernel/workqueue.c void print_worker_info(const char *log_lvl, struct task_struct *task) · line 4554

Quoted 3 lines
kernel/workqueue.c +0 -0
 		if (desc[0])
 			pr_cont(" (%s)", desc);
 		pr_cont("\n");

Trivially, it likely would be a bit better to avoid any possible output message interleaving by using:

	if (fn || name[0] || desc[0]) {
		if (desc[0])
			printk("%sWorkqueue: %s %pf (%s)\n",
			       log_lvl, name, fn, desc);
		else
			printk("%sWorkqueue: %s %pf\n",
			       log_lvl, name, fn);
	}
#3 lore raw
Quoted 32 lines · On Mon, 12 May 2014 11:21:28 -0700 Joe Perches <[email protected]> wrote:
Quoted 23 lines · Fabian Frederick
---
 kernel/workqueue.c | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)
kernel/workqueue.c +2 -2
index 0ee63af..6824afc 100644
@@ -4098,8 +4098,8 @@ static void wq_update_unbound_numa(struct workqueue_struct *wq, int cpu,
 	/* create a new pwq */
 	pwq = alloc_unbound_pwq(wq, target_attrs);
 	if (!pwq) {
-		pr_warning("workqueue: allocation failed while updating NUMA affinity of \"%s\"\n",
-			   wq->name);
+		pr_warn("workqueue: allocation failed while updating NUMA affinity of \"%s\"\n",
+			wq->name);
 		goto out_unlock;
 	}
 

kernel/workqueue.c void print_worker_info(const char *log_lvl, struct task_struct *task) · line 4551

Quoted 5 lines
kernel/workqueue.c +1 -1
@@ -4548,7 +4548,7 @@ void print_worker_info(const char *log_lvl, struct task_struct *task)
 		probe_kernel_read(desc, worker->desc, sizeof(desc) - 1);
 
 	if (fn || name[0] || desc[0]) {
-		printk("%sWorkqueue: %s %pf", log_lvl, name, fn);
+		pr_info("%sWorkqueue: %s %pf", log_lvl, name, fn);

Not correct.

Quoted 6 lines

log_lvl already emits the appropriate level
and this overrides it with KERN_INFO.

The output will now be incorrect emitting
at KERN_INFO followed by an SOH and the
desired log level.

Such printk can't be converted to pr_ ?

Quoted 19 lines

kernel/workqueue.c void print_worker_info(const char *log_lvl, struct task_struct *task) · line 4554

Quoted 4 lines
kernel/workqueue.c +0 -0
 		if (desc[0])
 			pr_cont(" (%s)", desc);
 		pr_cont("\n");

Trivially, it likely would be a bit better to avoid any possible output message interleaving by using:

	if (fn || name[0] || desc[0]) {
		if (desc[0])
			printk("%sWorkqueue: %s %pf (%s)\n",
			       log_lvl, name, fn, desc);
		else
			printk("%sWorkqueue: %s %pf\n",
			       log_lvl, name, fn);
	}
Signature · 1 line
Fabian Frederick <[email protected]>
#4 lore raw
Quoted 2 lines · Fabian Frederick
Quoted 1 line · On Mon, 12 May 2014 11:21:28 -0700 Joe Perches <[email protected]> wrote:

On Mon, 2014-05-12 at 19:56 +0200, Fabian Frederick wrote:

[]

Quoted 1 line
Quoted 1 line

kernel/workqueue.c

Quoted 1 line
kernel/workqueue.c +0 -0

[]

Quoted 9 lines
Quoted 9 lines

kernel/workqueue.c void print_worker_info(const char *log_lvl, struct task_struct *task) · line 4551

Quoted 6 lines
kernel/workqueue.c +1 -1
@@ -4548,7 +4548,7 @@ void print_worker_info(const char *log_lvl, struct task_struct *task)
 		probe_kernel_read(desc, worker->desc, sizeof(desc) - 1);
 
 	if (fn || name[0] || desc[0]) {
-		printk("%sWorkqueue: %s %pf", log_lvl, name, fn);
+		pr_info("%sWorkqueue: %s %pf", log_lvl, name, fn);

Not correct.

Quoted 8 lines
Quoted 6 lines

log_lvl already emits the appropriate level
and this overrides it with KERN_INFO.

The output will now be incorrect emitting
at KERN_INFO followed by an SOH and the
desired log level.

Such printk can't be converted to pr_ ?

Correct.