linux-pci.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
  • * Re: [patch 00/22] x86/treewide: Consolidate CPU match macro maze and get rid of C89 (sic!) initializers
           [not found] <20200320131345.635023594@linutronix.de>
           [not found] ` <20200320131508.826011988@linutronix.de>
    @ 2020-03-20 14:31 ` Andy Shevchenko
           [not found] ` <20200320131508.736205164@linutronix.de>
                       ` (7 subsequent siblings)
      9 siblings, 0 replies; 26+ messages in thread
    From: Andy Shevchenko @ 2020-03-20 14:31 UTC (permalink / raw)
      To: Thomas Gleixner
      Cc: LKML, maintainer:X86 ARCHITECTURE (32-BIT AND 64-BIT),
    	Greg Kroah-Hartman, Mark Gross, Tony Luck, Paolo Bonzini,
    	Darren Hart, Andy Shevchenko, Rafael J. Wysocki, Len Brown,
    	ACPI Devel Maling List, Viresh Kumar, Linux PM,
    	Srinivas Pandruvada, linux-edac, Platform Driver, Jean Delvare,
    	Guenter Roeck, linux-hwmon, Zhang Rui, Daniel Lezcano,
    	Amit Kucheria, Chanwoo Choi, Jacob Pan, Adrian Hunter,
    	Ulf Hansson, linux-mmc, Bjorn Helgaas, linux-pci, Takashi Iwai,
    	ALSA Development Mailing List, Herbert Xu, David S. Miller,
    	linux-crypto
    
    On Fri, Mar 20, 2020 at 3:19 PM Thomas Gleixner <tglx@linutronix.de> wrote:
    >
    > The x86 CPU matching based on struct x86_cpu_id:
    >
    >   - is using an inconsistent macro mess with pointlessly duplicated and
    >     slightly different local macros. Finding the places is an art as there
    >     is no consistent name space at all.
    >
    >   - is still mostly based on C89 struct initializers which rely on the
    >     ordering of the struct members. That's proliferated forever as every
    >     new driver just copies the mess from some exising one.
    >
    > A recent offlist conversation about adding more match criteria to the CPU
    > matching logic instead of creating yet another set of horrors, reminded me
    > of a pile of scripts and patches which I hacked on a few years ago when I
    > tried to add something to struct x86_cpu_id.
    >
    > That stuff was finally not needed and ended up in my ever growing todo list
    > and collected dust and cobwebs, but (un)surprisingly enough most of it
    > still worked out of the box. The copy & paste machinery still works as it
    > did years ago.
    >
    > There are a few places which needed extra care due to new creative macros,
    > new check combinations etc. and surprisingly ONE open coded proper C99
    > initializer.
    >
    > It was reasonably simple to make it at least compile and pass a quick
    > binary equivalence check.
    >
    > The result is a X86_MATCH prefix based set of macros which are reflecting
    > the needs of the usage sites and shorten the base macro which takes all
    > possible parameters (vendor, family, model, feature, data) and uses proper
    > C99 initializers.
    >
    > So extensions of the match logic are trivial after that.
    >
    
    Thank you, Thomas!
    
    Briefly looking to the code, I like the idea. I'll do (minor) comments
    on individual patches.
    
    I see it incorporates my previous attempts to extend this, but now it
    looks better.
    
    > The patch set is against Linus tree and has trivial conflicts against
    > linux-next.
    >
    > The diffstat is:
    >  71 files changed, 525 insertions(+), 472 deletions(-)
    >
    > but the extra lines are pretty much kernel-doc documentation which I added
    > to each of the new macros. The usage sites diffstat is:
    >
    >  70 files changed, 393 insertions(+), 471 deletions(-)
    >
    > Thoughts?
    >
    > Thanks,
    >
    >         tglx
    >
    >
    
    
    -- 
    With Best Regards,
    Andy Shevchenko
    
    ^ permalink raw reply	[flat|nested] 26+ messages in thread
  • [parent not found: <20200320131508.736205164@linutronix.de>]
  • [parent not found: <20200320131509.467730627@linutronix.de>]
  • [parent not found: <20200320131509.766573641@linutronix.de>]
  • [parent not found: <20200320131510.594671507@linutronix.de>]
  • * Re: [patch 00/22] x86/treewide: Consolidate CPU match macro maze and get rid of C89 (sic!) initializers
           [not found] <20200320131345.635023594@linutronix.de>
                       ` (5 preceding siblings ...)
           [not found] ` <20200320131510.594671507@linutronix.de>
    @ 2020-03-20 14:59 ` Greg Kroah-Hartman
           [not found] ` <20200320131509.564059710@linutronix.de>
                       ` (2 subsequent siblings)
      9 siblings, 0 replies; 26+ messages in thread
    From: Greg Kroah-Hartman @ 2020-03-20 14:59 UTC (permalink / raw)
      To: Thomas Gleixner
      Cc: LKML, x86, Mark Gross, Tony Luck, Paolo Bonzini, Darren Hart,
    	Andy Shevchenko, Rafael J. Wysocki, Len Brown, linux-acpi,
    	Viresh Kumar, linux-pm, Srinivas Pandruvada, linux-edac,
    	platform-driver-x86, Jean Delvare, Guenter Roeck, linux-hwmon,
    	Zhang Rui, Daniel Lezcano, Amit Kucheria, Chanwoo Choi, Jacob Pan,
    	Adrian Hunter, Ulf Hansson, linux-mmc, Bjorn Helgaas, linux-pci,
    	Takashi Iwai, alsa-devel, Herbert Xu, David S. Miller,
    	linux-crypto
    
    On Fri, Mar 20, 2020 at 02:13:45PM +0100, Thomas Gleixner wrote:
    > The x86 CPU matching based on struct x86_cpu_id:
    > 
    >   - is using an inconsistent macro mess with pointlessly duplicated and
    >     slightly different local macros. Finding the places is an art as there
    >     is no consistent name space at all.
    > 
    >   - is still mostly based on C89 struct initializers which rely on the
    >     ordering of the struct members. That's proliferated forever as every
    >     new driver just copies the mess from some exising one.
    > 
    > A recent offlist conversation about adding more match criteria to the CPU
    > matching logic instead of creating yet another set of horrors, reminded me
    > of a pile of scripts and patches which I hacked on a few years ago when I
    > tried to add something to struct x86_cpu_id.
    > 
    > That stuff was finally not needed and ended up in my ever growing todo list
    > and collected dust and cobwebs, but (un)surprisingly enough most of it
    > still worked out of the box. The copy & paste machinery still works as it
    > did years ago.
    > 
    > There are a few places which needed extra care due to new creative macros,
    > new check combinations etc. and surprisingly ONE open coded proper C99
    > initializer.
    > 
    > It was reasonably simple to make it at least compile and pass a quick
    > binary equivalence check.
    > 
    > The result is a X86_MATCH prefix based set of macros which are reflecting
    > the needs of the usage sites and shorten the base macro which takes all
    > possible parameters (vendor, family, model, feature, data) and uses proper
    > C99 initializers.
    > 
    > So extensions of the match logic are trivial after that.
    > 
    > The patch set is against Linus tree and has trivial conflicts against
    > linux-next.
    > 
    > The diffstat is:
    >  71 files changed, 525 insertions(+), 472 deletions(-)
    > 
    > but the extra lines are pretty much kernel-doc documentation which I added
    > to each of the new macros. The usage sites diffstat is:
    > 
    >  70 files changed, 393 insertions(+), 471 deletions(-)
    > 
    > Thoughts?
    
    Much nicer looking, thanks for cleaning up this mess:
    
    Reviewed-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
    
    ^ permalink raw reply	[flat|nested] 26+ messages in thread
  • [parent not found: <20200320131509.564059710@linutronix.de>]
  • * [PATCH 23/22] x86/smpboot: Remove the last ICPU() macro
           [not found] <20200320131345.635023594@linutronix.de>
                       ` (7 preceding siblings ...)
           [not found] ` <20200320131509.564059710@linutronix.de>
    @ 2020-03-24 18:58 ` Borislav Petkov
           [not found] ` <20200320131509.673579000@linutronix.de>
      9 siblings, 0 replies; 26+ messages in thread
    From: Borislav Petkov @ 2020-03-24 18:58 UTC (permalink / raw)
      To: Thomas Gleixner
      Cc: LKML, x86, Greg Kroah-Hartman, Mark Gross, Tony Luck,
    	Paolo Bonzini, Darren Hart, Andy Shevchenko, Rafael J. Wysocki,
    	Len Brown, linux-acpi, Viresh Kumar, linux-pm,
    	Srinivas Pandruvada, linux-edac, platform-driver-x86,
    	Jean Delvare, Guenter Roeck, linux-hwmon, Zhang Rui,
    	Daniel Lezcano, Amit Kucheria, Chanwoo Choi, Jacob Pan,
    	Adrian Hunter, Ulf Hansson, linux-mmc, Bjorn Helgaas, linux-pci,
    	Takashi Iwai, alsa-devel, Herbert Xu, David S. Miller,
    	linux-crypto
    
    ---
    From: Borislav Petkov <bp@suse.de>
    
    Now all is using the shiny new macros.
    
    Signed-off-by: Borislav Petkov <bp@suse.de>
    Cc: Thomas Gleixner <tglx@linutronix.de>
    ---
     arch/x86/kernel/smpboot.c | 17 +++++++++--------
     1 file changed, 9 insertions(+), 8 deletions(-)
    
    diff --git a/arch/x86/kernel/smpboot.c b/arch/x86/kernel/smpboot.c
    index fe3ab9632f3b..3b9bf8c7e29d 100644
    --- a/arch/x86/kernel/smpboot.c
    +++ b/arch/x86/kernel/smpboot.c
    @@ -1849,24 +1849,25 @@ static bool slv_set_max_freq_ratio(u64 *base_freq, u64 *turbo_freq)
     #include <asm/cpu_device_id.h>
     #include <asm/intel-family.h>
     
    -#define ICPU(model) \
    -	{X86_VENDOR_INTEL, 6, model, X86_FEATURE_APERFMPERF, 0}
    +#define X86_MATCH(model)					\
    +	X86_MATCH_VENDOR_FAM_MODEL_FEATURE(INTEL, 6,		\
    +		INTEL_FAM6_##model, X86_FEATURE_APERFMPERF, NULL)
     
     static const struct x86_cpu_id has_knl_turbo_ratio_limits[] = {
    -	ICPU(INTEL_FAM6_XEON_PHI_KNL),
    -	ICPU(INTEL_FAM6_XEON_PHI_KNM),
    +	X86_MATCH(XEON_PHI_KNL),
    +	X86_MATCH(XEON_PHI_KNM),
     	{}
     };
     
     static const struct x86_cpu_id has_skx_turbo_ratio_limits[] = {
    -	ICPU(INTEL_FAM6_SKYLAKE_X),
    +	X86_MATCH(SKYLAKE_X),
     	{}
     };
     
     static const struct x86_cpu_id has_glm_turbo_ratio_limits[] = {
    -	ICPU(INTEL_FAM6_ATOM_GOLDMONT),
    -	ICPU(INTEL_FAM6_ATOM_GOLDMONT_D),
    -	ICPU(INTEL_FAM6_ATOM_GOLDMONT_PLUS),
    +	X86_MATCH(ATOM_GOLDMONT),
    +	X86_MATCH(ATOM_GOLDMONT_D),
    +	X86_MATCH(ATOM_GOLDMONT_PLUS),
     	{}
     };
     
    -- 
    2.21.0
    
    
    -- 
    Regards/Gruss,
        Boris.
    
    https://people.kernel.org/tglx/notes-about-netiquette
    
    ^ permalink raw reply related	[flat|nested] 26+ messages in thread
  • [parent not found: <20200320131509.673579000@linutronix.de>]

  • end of thread, other threads:[~2020-03-26  8:34 UTC | newest]
    
    Thread overview: 26+ messages (download: mbox.gz follow: Atom feed
    -- links below jump to the message on this page --
         [not found] <20200320131345.635023594@linutronix.de>
         [not found] ` <20200320131508.826011988@linutronix.de>
    2020-03-20 14:29   ` [patch 02/22] x86/cpu: Add conistent CPU match macros Bjorn Helgaas
    2020-03-20 14:39   ` Andy Shevchenko
    2020-03-20 20:27     ` Thomas Gleixner
    2020-03-20 14:31 ` [patch 00/22] x86/treewide: Consolidate CPU match macro maze and get rid of C89 (sic!) initializers Andy Shevchenko
         [not found] ` <20200320131508.736205164@linutronix.de>
    2020-03-20 14:33   ` [patch 01/22] x86/devicetable: Move x86 specific macro out of generic code Andy Shevchenko
    2020-03-20 20:24     ` Thomas Gleixner
         [not found] ` <20200320131509.467730627@linutronix.de>
    2020-03-20 14:47   ` [patch 08/22] ACPI: Convert to new X86 CPU match macros Andy Shevchenko
    2020-03-20 20:32     ` Thomas Gleixner
    2020-03-23 16:38       ` mark gross
         [not found] ` <20200320131509.766573641@linutronix.de>
    2020-03-20 14:52   ` [patch 11/22] platform/x86: Convert to new " Andy Shevchenko
         [not found] ` <20200320131510.594671507@linutronix.de>
    2020-03-20 14:58   ` [patch 19/22] ASoC: Intel: Convert to new X86 " Andy Shevchenko
    2020-03-20 14:59 ` [patch 00/22] x86/treewide: Consolidate CPU match macro maze and get rid of C89 (sic!) initializers Greg Kroah-Hartman
         [not found] ` <20200320131509.564059710@linutronix.de>
    2020-03-20 14:50   ` [patch 09/22] cpufreq: Convert to new X86 CPU match macros Andy Shevchenko
    2020-03-20 20:30     ` Thomas Gleixner
    2020-03-20 21:52       ` Andy Shevchenko
    2020-03-20 22:18         ` Thomas Gleixner
         [not found]   ` <20200324060124.GC11705@shao2-debian>
    2020-03-24 10:24     ` [cpufreq] 06c4d00466: will-it-scale.per_process_ops -53.4% regression Andy Shevchenko
    2020-03-24 15:38       ` Srinivas Pandruvada
    2020-03-25  7:51         ` Rong Chen
    2020-03-25  7:50       ` Rong Chen
    2020-03-25 10:32         ` Thomas Gleixner
    2020-03-26  8:33           ` kernel test robot
    2020-03-24 13:51   ` [patch V2 09/22] cpufreq: Convert to new X86 CPU match macros Thomas Gleixner
    2020-03-24 15:37     ` Rafael J. Wysocki
    2020-03-24 18:58 ` [PATCH 23/22] x86/smpboot: Remove the last ICPU() macro Borislav Petkov
         [not found] ` <20200320131509.673579000@linutronix.de>
    2020-03-24 19:31   ` [patch 10/22] EDAC: Convert to new X86 CPU match macros Luck, Tony
    

    This is a public inbox, see mirroring instructions
    for how to clone and mirror all data and code used for this inbox;
    as well as URLs for NNTP newsgroup(s).