[PATCH -next] ext4: fix error return code in ext4_fc_perform_commit()

2021-04-08 Thread Xu Yihang
In case of if not ext4_fc_add_tlv branch, an error return code is missing.

Fixes: aa75f4d3daae ("ext4: main fast-commit commit path")
Reported-by: Hulk Robot 
Signed-off-by: Xu Yihang 
---
 fs/ext4/fast_commit.c | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)

diff --git a/fs/ext4/fast_commit.c b/fs/ext4/fast_commit.c
index 7541d0b5d706..312273ed8a9f 100644
--- a/fs/ext4/fast_commit.c
+++ b/fs/ext4/fast_commit.c
@@ -1088,8 +1088,10 @@ static int ext4_fc_perform_commit(journal_t *journal)
head.fc_tid = cpu_to_le32(
sbi->s_journal->j_running_transaction->t_tid);
if (!ext4_fc_add_tlv(sb, EXT4_FC_TAG_HEAD, sizeof(head),
-   (u8 *), ))
+   (u8 *), )) {
+   ret = -ENOSPC;
goto out;
+   }
}
 
spin_lock(>s_fc_lock);
-- 
2.17.1



[PATCH -next] x86: Fix intel cpu unsed variable ‘l2’ warning

2021-03-22 Thread Xu Yihang
Fixes the following W=1 kernel build warning(s):
../arch/x86/kernel/cpu/intel.c: In function ‘init_intel’:
../arch/x86/kernel/cpu/intel.c:644:20: warning: variable ‘l2’ set but not used 
[-Wunused-but-set-variable]
   unsigned int l1, l2;
^~

Compilation command(s):
make allmodconfig ARCH=x86_64 CROSS_COMPILE=x86_64-linux-gnu-
make W=1 arch/x86/kernel/cpu/intel.o ARCH=x86_64 CROSS_COMPILE=x86_64-linux-gnu-

According to Intel Software Developer's Manual Table 2-2 through Table 2-24 
about MSRs:
X86_FEATURE_BTS which represents Branch Trace Storage Unavailable and 
X86_FEATURE_PEBS
represens Processor Event Based Sampling (PEBS) Unavailable, but on some 
platform these fields
maybe reserved or not available. For the function init_intel it self, only bit 
11 and bit 12
are used for checking BTS and PEBS, and higher 32 bits are not used. So cast to 
void to
avoid warning.

Reported-by: Hulk Robot 
Signed-off-by: Xu Yihang 
---
 arch/x86/kernel/cpu/intel.c | 1 +
 1 file changed, 1 insertion(+)

diff --git a/arch/x86/kernel/cpu/intel.c b/arch/x86/kernel/cpu/intel.c
index 63e381a46153..547ba6668eb3 100644
--- a/arch/x86/kernel/cpu/intel.c
+++ b/arch/x86/kernel/cpu/intel.c
@@ -644,6 +644,7 @@ static void init_intel(struct cpuinfo_x86 *c)
unsigned int l1, l2;
 
rdmsr(MSR_IA32_MISC_ENABLE, l1, l2);
+   (void) l2;
if (!(l1 & (1<<11)))
set_cpu_cap(c, X86_FEATURE_BTS);
if (!(l1 & (1<<12)))
-- 
2.17.1



[PATCH -next] x86: Fix unused variable 'hi'

2021-03-22 Thread Xu Yihang
Fixes the following W=1 kernel build warning(s):
arch/x86/hyperv/hv_apic.c:58:15: warning: variable ‘hi’ set but not used 
[-Wunused-but-set-variable]

Compiled with CONFIG_HYPERV enabled:
make allmodconfig ARCH=x86_64 CROSS_COMPILE=x86_64-linux-gnu-
make W=1 arch/x86/hyperv/hv_apic.o ARCH=x86_64 CROSS_COMPILE=x86_64-linux-gnu-

HV_X64_MSR_EOI stores on bit 31:0 and HV_X64_MSR_TPR stores in bit 7:0, which 
means higher
32 bits are not really used, therefore  potentially cast to void in order to 
silent this warning.

Reported-by: Hulk Robot 
Signed-off-by: Xu Yihang 
---
 arch/x86/hyperv/hv_apic.c | 2 ++
 1 file changed, 2 insertions(+)

diff --git a/arch/x86/hyperv/hv_apic.c b/arch/x86/hyperv/hv_apic.c
index 284e73661a18..a8b639498033 100644
--- a/arch/x86/hyperv/hv_apic.c
+++ b/arch/x86/hyperv/hv_apic.c
@@ -60,9 +60,11 @@ static u32 hv_apic_read(u32 reg)
switch (reg) {
case APIC_EOI:
rdmsr(HV_X64_MSR_EOI, reg_val, hi);
+   (void) hi;
return reg_val;
case APIC_TASKPRI:
rdmsr(HV_X64_MSR_TPR, reg_val, hi);
+   (void) hi;
return reg_val;
 
default:
-- 
2.17.1



[PATCH -next] x86: Fix unused variable 'msr_val' warning

2021-03-22 Thread Xu Yihang
Fixes the following W=1 kernel build warning(s):
arch/x86/hyperv/hv_spinlock.c:28:16: warning: variable ‘msr_val’ set but not 
used [-Wunused-but-set-variable]
  unsigned long msr_val;

As Hypervisor Top-Level Functional Specification states in chapter 7.5 Virtual 
Processor Idle Sleep State, "A partition which possesses the AccessGuestIdleMsr 
privilege (refer to section 4.2.2) may trigger entry into the virtual processor 
idle sleep state through a read to the hypervisor-defined MSR 
HV_X64_MSR_GUEST_IDLE". That means only a read is necessary, msr_val is not 
uesed, so potentially cast to void in order to silent this warning.

Reference:
https://docs.microsoft.com/en-us/virtualization/hyper-v-on-windows/reference/tlfs

Reported-by: Hulk Robot 
Signed-off-by: Xu Yihang 
---
 arch/x86/hyperv/hv_spinlock.c | 8 ++--
 1 file changed, 6 insertions(+), 2 deletions(-)

diff --git a/arch/x86/hyperv/hv_spinlock.c b/arch/x86/hyperv/hv_spinlock.c
index f3270c1fc48c..91cfe698bde0 100644
--- a/arch/x86/hyperv/hv_spinlock.c
+++ b/arch/x86/hyperv/hv_spinlock.c
@@ -25,7 +25,6 @@ static void hv_qlock_kick(int cpu)
 
 static void hv_qlock_wait(u8 *byte, u8 val)
 {
-   unsigned long msr_val;
unsigned long flags;
 
if (in_nmi())
@@ -48,8 +47,13 @@ static void hv_qlock_wait(u8 *byte, u8 val)
/*
 * Only issue the rdmsrl() when the lock state has not changed.
 */
-   if (READ_ONCE(*byte) == val)
+   if (READ_ONCE(*byte) == val) {
+   unsigned long msr_val;
+
rdmsrl(HV_X64_MSR_GUEST_IDLE, msr_val);
+
+   (void)msr_val;
+   }
local_irq_restore(flags);
 }
 
-- 
2.17.1



[no subject]

2021-03-21 Thread Xu Yihang


Git message updated.



[PATCH -next] x86: Fix unused variable 'hi'

2021-03-21 Thread Xu Yihang
Fixes the following W=1 kernel build warning(s):
arch/x86/hyperv/hv_apic.c:58:15: warning: variable ‘hi’ set but not used 
[-Wunused-but-set-variable]

Compiled with CONFIG_HYPERV enabled:
make allmodconfig ARCH=x86_64 CROSS_COMPILE=x86_64-linux-gnu-
make W=1 arch/x86/hyperv/hv_apic.o ARCH=x86_64 CROSS_COMPILE=x86_64-linux-gnu-

HV_X64_MSR_EOI stores on bit 31:0 and HV_X64_MSR_TPR stores in bit 7:0, which 
means higher 32 bits are not really used, therefore __maybe_unused added.

Reported-by: Hulk Robot 
Signed-off-by: Xu Yihang 
---
 arch/x86/hyperv/hv_apic.c | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/arch/x86/hyperv/hv_apic.c b/arch/x86/hyperv/hv_apic.c
index 284e73661a18..c0b0a5774f31 100644
--- a/arch/x86/hyperv/hv_apic.c
+++ b/arch/x86/hyperv/hv_apic.c
@@ -55,7 +55,8 @@ static void hv_apic_icr_write(u32 low, u32 id)
 
 static u32 hv_apic_read(u32 reg)
 {
-   u32 reg_val, hi;
+   u32 hi __maybe_unused;
+   u32 reg_val;
 
switch (reg) {
case APIC_EOI:
-- 
2.17.1



[PATCH -next] x86: Fix unused variable 'msr_val' warning

2021-03-21 Thread Xu Yihang
Fixes the following W=1 kernel build warning(s):
arch/x86/hyperv/hv_spinlock.c:28:16: warning: variable ‘msr_val’ set but not 
used [-Wunused-but-set-variable]
  unsigned long msr_val;

As Hypervisor Top-Level Functional Specification states in chapter 7.5 Virtual 
Processor Idle Sleep State, "A partition which possesses the AccessGuestIdleMsr 
privilege (refer to section 4.2.2) may trigger entry into the virtual processor 
idle sleep state through a read to the hypervisor-defined MSR 
HV_X64_MSR_GUEST_IDLE". That means only a read is necessary, msr_val is not 
uesed, so __maybe_unused should be added.

Reference:
https://docs.microsoft.com/en-us/virtualization/hyper-v-on-windows/reference/tlfs

Reported-by: Hulk Robot 
Signed-off-by: Xu Yihang 
---
 arch/x86/hyperv/hv_spinlock.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/arch/x86/hyperv/hv_spinlock.c b/arch/x86/hyperv/hv_spinlock.c
index f3270c1fc48c..67bc15c7752a 100644
--- a/arch/x86/hyperv/hv_spinlock.c
+++ b/arch/x86/hyperv/hv_spinlock.c
@@ -25,7 +25,7 @@ static void hv_qlock_kick(int cpu)
 
 static void hv_qlock_wait(u8 *byte, u8 val)
 {
-   unsigned long msr_val;
+   unsigned long msr_val __maybe_unused;
unsigned long flags;
 
if (in_nmi())
-- 
2.17.1



[PATCH -next] x86: Fix unused variable 'msr_val' warning

2021-03-18 Thread Xu Yihang
Fixes the following W=1 kernel build warning(s):
arch/x86/hyperv/hv_spinlock.c:28:16: warning: variable ‘msr_val’ set but not 
used [-Wunused-but-set-variable]
  unsigned long msr_val;

Reported-by: Hulk Robot 
Signed-off-by: Xu Yihang 
---
 arch/x86/hyperv/hv_spinlock.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/arch/x86/hyperv/hv_spinlock.c b/arch/x86/hyperv/hv_spinlock.c
index f3270c1fc48c..67bc15c7752a 100644
--- a/arch/x86/hyperv/hv_spinlock.c
+++ b/arch/x86/hyperv/hv_spinlock.c
@@ -25,7 +25,7 @@ static void hv_qlock_kick(int cpu)
 
 static void hv_qlock_wait(u8 *byte, u8 val)
 {
-   unsigned long msr_val;
+   unsigned long msr_val __maybe_unused;
unsigned long flags;
 
if (in_nmi())
-- 
2.17.1



[PATCH -next] x86: Fix unused variable 'hi'

2021-03-18 Thread Xu Yihang
Fixes the following W=1 kernel build warning(s):
arch/x86/hyperv/hv_apic.c:58:15: warning: variable ‘hi’ set but not used 
[-Wunused-but-set-variable]

Reported-by: Hulk Robot 
Signed-off-by: Xu Yihang 
---
 arch/x86/hyperv/hv_apic.c | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/arch/x86/hyperv/hv_apic.c b/arch/x86/hyperv/hv_apic.c
index 284e73661a18..c0b0a5774f31 100644
--- a/arch/x86/hyperv/hv_apic.c
+++ b/arch/x86/hyperv/hv_apic.c
@@ -55,7 +55,8 @@ static void hv_apic_icr_write(u32 low, u32 id)
 
 static u32 hv_apic_read(u32 reg)
 {
-   u32 reg_val, hi;
+   u32 hi __maybe_unused;
+   u32 reg_val;
 
switch (reg) {
case APIC_EOI:
-- 
2.17.1