2023-10-29 20:56:44

by Stephen Rothwell

[permalink] [raw]
Subject: linux-next: duplicate patches in the risc-v tree

Hi all,

The following commits are also in Linus Torvalds' tree as different
commits (but the same patches):

767423658d53 ("riscv: kexec: Align the kexeced kernel entry")
fe2ed36d419f ("riscv: Remove duplicate objcopy flag")

--
Cheers,
Stephen Rothwell


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

2023-10-30 18:16:19

by Palmer Dabbelt

[permalink] [raw]
Subject: Re: linux-next: duplicate patches in the risc-v tree

On Sun, 29 Oct 2023 13:56:29 PDT (-0700), Stephen Rothwell wrote:
> Hi all,
>
> The following commits are also in Linus Torvalds' tree as different
> commits (but the same patches):
>
> 767423658d53 ("riscv: kexec: Align the kexeced kernel entry")
> fe2ed36d419f ("riscv: Remove duplicate objcopy flag")

Sorry, but I'm lost here -- I'm not sure if I've managed to screw up git
again? If it helps, I'm not seeing the same commits here:

$ git show fe2ed36d419f
commit fe2ed36d419fdae48a6850bdbe2d2e7543c3c389
gpg: Signature made Wed 20 Sep 2023 02:51:59 AM PDT
gpg: using RSA key 2B3C3747446843B24A943A7A2E1319F35FBB1889
gpg: issuer "[email protected]"
gpg: Good signature from "Palmer Dabbelt <[email protected]>" [ultimate]
gpg: aka "Palmer Dabbelt <[email protected]>" [ultimate]
Author: Song Shuai <[email protected]>
Date: Thu Sep 14 17:13:34 2023 +0800

riscv: Remove duplicate objcopy flag

There are two duplicate `-O binary` flags when objcopying from vmlinux
to Image/xipImage.

RISC-V set `-O binary` flag in both OBJCOPYFLAGS in the top-level riscv
Makefile and OBJCOPYFLAGS_* in the boot/Makefile, and the objcopy cmd
in Kbuild would join them together.

The `-O binary` flag is only needed for objcopying Image, so remove the
OBJCOPYFLAGS in the top-level riscv Makefile.

Fixes: c0fbcd991860 ("RISC-V: Build flat and compressed kernel images")
Signed-off-by: Song Shuai <[email protected]>
Link: https://lore.kernel.org/r/[email protected]
Signed-off-by: Palmer Dabbelt <[email protected]>

diff --git a/arch/riscv/Makefile b/arch/riscv/Makefile
index 1329e060c548..b43a6bb7e4dc 100644
--- a/arch/riscv/Makefile
+++ b/arch/riscv/Makefile
@@ -6,7 +6,6 @@
# for more details.
#

-OBJCOPYFLAGS := -O binary
LDFLAGS_vmlinux := -z norelro
ifeq ($(CONFIG_RELOCATABLE),y)
LDFLAGS_vmlinux += -shared -Bsymbolic -z notext --emit-relocs

and

$ git show 767423658d53 | cat
commit 767423658d53d147409821e51e6d0bc12425b24f
gpg: Signature made Wed 20 Sep 2023 02:53:30 AM PDT
gpg: using RSA key 2B3C3747446843B24A943A7A2E1319F35FBB1889
gpg: issuer "[email protected]"
gpg: Good signature from "Palmer Dabbelt <[email protected]>" [ultimate]
gpg: aka "Palmer Dabbelt <[email protected]>" [ultimate]
Author: Song Shuai <[email protected]>
Date: Thu Sep 7 18:33:03 2023 +0800

riscv: kexec: Align the kexeced kernel entry

The current riscv boot protocol requires 2MB alignment for RV64
and 4MB alignment for RV32.

In KEXEC_FILE path, the elf_find_pbase() function should align
the kexeced kernel entry according to the requirement, otherwise
the kexeced kernel would silently BUG at the setup_vm().

Fixes: 8acea455fafa ("RISC-V: Support for kexec_file on panic")
Signed-off-by: Song Shuai <[email protected]>
Link: https://lore.kernel.org/r/[email protected]
Signed-off-by: Palmer Dabbelt <[email protected]>

diff --git a/arch/riscv/kernel/elf_kexec.c b/arch/riscv/kernel/elf_kexec.c
index 5372b708fae2..9a81d6926ac6 100644
--- a/arch/riscv/kernel/elf_kexec.c
+++ b/arch/riscv/kernel/elf_kexec.c
@@ -98,7 +98,13 @@ static int elf_find_pbase(struct kimage *image, unsigned long kernel_len,
kbuf.image = image;
kbuf.buf_min = lowest_paddr;
kbuf.buf_max = ULONG_MAX;
- kbuf.buf_align = PAGE_SIZE;
+
+ /*
+ * Current riscv boot protocol requires 2MB alignment for
+ * RV64 and 4MB alignment for RV32
+ *
+ */
+ kbuf.buf_align = PMD_SIZE;
kbuf.mem = KEXEC_BUF_MEM_UNKNOWN;
kbuf.memsz = ALIGN(kernel_len, PAGE_SIZE);
kbuf.top_down = false;

>
> --
> Cheers,
> Stephen Rothwell

2023-10-30 19:43:33

by Samuel Holland

[permalink] [raw]
Subject: Re: linux-next: duplicate patches in the risc-v tree

On 10/30/23 13:15, Palmer Dabbelt wrote:
> On Sun, 29 Oct 2023 13:56:29 PDT (-0700), Stephen Rothwell wrote:
>> Hi all,
>>
>> The following commits are also in Linus Torvalds' tree as different
>> commits (but the same patches):
>>
>>   767423658d53 ("riscv: kexec: Align the kexeced kernel entry")
>>   fe2ed36d419f ("riscv: Remove duplicate objcopy flag")
>
> Sorry, but I'm lost here -- I'm not sure if I've managed to screw up git
> again?  If it helps, I'm not seeing the same commits here:

Each of these commits (separately) is a duplicate of a commit in Linus's
tree:

$ git range-diff v6.6...riscv/for-next | grep -v ' [<>] '
1441: 505b02957e74 ! 2: fe2ed36d419f riscv: Remove duplicate objcopy flag
@@ Commit message

Fixes: c0fbcd991860 ("RISC-V: Build flat and compressed kernel images")
Signed-off-by: Song Shuai <[email protected]>
- Reviewed-by: Palmer Dabbelt <[email protected]>
Link: https://lore.kernel.org/r/[email protected]
- Cc: [email protected]
Signed-off-by: Palmer Dabbelt <[email protected]>

## arch/riscv/Makefile ##
297: 1bfb2b618d52 ! 4: 767423658d53 riscv: kexec: Align the kexeced kernel entry
@@ Commit message

Fixes: 8acea455fafa ("RISC-V: Support for kexec_file on panic")
Signed-off-by: Song Shuai <[email protected]>
- Link: https://lore.kernel.org/r/[email protected]
+ Link: https://lore.kernel.org/r/[email protected]
Signed-off-by: Palmer Dabbelt <[email protected]>

## arch/riscv/kernel/elf_kexec.c ##