All of lore.kernel.org
 help / color / mirror / Atom feed
From: Baoquan He <bhe@redhat.com>
To: Borislav Petkov <bp@alien8.de>
Cc: "x86@kernel.org" <x86@kernel.org>,
	Kairui Song <kasong@redhat.com>,
	Chao Fan <fanc.fnst@cn.fujitsu.com>,
	"kexec@lists.infradead.org" <kexec@lists.infradead.org>,
	linux-kernel@vger.kernel.org, "H. Peter Anvin" <hpa@zytor.com>,
	Junichi Nomura <j-nomura@ce.jp.nec.com>,
	Thomas Gleixner <tglx@linutronix.de>,
	dyoung@redhat.com
Subject: Re: [RFC PATCH] kexec, x86/boot: map systab region in identity mapping before accessing it
Date: Fri, 26 Apr 2019 17:51:34 +0800	[thread overview]
Message-ID: <20190426095134.GP3584@localhost.localdomain> (raw)
In-Reply-To: <20190422151723.GD21457@zn.tnic>

On 04/22/19 at 05:17pm, Borislav Petkov wrote:
> + hpa
> 
> On Mon, Apr 22, 2019 at 10:33:46PM +0800, Baoquan He wrote:
> > On 04/19/19 at 01:36pm, Borislav Petkov wrote:
> > > On Fri, Apr 19, 2019 at 01:28:01PM +0200, Borislav Petkov wrote:
> > > > Read again what I said: "should all be passed through boot_params".
> > > > Which means, boot_params should be extended with a field of a flag to
> > > > say: "this is a kexec'ed kernel".
> > > 
> > > And by that I mean similar to the XLF_EFI_KEXEC mechanism. The first
> > > kernel or kexec(1) should prepare the info needed by the kexec'ed
> > > kernel.
> > 
> > We have set the loader type to '0x0D << 4' for kexec specifically, in both
> > kexec_load and kexec_file_load. We can check this to identify if it's
> > kexec-ed kernel or not.
> > 
> > Update patch with it?
> > 
> > static void *bzImage64_load(struct kimage *image, char *kernel,
> >                             unsigned long kernel_len, char *initrd,
> >                             unsigned long initrd_len, char *cmdline,
> >                             unsigned long cmdline_len)
> > {
> > 
> > 	...
> > 	/* bootloader info. Do we need a separate ID for kexec kernel loader? */
> >         params->hdr.type_of_loader = 0x0D << 4;
> 
> That's already documented in Documentation/x86/boot.txt
> 
> Field name:     type_of_loader
> Type:           write (obligatory)
> Offset/size:    0x210/1
> Protocol:       2.00+
> 
> 	...
> 
>         D  kexec-tools
> 
> And yes, the question in the code is still valid: do we need a separate ID.
> 
> I'd say no and we'll simply call 0xD all kernels loaded using a
> kexec-type syscall.

Yes, agree. Time has proved we don't need a separate ID, just 0x0D is
fine for both kexec/kdump. We can clear it away now.

I can make a patch to add a bit into xloadflags, to indicate that this
is kexec-ed kernel. It can help to differentiate kexec-ed kernel from
kdump kernel. As we know, kdump kernel is recognized with /proc/vmcore
existence. While during kernel initialization stage, or /proc/vmcore is
not validated in some cases, the adding bit may help.

Thoughts?

Thanks
Baoquan

_______________________________________________
kexec mailing list
kexec@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/kexec

WARNING: multiple messages have this Message-ID (diff)
From: Baoquan He <bhe@redhat.com>
To: Borislav Petkov <bp@alien8.de>
Cc: "H. Peter Anvin" <hpa@zytor.com>,
	Junichi Nomura <j-nomura@ce.jp.nec.com>,
	dyoung@redhat.com, Kairui Song <kasong@redhat.com>,
	Thomas Gleixner <tglx@linutronix.de>,
	linux-kernel@vger.kernel.org, Chao Fan <fanc.fnst@cn.fujitsu.com>,
	"x86@kernel.org" <x86@kernel.org>,
	"kexec@lists.infradead.org" <kexec@lists.infradead.org>
Subject: Re: [RFC PATCH] kexec, x86/boot: map systab region in identity mapping before accessing it
Date: Fri, 26 Apr 2019 17:51:34 +0800	[thread overview]
Message-ID: <20190426095134.GP3584@localhost.localdomain> (raw)
In-Reply-To: <20190422151723.GD21457@zn.tnic>

On 04/22/19 at 05:17pm, Borislav Petkov wrote:
> + hpa
> 
> On Mon, Apr 22, 2019 at 10:33:46PM +0800, Baoquan He wrote:
> > On 04/19/19 at 01:36pm, Borislav Petkov wrote:
> > > On Fri, Apr 19, 2019 at 01:28:01PM +0200, Borislav Petkov wrote:
> > > > Read again what I said: "should all be passed through boot_params".
> > > > Which means, boot_params should be extended with a field of a flag to
> > > > say: "this is a kexec'ed kernel".
> > > 
> > > And by that I mean similar to the XLF_EFI_KEXEC mechanism. The first
> > > kernel or kexec(1) should prepare the info needed by the kexec'ed
> > > kernel.
> > 
> > We have set the loader type to '0x0D << 4' for kexec specifically, in both
> > kexec_load and kexec_file_load. We can check this to identify if it's
> > kexec-ed kernel or not.
> > 
> > Update patch with it?
> > 
> > static void *bzImage64_load(struct kimage *image, char *kernel,
> >                             unsigned long kernel_len, char *initrd,
> >                             unsigned long initrd_len, char *cmdline,
> >                             unsigned long cmdline_len)
> > {
> > 
> > 	...
> > 	/* bootloader info. Do we need a separate ID for kexec kernel loader? */
> >         params->hdr.type_of_loader = 0x0D << 4;
> 
> That's already documented in Documentation/x86/boot.txt
> 
> Field name:     type_of_loader
> Type:           write (obligatory)
> Offset/size:    0x210/1
> Protocol:       2.00+
> 
> 	...
> 
>         D  kexec-tools
> 
> And yes, the question in the code is still valid: do we need a separate ID.
> 
> I'd say no and we'll simply call 0xD all kernels loaded using a
> kexec-type syscall.

Yes, agree. Time has proved we don't need a separate ID, just 0x0D is
fine for both kexec/kdump. We can clear it away now.

I can make a patch to add a bit into xloadflags, to indicate that this
is kexec-ed kernel. It can help to differentiate kexec-ed kernel from
kdump kernel. As we know, kdump kernel is recognized with /proc/vmcore
existence. While during kernel initialization stage, or /proc/vmcore is
not validated in some cases, the adding bit may help.

Thoughts?

Thanks
Baoquan

  reply	other threads:[~2019-04-26  9:51 UTC|newest]

Thread overview: 37+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2019-04-19 10:17 [RFC PATCH] kexec, x86/boot: map systab region in identity mapping before accessing it Borislav Petkov
2019-04-19 10:17 ` Borislav Petkov
2019-04-19 10:50 ` Baoquan He
2019-04-19 10:50   ` Baoquan He
2019-04-19 10:55   ` Baoquan He
2019-04-19 10:55     ` Baoquan He
2019-04-19 11:20   ` Kairui Song
2019-04-19 11:20     ` Kairui Song
2019-04-19 11:34     ` Borislav Petkov
2019-04-19 11:34       ` Borislav Petkov
2019-04-19 11:50       ` Kairui Song
2019-04-19 11:50         ` Kairui Song
2019-04-19 14:19         ` [PATCH] x86/boot: Disable RSDP parsing temporarily Borislav Petkov
2019-04-19 14:19           ` Borislav Petkov
2019-04-22  9:46           ` [tip:x86/urgent] " tip-bot for Borislav Petkov
2019-04-19 11:28   ` [RFC PATCH] kexec, x86/boot: map systab region in identity mapping before accessing it Borislav Petkov
2019-04-19 11:28     ` Borislav Petkov
2019-04-19 11:36     ` Borislav Petkov
2019-04-19 11:36       ` Borislav Petkov
2019-04-22 14:33       ` Baoquan He
2019-04-22 14:33         ` Baoquan He
2019-04-22 15:17         ` Borislav Petkov
2019-04-22 15:17           ` Borislav Petkov
2019-04-26  9:51           ` Baoquan He [this message]
2019-04-26  9:51             ` Baoquan He
2019-04-26  9:58             ` Borislav Petkov
2019-04-26  9:58               ` Borislav Petkov
2019-04-26 10:16               ` Baoquan He
2019-04-26 10:16                 ` Baoquan He
2019-04-19 11:44     ` Baoquan He
2019-04-19 11:44       ` Baoquan He
  -- strict thread matches above, loose matches on Subject: below --
2019-04-16  9:52 [PATCH] x86/boot: Use efi_setup_data for searching RSDP on kexec-ed kernels Borislav Petkov
2019-04-19  8:34 ` [RFC PATCH] kexec, x86/boot: map systab region in identity mapping before accessing it Kairui Song
2019-04-19  8:34   ` Kairui Song
2019-04-19  8:58   ` Baoquan He
2019-04-19  8:58     ` Baoquan He
2019-04-19  9:39     ` Kairui Song
2019-04-19  9:39       ` Kairui Song

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20190426095134.GP3584@localhost.localdomain \
    --to=bhe@redhat.com \
    --cc=bp@alien8.de \
    --cc=dyoung@redhat.com \
    --cc=fanc.fnst@cn.fujitsu.com \
    --cc=hpa@zytor.com \
    --cc=j-nomura@ce.jp.nec.com \
    --cc=kasong@redhat.com \
    --cc=kexec@lists.infradead.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=tglx@linutronix.de \
    --cc=x86@kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.