Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > linux.kernel > #1626818

Re: irq/affinity: Fix extra vecs calculation

From Keith Busch <keith.busch@intel.com>
Newsgroups linux.kernel
Subject Re: irq/affinity: Fix extra vecs calculation
Date 2017-04-19 23:50 +0200
Message-ID <ty5E5-80-3@gated-at.bofh.it> (permalink)
References <tvQzv-66m-5@gated-at.bofh.it> <ty17t-5PA-55@gated-at.bofh.it> <ty17t-5PA-53@gated-at.bofh.it> <ty5E5-80-5@gated-at.bofh.it>
Organization linux.* mail to news gateway

Show all headers | View raw


On Wed, Apr 19, 2017 at 12:53:44PM -0700, Andrei Vagin wrote:
> On Wed, Apr 19, 2017 at 01:03:59PM -0400, Keith Busch wrote:
> > If it's a divide by 0 as your last link indicates, that must mean there
> > are possible nodes, but have no CPUs, and those should be skipped. If
> > that's the case, the following should fix it, but I'm going to do some
> > more qemu testing with various CPU topologies to confirm.
> 
> I printed variables from my test host, I think this can help to
> investigate the issue:
> 
> irq_create_affinity_masks:116: vecs_to_assign 0 ncpus 2 extra_vecs 2 vecs_per_node 0 affv 2 curvec 2 nodes 1

That explains a lot. This setup wants 2 "pre_vectors", but I didn't
know that was even a thing. This should fix it:

---
diff --git a/kernel/irq/affinity.c b/kernel/irq/affinity.c
index d052947..eb8b689 100644
--- a/kernel/irq/affinity.c
+++ b/kernel/irq/affinity.c
@@ -98,13 +98,16 @@ irq_create_affinity_masks(int nvecs, const struct irq_affinity *affd)
 		int ncpus, v, vecs_to_assign, vecs_per_node;
 
 		/* Spread the vectors per node */
-		vecs_per_node = (affv - curvec) / nodes;
+		vecs_per_node = (affv - (curvec - affd->pre_vectors)) / nodes;
 
 		/* Get the cpus on this node which are in the mask */
 		cpumask_and(nmsk, cpu_online_mask, cpumask_of_node(n));
--

Back to linux.kernel | Previous | NextPrevious in thread | Next in thread | Find similar | Unroll thread


Thread

[PATCH] irq/affinity: Fix extra vecs calculation Keith Busch <keith.busch@intel.com> - 2017-04-13 19:20 +0200
  [tip:irq/urgent] irq/affinity: Fix extra vecs calculation tip-bot for Keith Busch <tipbot@zytor.com> - 2017-04-13 23:50 +0200
  Re: irq/affinity: Fix extra vecs calculation Keith Busch <keith.busch@intel.com> - 2017-04-19 19:00 +0200
    Re: irq/affinity: Fix extra vecs calculation Keith Busch <keith.busch@intel.com> - 2017-04-19 23:50 +0200
      Re: irq/affinity: Fix extra vecs calculation Keith Busch <keith.busch@intel.com> - 2017-04-20 00:40 +0200

csiph-web