Re: [PATCH v3 2/2] x86: Fix /proc/cpuinfo cpumask warning

2022-11-03 Thread Borislav Petkov
On Thu, Nov 03, 2022 at 10:31:30AM -0700, Yury Norov wrote: > Let's take for example cpu_llc_shared_mask() added by you in > arch/x86/include/asm/smp.h recently: > > static inline struct cpumask *cpu_llc_shared_mask(int cpu) > { > return per_cpu(cpu_llc_shared_map, cpu); > } > > It

Re: [PATCH v3 2/2] x86: Fix /proc/cpuinfo cpumask warning

2022-11-03 Thread Yury Norov
On Thu, Nov 03, 2022 at 05:49:06PM +0100, Borislav Petkov wrote: > On Thu, Nov 03, 2022 at 09:30:54AM -0700, yury.no...@gmail.com wrote:a > > Callers should pass sane arguments into internal functions if they > > expect sane output. > > What internal function? It's in a global header. > > > The A

Re: [PATCH v3 2/2] x86: Fix /proc/cpuinfo cpumask warning

2022-11-03 Thread Borislav Petkov
On Thu, Nov 03, 2022 at 09:30:54AM -0700, yury.no...@gmail.com wrote:a > Callers should pass sane arguments into internal functions if they > expect sane output. What internal function? It's in a global header. > The API not exported to userspace shouldn't sanity-check all inputs > arguments. Th

Re: [PATCH v3 2/2] x86: Fix /proc/cpuinfo cpumask warning

2022-11-03 Thread yury . norov
On Thu, Nov 03, 2022 at 04:34:04PM +0100, Andrew Jones wrote: > On Thu, Nov 03, 2022 at 04:02:12PM +0100, Borislav Petkov wrote: > > On Thu, Nov 03, 2022 at 01:59:45PM +0100, Andrew Jones wrote: > > > The patch I'm proposing ensures cpumask_next()'s range, which is actually > > > [-1, nr_cpus_ids -

Re: [PATCH v3 2/2] x86: Fix /proc/cpuinfo cpumask warning

2022-11-03 Thread Borislav Petkov
On Thu, Nov 03, 2022 at 04:34:04PM +0100, Andrew Jones wrote: > Indeed, but that's less of an issue with cpumask_next() than with > the way cpuinfo implements its start and next seq ops (next > unconditionally increments *pos and then calls start and start > must use *pos - 1 since the first time i

Re: [PATCH v3 2/2] x86: Fix /proc/cpuinfo cpumask warning

2022-11-03 Thread Andrew Jones
On Thu, Nov 03, 2022 at 04:02:12PM +0100, Borislav Petkov wrote: > On Thu, Nov 03, 2022 at 01:59:45PM +0100, Andrew Jones wrote: > > The patch I'm proposing ensures cpumask_next()'s range, which is actually > > [-1, nr_cpus_ids - 1), > > Lemme make sure I understand it correctly: on the upper boun

Re: [PATCH v3 2/2] x86: Fix /proc/cpuinfo cpumask warning

2022-11-03 Thread Borislav Petkov
On Thu, Nov 03, 2022 at 01:59:45PM +0100, Andrew Jones wrote: > The patch I'm proposing ensures cpumask_next()'s range, which is actually > [-1, nr_cpus_ids - 1), Lemme make sure I understand it correctly: on the upper boundary, if you supply for n the value nr_cpu_ids - 2, then it will return pot

Re: [PATCH v3 2/2] x86: Fix /proc/cpuinfo cpumask warning

2022-11-03 Thread Andrew Jones
On Wed, Nov 02, 2022 at 07:44:02PM +0100, Borislav Petkov wrote: > On Mon, Oct 31, 2022 at 11:03:27AM +0100, Andrew Jones wrote: > > Currently (after the revert of 78e5a3399421) > > After the revert? > > That commit is still in the latest Linus tree. The revert commit is 80493877d7d0 ("Revert "c

Re: [PATCH v3 2/2] x86: Fix /proc/cpuinfo cpumask warning

2022-11-02 Thread Borislav Petkov
On Mon, Oct 31, 2022 at 11:03:27AM +0100, Andrew Jones wrote: > Currently (after the revert of 78e5a3399421) After the revert? That commit is still in the latest Linus tree. > with DEBUG_PER_CPU_MAPS we'll get a warning splat when the cpu is > outside the range [-1, nr_cpu_ids) Yah, that range

Re: [PATCH v3 2/2] x86: Fix /proc/cpuinfo cpumask warning

2022-10-31 Thread Andrew Jones
On Mon, Oct 31, 2022 at 09:58:57AM +0100, Borislav Petkov wrote: > On Mon, Oct 31, 2022 at 09:06:04AM +0100, Andrew Jones wrote: > > The valid cpumask range is [0, nr_cpu_ids) and cpumask_next() always > > returns a CPU ID greater than its input, which results in its input > > range being [-1, n

Re: [PATCH v3 2/2] x86: Fix /proc/cpuinfo cpumask warning

2022-10-31 Thread Borislav Petkov
On Mon, Oct 31, 2022 at 09:06:04AM +0100, Andrew Jones wrote: > The valid cpumask range is [0, nr_cpu_ids) and cpumask_next() always > returns a CPU ID greater than its input, which results in its input > range being [-1, nr_cpu_ids - 1). Ensure showing CPU info avoids > triggering error condit

Re: [PATCH v3 2/2] x86: Fix /proc/cpuinfo cpumask warning

2022-10-31 Thread Andrew Jones
On Fri, Oct 28, 2022 at 06:06:41PM +0200, Borislav Petkov wrote: > On Fri, Oct 28, 2022 at 10:13:28AM -0500, Yury Norov wrote: > > Because it's related to bitmap API usage and has been revealed after > > some work in bitmaps. > > So first of all, that "fix" needs to explain what exactly it is fixi

Re: [PATCH v3 2/2] x86: Fix /proc/cpuinfo cpumask warning

2022-10-29 Thread Yury Norov
On Fri, Oct 28, 2022, 10:03 AM Borislav Petkov wrote: > On Fri, Oct 28, 2022 at 07:46:08AM -0700, Yury Norov wrote: > > I'll take it in bitmap-for-next this weekend. > > Why? Because it's related to bitmap API usage and has been revealed after some work in bitmaps. And because nobody else care

Re: [PATCH v3 2/2] x86: Fix /proc/cpuinfo cpumask warning

2022-10-28 Thread Borislav Petkov
On Fri, Oct 28, 2022 at 10:13:28AM -0500, Yury Norov wrote: > Because it's related to bitmap API usage and has been revealed after > some work in bitmaps. So first of all, that "fix" needs to explain what exactly it is fixing. Not "it fixes this and that warning" but why the input arg to cpumask_n

Re: [PATCH v3 2/2] x86: Fix /proc/cpuinfo cpumask warning

2022-10-28 Thread Borislav Petkov
On Fri, Oct 28, 2022 at 07:46:08AM -0700, Yury Norov wrote: > I'll take it in bitmap-for-next this weekend. Why? -- Regards/Gruss, Boris. https://people.kernel.org/tglx/notes-about-netiquette

Re: [PATCH v3 2/2] x86: Fix /proc/cpuinfo cpumask warning

2022-10-28 Thread Yury Norov
On Fri, Oct 28, 2022 at 09:48:28AM +0200, Andrew Jones wrote: > Hi x86 maintainers, > > I realize 78e5a3399421 has now been reverted, so this fix is no longer > urgent. I don't believe it's wrong, though, so if it's still of interest, > then please consider this a friendly ping. > > Thanks, > dre

Re: [PATCH v3 2/2] x86: Fix /proc/cpuinfo cpumask warning

2022-10-28 Thread Andrew Jones
On Fri, Oct 14, 2022 at 05:58:45PM +0200, Andrew Jones wrote: > Commit 78e5a3399421 ("cpumask: fix checking valid cpu range") has > started issuing warnings[*] when cpu indices equal to nr_cpu_ids - 1 > are passed to cpumask_next* functions. seq_read_iter() and cpuinfo's > start and next seq operat

[PATCH v3 2/2] x86: Fix /proc/cpuinfo cpumask warning

2022-10-14 Thread Andrew Jones
Commit 78e5a3399421 ("cpumask: fix checking valid cpu range") has started issuing warnings[*] when cpu indices equal to nr_cpu_ids - 1 are passed to cpumask_next* functions. seq_read_iter() and cpuinfo's start and next seq operations implement a pattern like n = cpumask_next(n - 1, mask); show