From owner-svn-src-head@freebsd.org Thu Sep 21 21:14:49 2017 Return-Path: Delivered-To: svn-src-head@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 65E4EE2304C; Thu, 21 Sep 2017 21:14:49 +0000 (UTC) (envelope-from shurd@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 3EE776B4CC; Thu, 21 Sep 2017 21:14:49 +0000 (UTC) (envelope-from shurd@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id v8LLEmrp050087; Thu, 21 Sep 2017 21:14:48 GMT (envelope-from shurd@FreeBSD.org) Received: (from shurd@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id v8LLEmep050086; Thu, 21 Sep 2017 21:14:48 GMT (envelope-from shurd@FreeBSD.org) Message-Id: <201709212114.v8LLEmep050086@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: shurd set sender to shurd@FreeBSD.org using -f From: Stephen Hurd Date: Thu, 21 Sep 2017 21:14:48 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r323879 - head/sys/kern X-SVN-Group: head X-SVN-Commit-Author: shurd X-SVN-Commit-Paths: head/sys/kern X-SVN-Commit-Revision: 323879 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 21 Sep 2017 21:14:49 -0000 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;