2022-05-16 17:15:30

by Stephen Rothwell

[permalink] [raw]
Subject: linux-next: build failure after merge of the nvdimm tree

Hi all,

After merging the nvdimm tree, today's linux-next build (i386 defconfig)
failed like this:

In file included from include/linux/bits.h:6,
from include/linux/bitops.h:6,
from include/linux/kernel.h:22,
from arch/x86/include/asm/percpu.h:27,
from arch/x86/include/asm/preempt.h:6,
from include/linux/preempt.h:78,
from include/linux/spinlock.h:55,
from include/linux/wait.h:9,
from include/linux/wait_bit.h:8,
from include/linux/fs.h:6,
from include/linux/highmem.h:5,
from arch/x86/mm/pat/set_memory.c:6:
arch/x86/mm/pat/set_memory.c: In function 'set_mce_nospec':
include/vdso/bits.h:7:40: error: left shift count >= width of type [-Werror=shift-count-overflow]
7 | #define BIT(nr) (UL(1) << (nr))
| ^~
arch/x86/mm/pat/set_memory.c:1941:59: note: in expansion of macro 'BIT'
1941 | decoy_addr = (pfn << PAGE_SHIFT) + (PAGE_OFFSET ^ BIT(63));
| ^~~

Caused by commit

39702cf7885c ("x86/mce: relocate set{clear}_mce_nospec() functions")

I applied the following patch for today.

From: Stephen Rothwell <[email protected]>
Date: Mon, 16 May 2022 19:00:54 +1000
Subject: [PATCH] fix up for "x86/mce: relocate set{clear}_mce_nospec() functions"

Signed-off-by: Stephen Rothwell <[email protected]>
---
arch/x86/mm/pat/set_memory.c | 2 ++
1 file changed, 2 insertions(+)

diff --git a/arch/x86/mm/pat/set_memory.c b/arch/x86/mm/pat/set_memory.c
index 59d9efb4257c..9200e619d8b7 100644
--- a/arch/x86/mm/pat/set_memory.c
+++ b/arch/x86/mm/pat/set_memory.c
@@ -1914,6 +1914,7 @@ int set_memory_wb(unsigned long addr, int numpages)
}
EXPORT_SYMBOL(set_memory_wb);

+#ifdef CONFIG_X86_64
/* Prevent speculative access to a page by marking it not-present */
int set_mce_nospec(unsigned long pfn)
{
@@ -1959,6 +1960,7 @@ int clear_mce_nospec(unsigned long pfn)
return set_memory_present(&addr, 1);
}
EXPORT_SYMBOL_GPL(clear_mce_nospec);
+#endif

int set_memory_x(unsigned long addr, int numpages)
{
--
2.35.1

--
Cheers,
Stephen Rothwell


Attachments:
(No filename) (499.00 B)
OpenPGP digital signature

2022-05-17 01:33:58

by Dan Williams

[permalink] [raw]
Subject: Re: linux-next: build failure after merge of the nvdimm tree

On Mon, May 16, 2022 at 2:11 AM Stephen Rothwell <[email protected]> wrote:
>
> Hi all,
>
> After merging the nvdimm tree, today's linux-next build (i386 defconfig)
> failed like this:
>
> In file included from include/linux/bits.h:6,
> from include/linux/bitops.h:6,
> from include/linux/kernel.h:22,
> from arch/x86/include/asm/percpu.h:27,
> from arch/x86/include/asm/preempt.h:6,
> from include/linux/preempt.h:78,
> from include/linux/spinlock.h:55,
> from include/linux/wait.h:9,
> from include/linux/wait_bit.h:8,
> from include/linux/fs.h:6,
> from include/linux/highmem.h:5,
> from arch/x86/mm/pat/set_memory.c:6:
> arch/x86/mm/pat/set_memory.c: In function 'set_mce_nospec':
> include/vdso/bits.h:7:40: error: left shift count >= width of type [-Werror=shift-count-overflow]
> 7 | #define BIT(nr) (UL(1) << (nr))
> | ^~
> arch/x86/mm/pat/set_memory.c:1941:59: note: in expansion of macro 'BIT'
> 1941 | decoy_addr = (pfn << PAGE_SHIFT) + (PAGE_OFFSET ^ BIT(63));
> | ^~~
>
> Caused by commit
>
> 39702cf7885c ("x86/mce: relocate set{clear}_mce_nospec() functions")
>
> I applied the following patch for today.

Sorry I missed this. I looked for a way to avoid adding ifdefs in the
C file, but it seems that game is already lost in this file, so I'll
fold this change into the resend.

Thanks!

2017-11-03 16:08:32

by Dan Williams

[permalink] [raw]
Subject: Re: linux-next: build failure after merge of the nvdimm tree

On Fri, Nov 3, 2017 at 12:19 AM, Stephen Rothwell <[email protected]> wrote:
> Hi Dan,
>
> After merging the nvdimm tree, today's linux-next build (powerpc
> ppc64_defconfig) failed like this:
>
> In file included from arch/powerpc/kernel/asm-offsets.c:22:0:
> include/linux/mman.h: In function 'calc_vm_flag_bits':
> include/linux/mman.h:109:48: warning: division by zero [-Wdiv-by-zero]
> ((bit1) <= (bit2) ? ((x) & (bit1)) * ((bit2) / (bit1)) \
> ^
> include/linux/mman.h:133:9: note: in expansion of macro '_calc_vm_trans'
> _calc_vm_trans(flags, MAP_SYNC, VM_SYNC );
> ^
> cc1: all warnings being treated as errors
>
> and more like these ...
>
> Caused by commit
>
> ebd0722a382c ("mm: Define MAP_SYNC and VM_SYNC flags")
>
> Not all architectures use asm-generic/mman.h
>
> I have used the nvdimm tree from next-20171102 for today.

Thanks, Stephen. I included Jan's fix for this issue in today's
version of the libnvdimm-for-next branch.

From 1583028530288307014@xxx Fri Nov 03 07:20:51 +0000 2017
X-GM-THRID: 1583028530288307014
X-Gmail-Labels: Inbox,Category Forums,HistoricalUnread