lists.openwall.net | lists / announce owl-users owl-dev john-users john-dev passwdqc-users yescrypt popa3d-users / oss-security kernel-hardening musl sabotage tlsify passwords / crypt-dev xvendor / Bugtraq Full-Disclosure linux-kernel linux-netdev linux-ext4 linux-hardening linux-cve-announce PHC | |
Open Source and information security mailing list archives
| ||
|
Date: Wed, 1 Jan 2014 16:34:30 +0000 From: Ben Hutchings <bhutchings@...arflare.com> To: Amir Vadai <amirv@...lanox.com> CC: "David S. Miller" <davem@...emloft.net>, <netdev@...r.kernel.org>, "Or Gerlitz" <ogerlitz@...lanox.com>, Yuval Atias <yuvala@...lanox.com> Subject: Re: [PATCH net-next 1/2] net/mlx4_en: Use affinity hint On Wed, 2014-01-01 at 15:05 +0200, Amir Vadai wrote: > From: Yuval Atias <yuvala@...lanox.com> > > The “affinity hint” mechanism is used by the user space > daemon, irqbalancer, to indicate a preferred CPU mask for irqs. > Irqbalancer can use this hint to balance the irqs between the > cpus indicated by the mask. > > We wish the HCA to preferentially map the IRQs it uses to numa cores > close to it. > To accomplish this, we use affinity hint: first we map IRQs to “close” > numa cores. > If these are exhausted, the remaining IRQs are mapped to “far” numa > cores. > > Signed-off-by: Yuval Atias <yuvala@...lanox.com> [...] > --- a/drivers/net/ethernet/mellanox/mlx4/en_netdev.c > +++ b/drivers/net/ethernet/mellanox/mlx4/en_netdev.c > @@ -1532,6 +1532,45 @@ static void mlx4_en_linkstate(struct work_struct *work) > mutex_unlock(&mdev->state_lock); > } > > +static int mlx4_en_rings_affinity_hint(struct mlx4_en_priv *priv , > + int *affinity_hint_mapping) > +{ > + int cpu; > + int cores_arr_index = 0; > + cpumask_t *numa_cores_mask; > + cpumask_t *non_numa_cores_mask; The types of these masks must be cpumask_var_t. > + if (!zalloc_cpumask_var(&non_numa_cores_mask, GFP_KERNEL)) { > + en_err(priv, "Failed allocating cores mask\n"); > + return -EINVAL; > + } > + numa_cores_mask = (cpumask_t *)cpumask_of_node( > + priv->mdev->dev->numa_node); > + if (!cpumask_and(numa_cores_mask, cpu_online_mask, numa_cores_mask)) > + en_warn(priv, "Failed to find online cores for local numa\n"); This changes the CPU mask of your device's NUMA node. Don't do that. You need to copy it to numa_cores_mask and then start changing it. [...] > @@ -1557,6 +1596,9 @@ int mlx4_en_start_port(struct net_device *dev) > memset(&priv->ethtool_rules[0], 0, > sizeof(struct ethtool_flow_id) * MAX_NUM_OF_FS_RULES); > > + affinity_hint_mapping = kzalloc(num_online_cpus() * sizeof(int), > + GFP_KERNEL); [...] What makes you think that the online CPU IDs are all contiguous starting at 0? The correct array size is nr_cpu_ids, if I remember correctly. Ben. -- Ben Hutchings, Staff Engineer, Solarflare Not speaking for my employer; that's the marketing department's job. They asked us to note that Solarflare product names are trademarked. -- To unsubscribe from this list: send the line "unsubscribe netdev" in the body of a message to majordomo@...r.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html
Powered by blists - more mailing lists