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
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <49FE9583.8040009@cosmosbay.com>
Date:	Mon, 04 May 2009 09:13:07 +0200
From:	Eric Dumazet <dada1@...mosbay.com>
To:	Tom Herbert <therbert@...gle.com>
CC:	netdev@...r.kernel.org, David Miller <davem@...emloft.net>
Subject: Re: [PATCH v2] Receive Packet Steering

Eric Dumazet a écrit :
> Tom Herbert a écrit :

>> +static ssize_t store_rps_cpus(struct device *dev,
>> +			      struct device_attribute *attr,
>> +			      const char *buf, size_t len)
>> +{
>> +	struct net_device *net = to_net_dev(dev);
>> +	cpumask_t mask;
>> +	int err, cpu;
>> +	int i = 0;
>> +
>> +	if (!capable(CAP_NET_ADMIN))
>> +		return -EPERM;
>> +
>> +	err = bitmap_parse(buf, len, cpumask_bits(&mask), nr_cpumask_bits);
>> +	if (err)
>> +		return err;
>> +
>> +	rtnl_lock();
>> +	if (dev_isalive(net)) {
>> +		if (!net->rps_map) {
>> +			net->rps_map = kzalloc(sizeof(u16) *
>> +			    num_possible_cpus(), GFP_KERNEL);
> 
> num_possible_cpus() is not the max index of a cpu, but the number of possible cpus.
> it can be for example 2, but cpu0 being index 0, and second cpu at index 511
> 
> So I believe you want nr_cpu_ids here
> 
> (num_possible_cpus() <= nr_cpu_ids), not necessarly equal. 
> 
> 
>> +			if (!net->rps_map)
>> +				return -ENOMEM;
>> +		}
>> +		cpus_and(mask, mask, cpu_online_map);
>> +		for_each_cpu_mask(cpu, mask)
>> +			net->rps_map[i++] =  cpu;
>> +		net->rps_map_len = i;
>> +	}
>> +	rtnl_unlock();
>> +
>> +	return len;

I misread patch and my previous remark was wrong, as you put in rps_map
all possible cpu indexes, there is no hole in the array, so its size
is num_possible_cpus() indeed, sorry for the false alarm.

Now I wonder how this can handle cpu hotplug, I see nothing in your patch to transfert
packets ownership or  rps_map[] rebuilding in case a cpu is offlined...

--
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

Powered by Openwall GNU/*/Linux Powered by OpenVZ