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:   Sun, 12 Nov 2017 14:36:11 +0100 (CET)
From:   Thomas Gleixner <tglx@...utronix.de>
To:     Andi Kleen <ak@...ux.intel.com>
cc:     Prarit Bhargava <prarit@...hat.com>, linux-kernel@...r.kernel.org,
        Ingo Molnar <mingo@...hat.com>,
        "H. Peter Anvin" <hpa@...or.com>, x86@...nel.org,
        Peter Zijlstra <peterz@...radead.org>,
        Dave Hansen <dave.hansen@...el.com>,
        Piotr Luc <piotr.luc@...el.com>,
        Kan Liang <kan.liang@...el.com>, Borislav Petkov <bp@...e.de>,
        Stephane Eranian <eranian@...gle.com>,
        Arvind Yadav <arvind.yadav.cs@...il.com>,
        Andy Lutomirski <luto@...nel.org>,
        Christian Borntraeger <borntraeger@...ibm.com>,
        "Kirill A. Shutemov" <kirill.shutemov@...ux.intel.com>,
        Tom Lendacky <thomas.lendacky@....com>,
        He Chen <he.chen@...ux.intel.com>,
        Mathias Krause <minipli@...glemail.com>,
        Tim Chen <tim.c.chen@...ux.intel.com>,
        Vitaly Kuznetsov <vkuznets@...hat.com>
Subject: Re: [PATCH v5 2/3] x86/topology: Avoid wasting 128k for package id
 array

On Fri, 10 Nov 2017, Andi Kleen wrote:
> > > All of that works. There is no way to make sure that a lookup is fully
> > > serialized against a concurrent update. Even if the lookup holds
> > > cpu_read_lock() the new package might arrive right after the unlock.
> > > 
> > 
> > Thanks Thomas.
> > 
> > Andi, do you want to take a look at this?
> 
> I was originally worried about races, that is why i tried to put 
> everything into cpu_data. But that didn't work out because something
> clears it. Perhaps the right solution would be some extra per_cpu
> data variables, and search for the first match. I suspect that would
> be simpler. But if that doesn't work I guess something like Thomas'
> example will work.

Sure, we can use a separate per cpu variable. The race for looking up phys
-> logical will always be there if that handles stuff like the uncore PCI
physid one. There is not much which can prevent that.

The other option is to figure out what clears cpu_data on online and just
preserve the logical/physcial translation across that clear. 

One thing you need to be careful about (in both cases) is the value. The
data is zeroed on boot, so we either need to fill that with UINT_MAX at
boot time in one of the functions which does a for_each_possible_cpu() loop
anyway or just leave 0 as the 'not initialized' value and make the first
logical package be '1'. The readout functions (percpu, translation,
etc.) just can subtract 1.

Thanks,

	tglx

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ