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]
Date:	Thu, 2 Feb 2012 13:00:21 -0800
From:	Venki Pallipadi <venki@...gle.com>
To:	Andrew Morton <akpm@...ux-foundation.org>
Cc:	Rusty Russell <rusty@...tcorp.com.au>,
	KOSAKI Motohiro <kosaki.motohiro@...il.com>,
	KOSAKI Motohiro <kosaki.motohiro@...fujitsu.com>,
	Mike Travis <travis@....com>,
	"Srivatsa S. Bhat" <srivatsa.bhat@...ux.vnet.ibm.com>,
	"Paul E. McKenney" <paul.mckenney@...aro.org>,
	"Rafael J. Wysocki" <rjw@...k.pl>,
	Paul Gortmaker <paul.gortmaker@...driver.com>,
	linux-kernel@...r.kernel.org
Subject: Re: [PATCH] Avoid mask based num_possible_cpus and num_online_cpus -v5

On Thu, Feb 2, 2012 at 12:19 PM, Andrew Morton
<akpm@...ux-foundation.org> wrote:
> On Fri, 03 Feb 2012 06:33:02 +1030
> Rusty Russell <rusty@...tcorp.com.au> wrote:
>
>> On Wed, 1 Feb 2012 14:01:25 -0800, Andrew Morton <akpm@...ux-foundation.org> wrote:
>> > > Though most of the callers of these two routines are init time (with few
>> > > exceptions of runtime calls), it is cleaner to use variables
>> > > and not go through this repeated mask based calculation.
>> >
>> > Looks good to me.
>>
>> But, I wonder who's asking num_possible_cpus().  It's not a very useful
>> thing to know, though some arch's "know" it's contiguous, so can cheat.
>>
>> Optimizing it seems particularly foolish.
>
> We're fools for optimisations!
>

I would think that if we are giving an API people will abuse it sooner
or later :-).

>> We either audit and wean
>> everyone off who's using it incorrectly, or insist on contiguous CPU
>> numbers and drop the mask altogether.
>
> drivers/block/nvme.c looks like it's assuming a contiguous map.  Maybe
> also drivers/scsi/bnx2fc (wtf?).  I didn't see anything else outside
> arch code.
>

Yes. I found a bunch of them which seemed obviously wrong.  Doing
things like allocating space based on num_possible_cpus() and
accessing the space with get_cpu() or doing cou_online() check etc.

arch/x86/kernel/apic/x2apic_uv_x.c
arch/x86/kernel/cpu/mcheck/mce-inject.c
arch/x86/platform/uv/tlb_uv.c
drivers/scsi/bnx2fc/bnx2fc_io.c
kernel/debug/kdb/kdb_bt.c

I have a patch to fix these obvious ones. But, there are other users
which were not very obvious to me and also I am know of code in older
kernels (code which since have been rewritten) which can get benefit
of this API change.

Thanks,
Venki
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ