Re: [PATCH RESEND 4/5] x86/MCE: Make number of MCA banks per_cpu

2019-04-09 Thread Borislav Petkov
On Mon, Apr 08, 2019 at 10:48:34PM +, Ghannam, Yazen wrote:
> Okay, so drop the export and leave the injector code as-is (it's
> already doing a rdmsrl_on_cpu()).

Yes of course. The number of MCA banks is none of modules' business and
should not be exported at all.

Thx.

-- 
Regards/Gruss,
Boris.

Good mailing practices for 400: avoid top-posting and trim the reply.


RE: [PATCH RESEND 4/5] x86/MCE: Make number of MCA banks per_cpu

2019-04-08 Thread Ghannam, Yazen
> -Original Message-
> From: linux-edac-ow...@vger.kernel.org  On 
> Behalf Of Luck, Tony
> Sent: Monday, April 8, 2019 6:23 PM
> To: Ghannam, Yazen 
> Cc: Borislav Petkov ; linux-e...@vger.kernel.org; 
> linux-kernel@vger.kernel.org; x...@kernel.org
> Subject: Re: [PATCH RESEND 4/5] x86/MCE: Make number of MCA banks per_cpu
> 
> On Mon, Apr 08, 2019 at 10:48:34PM +, Ghannam, Yazen wrote:
> > Okay, so drop the export and leave the injector code as-is (it's
> > already doing a rdmsrl_on_cpu()).
> 
> It's still a globally visible symbol (shared by core.c and amd.c).
> So I think it needs a "mce_" prefix.
> 
> While it doesn't collide now, there are a bunch of other
> subsystems that have "banks" and a variable to count them.
> 
> Look at output from "git grep -w num_banks".
> 

Okay, I'll add the prefix.

And thanks for the tip. I'll try to keep this in mind.

Thanks,
Yazen 


Re: [PATCH RESEND 4/5] x86/MCE: Make number of MCA banks per_cpu

2019-04-08 Thread Luck, Tony
On Mon, Apr 08, 2019 at 10:48:34PM +, Ghannam, Yazen wrote:
> Okay, so drop the export and leave the injector code as-is (it's
> already doing a rdmsrl_on_cpu()).

It's still a globally visible symbol (shared by core.c and amd.c).
So I think it needs a "mce_" prefix.

While it doesn't collide now, there are a bunch of other
subsystems that have "banks" and a variable to count them.

Look at output from "git grep -w num_banks".

-Tony


RE: [PATCH RESEND 4/5] x86/MCE: Make number of MCA banks per_cpu

2019-04-08 Thread Ghannam, Yazen
> -Original Message-
> From: linux-edac-ow...@vger.kernel.org  On 
> Behalf Of Borislav Petkov
> Sent: Monday, April 8, 2019 3:50 PM
> To: Luck, Tony 
> Cc: Ghannam, Yazen ; linux-e...@vger.kernel.org; 
> linux-kernel@vger.kernel.org; x...@kernel.org
> Subject: Re: [PATCH RESEND 4/5] x86/MCE: Make number of MCA banks per_cpu
> 
> On Mon, Apr 08, 2019 at 08:42:36PM +, Luck, Tony wrote:
> > > Actually, it should not be exported at all. A function returning the num
> > > banks is better instead.
> >
> > Are all the places it is used in non-pre-emptible sections of code? Looping
> > in the CMCI and #MC handlers should be fine. But do we need 
> > get_cpu()/put_cpu()
> > in any places?
> 
> That export is needed only in the mce injector. Actually, it would be
> much cleaner if the injector would find out the count straight from the
> MSR as it does now, but be changed to do rdmsr_on_cpu() now, since can
> have different num_banks on a CPU.
> 

Okay, so drop the export and leave the injector code as-is (it's already doing 
a rdmsrl_on_cpu()).

Is that okay?

Thanks,
Yazen


Re: [PATCH RESEND 4/5] x86/MCE: Make number of MCA banks per_cpu

2019-04-08 Thread Borislav Petkov
On Mon, Apr 08, 2019 at 08:42:36PM +, Luck, Tony wrote:
> > Actually, it should not be exported at all. A function returning the num
> > banks is better instead.
> 
> Are all the places it is used in non-pre-emptible sections of code? Looping
> in the CMCI and #MC handlers should be fine. But do we need 
> get_cpu()/put_cpu()
> in any places?

That export is needed only in the mce injector. Actually, it would be
much cleaner if the injector would find out the count straight from the
MSR as it does now, but be changed to do rdmsr_on_cpu() now, since can
have different num_banks on a CPU.

-- 
Regards/Gruss,
Boris.

Good mailing practices for 400: avoid top-posting and trim the reply.


RE: [PATCH RESEND 4/5] x86/MCE: Make number of MCA banks per_cpu

2019-04-08 Thread Luck, Tony
> Actually, it should not be exported at all. A function returning the num
> banks is better instead.

Are all the places it is used in non-pre-emptible sections of code? Looping
in the CMCI and #MC handlers should be fine. But do we need get_cpu()/put_cpu()
in any places?

-Tony


Re: [PATCH RESEND 4/5] x86/MCE: Make number of MCA banks per_cpu

2019-04-08 Thread Borislav Petkov
On Mon, Apr 08, 2019 at 01:26:59PM -0700, Luck, Tony wrote:
> On Mon, Apr 08, 2019 at 02:12:17PM +, Ghannam, Yazen wrote:
> > +DEFINE_PER_CPU_READ_MOSTLY(u8, num_banks);
> > +EXPORT_PER_CPU_SYMBOL_GPL(num_banks);
> 
> The name "num_banks" is a bit generic for an exported symbol.
> I think it should have a "mce_" prefix.

Actually, it should not be exported at all. A function returning the num
banks is better instead.

-- 
Regards/Gruss,
Boris.

Good mailing practices for 400: avoid top-posting and trim the reply.


Re: [PATCH RESEND 4/5] x86/MCE: Make number of MCA banks per_cpu

2019-04-08 Thread Luck, Tony
On Mon, Apr 08, 2019 at 02:12:17PM +, Ghannam, Yazen wrote:
> +DEFINE_PER_CPU_READ_MOSTLY(u8, num_banks);
> +EXPORT_PER_CPU_SYMBOL_GPL(num_banks);

The name "num_banks" is a bit generic for an exported symbol.
I think it should have a "mce_" prefix.

-Tony