mbox series

[v2,00/10] x86/mce: Clean up some x86/mce code

Message ID 20241016123036.21366-1-qiuxu.zhuo@intel.com (mailing list archive)
Headers show
Series x86/mce: Clean up some x86/mce code | expand

Message

Qiuxu Zhuo Oct. 16, 2024, 12:30 p.m. UTC
1. Clean up some x86/mce code as below. No functional changes intended.

    - Simplify some code.

    - Remove some unnecessary code.

    - Improve readability for some code.

    - Fix some typos.

    [ Reduce the text segment size by ~116 bytes. ]

2. Pass the following basic tests:

   - Compile test.

   - Correctable/uncorrectable memory errors can be notified via CMCI/MCE interrupts.

   - Correctable/uncorrectable memory errors can be dispatched to the mcelog daemon and the EDAC driver.

   [ Tested on an Intel Sapphire Rapids server. ]

3. This patch series is based on v6.12-rc3.

4. Changes in v2:

   - Collect "Reviewed-by:" tags for patch {1-8,10}.

   - Update the commit message of patch 9 to include the names of all
     variables that don't need NULL pointer initializations.

Thanks Tony for reviewing this patch series.

Qiuxu Zhuo (10):
  x86/mce/dev-mcelog: Use xchg() to get and clear the flags
  x86/mce/intel: Use MCG_BANKCNT_MASK instead of 0xff
  x86/mce: Make several functions return bool
  x86/mce/threshold: Remove the redundant this_cpu_dec_return()
  x86/mce/genpool: Make mce_gen_pool_create() return explicit error codes
  x86/mce: Convert multiple if () statements into a switch() statement
  x86/mce: Remove the unnecessary {}
  x86/mce: Remove the redundant zeroing assignments
  x86/mce/amd: Remove unnecessary NULL pointer initializations
  x86/mce: Fix typos in comments

 arch/x86/include/asm/mce.h           |  4 +--
 arch/x86/kernel/cpu/mce/amd.c        | 18 +++++------
 arch/x86/kernel/cpu/mce/core.c       | 47 ++++++++++++++--------------
 arch/x86/kernel/cpu/mce/dev-mcelog.c | 11 ++-----
 arch/x86/kernel/cpu/mce/genpool.c    |  8 ++---
 arch/x86/kernel/cpu/mce/intel.c      | 11 ++++---
 arch/x86/kernel/cpu/mce/threshold.c  |  2 +-
 7 files changed, 46 insertions(+), 55 deletions(-)


base-commit: 8e929cb546ee42c9a61d24fae60605e9e3192354

Comments

Nikolay Borisov Oct. 17, 2024, 3:30 p.m. UTC | #1
On 16.10.24 г. 15:30 ч., Qiuxu Zhuo wrote:
> 1. Clean up some x86/mce code as below. No functional changes intended.
> 
>      - Simplify some code.
> 
>      - Remove some unnecessary code.
> 
>      - Improve readability for some code.
> 
>      - Fix some typos.
> 
>      [ Reduce the text segment size by ~116 bytes. ]
> 
> 2. Pass the following basic tests:
> 
>     - Compile test.
> 
>     - Correctable/uncorrectable memory errors can be notified via CMCI/MCE interrupts.
> 
>     - Correctable/uncorrectable memory errors can be dispatched to the mcelog daemon and the EDAC driver.
> 
>     [ Tested on an Intel Sapphire Rapids server. ]
> 
> 3. This patch series is based on v6.12-rc3.
> 
> 4. Changes in v2:
> 
>     - Collect "Reviewed-by:" tags for patch {1-8,10}.
> 
>     - Update the commit message of patch 9 to include the names of all
>       variables that don't need NULL pointer initializations.
> 
> Thanks Tony for reviewing this patch series.
> 
> Qiuxu Zhuo (10):
>    x86/mce/dev-mcelog: Use xchg() to get and clear the flags
>    x86/mce/intel: Use MCG_BANKCNT_MASK instead of 0xff
>    x86/mce: Make several functions return bool
>    x86/mce/threshold: Remove the redundant this_cpu_dec_return()
>    x86/mce/genpool: Make mce_gen_pool_create() return explicit error codes
>    x86/mce: Convert multiple if () statements into a switch() statement
>    x86/mce: Remove the unnecessary {}
>    x86/mce: Remove the redundant zeroing assignments
>    x86/mce/amd: Remove unnecessary NULL pointer initializations
>    x86/mce: Fix typos in comments
> 
>   arch/x86/include/asm/mce.h           |  4 +--
>   arch/x86/kernel/cpu/mce/amd.c        | 18 +++++------
>   arch/x86/kernel/cpu/mce/core.c       | 47 ++++++++++++++--------------
>   arch/x86/kernel/cpu/mce/dev-mcelog.c | 11 ++-----
>   arch/x86/kernel/cpu/mce/genpool.c    |  8 ++---
>   arch/x86/kernel/cpu/mce/intel.c      | 11 ++++---
>   arch/x86/kernel/cpu/mce/threshold.c  |  2 +-
>   7 files changed, 46 insertions(+), 55 deletions(-)
> 
> 
> base-commit: 8e929cb546ee42c9a61d24fae60605e9e3192354


Reviewed-by: Nikolay Borisov <nik.borisov@suse.com>
Sohil Mehta Oct. 18, 2024, 8:40 p.m. UTC | #2
On 10/16/2024 5:30 AM, Qiuxu Zhuo wrote:

> Qiuxu Zhuo (10):
>   x86/mce/dev-mcelog: Use xchg() to get and clear the flags
>   x86/mce/intel: Use MCG_BANKCNT_MASK instead of 0xff
>   x86/mce: Make several functions return bool
>   x86/mce/threshold: Remove the redundant this_cpu_dec_return()
>   x86/mce/genpool: Make mce_gen_pool_create() return explicit error codes
>   x86/mce: Convert multiple if () statements into a switch() statement
>   x86/mce: Remove the unnecessary {}
>   x86/mce: Remove the redundant zeroing assignments
>   x86/mce/amd: Remove unnecessary NULL pointer initializations
>   x86/mce: Fix typos in comments
> 

Apart from the minor nits and commit message changes, the patches look
fine to me.

With those addressed,
Reviewed-by: Sohil Mehta <sohil.mehta@intel.com>