svn commit: r323879 - head/sys/kern
Stephen Hurd
shurd at FreeBSD.org
Thu Sep 21 21:14:49 UTC 2017
Author: shurd
Date: Thu Sep 21 21:14:48 2017
New Revision: 323879
URL: https://svnweb.freebsd.org/changeset/base/323879
Log:
Improved logging of gtaskqueue failues
Check the return code of intr_setaffinity() and log any errors
it returns. When a qid is not located, log an error before returning
failure. Also, use __func__ rather than hardcoding the function name
Reviewed by: sbruno
Approved by: sbruno (mentor)
Sponsored by: Limelight Networks
Differential Revision: https://reviews.freebsd.org/D12436
Modified:
head/sys/kern/subr_gtaskqueue.c
Modified: head/sys/kern/subr_gtaskqueue.c
==============================================================================
--- head/sys/kern/subr_gtaskqueue.c Thu Sep 21 21:07:21 2017 (r323878)
+++ head/sys/kern/subr_gtaskqueue.c Thu Sep 21 21:14:48 2017 (r323879)
@@ -663,7 +663,7 @@ taskqgroup_attach(struct taskqgroup *qgroup, struct gr
void *uniq, int irq, char *name)
{
cpuset_t mask;
- int qid;
+ int qid, error;
gtask->gt_uniq = uniq;
gtask->gt_name = name;
@@ -679,7 +679,9 @@ taskqgroup_attach(struct taskqgroup *qgroup, struct gr
CPU_ZERO(&mask);
CPU_SET(qgroup->tqg_queue[qid].tgc_cpu, &mask);
mtx_unlock(&qgroup->tqg_lock);
- intr_setaffinity(irq, CPU_WHICH_IRQ, &mask);
+ error = intr_setaffinity(irq, CPU_WHICH_IRQ, &mask);
+ if (error)
+ printf("%s: setaffinity failed: %d\n", __func__, error);
} else
mtx_unlock(&qgroup->tqg_lock);
}
@@ -688,7 +690,7 @@ static void
taskqgroup_attach_deferred(struct taskqgroup *qgroup, struct grouptask *gtask)
{
cpuset_t mask;
- int qid, cpu;
+ int qid, cpu, error;
mtx_lock(&qgroup->tqg_lock);
qid = taskqgroup_find(qgroup, gtask->gt_uniq);
@@ -698,9 +700,11 @@ taskqgroup_attach_deferred(struct taskqgroup *qgroup,
CPU_ZERO(&mask);
CPU_SET(cpu, &mask);
- intr_setaffinity(gtask->gt_irq, CPU_WHICH_IRQ, &mask);
-
+ error = intr_setaffinity(gtask->gt_irq, CPU_WHICH_IRQ, &mask);
mtx_lock(&qgroup->tqg_lock);
+ if (error)
+ printf("%s: setaffinity failed: %d\n", __func__, error);
+
}
qgroup->tqg_queue[qid].tgc_cnt++;
@@ -716,7 +720,7 @@ taskqgroup_attach_cpu(struct taskqgroup *qgroup, struc
void *uniq, int cpu, int irq, char *name)
{
cpuset_t mask;
- int i, qid;
+ int i, qid, error;
qid = -1;
gtask->gt_uniq = uniq;
@@ -732,6 +736,7 @@ taskqgroup_attach_cpu(struct taskqgroup *qgroup, struc
}
if (qid == -1) {
mtx_unlock(&qgroup->tqg_lock);
+ printf("%s: qid not found for %s cpu=%d\n", __func__, name, cpu);
return (EINVAL);
}
} else
@@ -744,8 +749,11 @@ taskqgroup_attach_cpu(struct taskqgroup *qgroup, struc
CPU_ZERO(&mask);
CPU_SET(cpu, &mask);
- if (irq != -1 && tqg_smp_started)
- intr_setaffinity(irq, CPU_WHICH_IRQ, &mask);
+ if (irq != -1 && tqg_smp_started) {
+ error = intr_setaffinity(irq, CPU_WHICH_IRQ, &mask);
+ if (error)
+ printf("%s: setaffinity failed: %d\n", __func__, error);
+ }
return (0);
}
@@ -753,7 +761,7 @@ static int
taskqgroup_attach_cpu_deferred(struct taskqgroup *qgroup, struct grouptask *gtask)
{
cpuset_t mask;
- int i, qid, irq, cpu;
+ int i, qid, irq, cpu, error;
qid = -1;
irq = gtask->gt_irq;
@@ -767,6 +775,7 @@ taskqgroup_attach_cpu_deferred(struct taskqgroup *qgro
}
if (qid == -1) {
mtx_unlock(&qgroup->tqg_lock);
+ printf("%s: qid not found for %s cpu=%d\n", __func__, name, cpu);
return (EINVAL);
}
qgroup->tqg_queue[qid].tgc_cnt++;
@@ -778,8 +787,11 @@ taskqgroup_attach_cpu_deferred(struct taskqgroup *qgro
CPU_ZERO(&mask);
CPU_SET(cpu, &mask);
- if (irq != -1)
- intr_setaffinity(irq, CPU_WHICH_IRQ, &mask);
+ if (irq != -1) {
+ error = intr_setaffinity(irq, CPU_WHICH_IRQ, &mask);
+ if (error)
+ printf("%s: setaffinity failed: %d\n", __func__, error);
+ }
return (0);
}
@@ -815,7 +827,7 @@ taskqgroup_binder(void *ctx)
thread_unlock(curthread);
if (error)
- printf("taskqgroup_binder: setaffinity failed: %d\n",
+ printf("%s: setaffinity failed: %d\n", __func__,
error);
free(gtask, M_DEVBUF);
}
@@ -858,7 +870,7 @@ _taskqgroup_adjust(struct taskqgroup *qgroup, int cnt,
return (EINVAL);
}
if (qgroup->tqg_adjusting) {
- printf("taskqgroup_adjust failed: adjusting\n");
+ printf("%s failed: adjusting\n", __func__);
return (EBUSY);
}
qgroup->tqg_adjusting = 1;
More information about the svn-src-all
mailing list