[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <390b16ba-05d7-3590-c3b2-4b69aa3ae051@redhat.com>
Date: Mon, 29 Oct 2018 15:59:48 +0800
From: lijiang <lijiang@...hat.com>
To: Borislav Petkov <bp@...en8.de>
Cc: Baoquan He <bhe@...hat.com>, Petr Tesarik <ptesarik@...e.cz>,
linux-kernel@...r.kernel.org, x86@...nel.org,
kexec@...ts.infradead.org, mingo@...hat.com, tglx@...utronix.de,
dyoung@...hat.com
Subject: Re: [PATCH] kdump, vmcoreinfo: Export sme_me_mask value to vmcoreinfo
在 2018年10月27日 22:51, Borislav Petkov 写道:
> On Sat, Oct 27, 2018 at 10:41:56PM +0800, lijiang wrote:
>> Actually, the value of 'sme_me_mask' is 0x800000000000 when SME is
>> enabled, otherwise it is 0. That is to say, if the bit 47 is set, the
>> bit number is also 0x800000000000 (1 << 47UL);
>
> Yes, and you can simply copy the mask into your variable and export
> that.
Ok, if you agree with the following patch, i will post it again.
diff --git a/arch/x86/kernel/machine_kexec_64.c b/arch/x86/kernel/machine_kexec_64.c
index 4c8acdfdc5a7..de363796ed20 100644
--- a/arch/x86/kernel/machine_kexec_64.c
+++ b/arch/x86/kernel/machine_kexec_64.c
@@ -29,6 +29,9 @@
#include <asm/setup.h>
#include <asm/set_memory.h>
+u64 sme_mask;
+EXPORT_SYMBOL(sme_mask);
+
#ifdef CONFIG_KEXEC_FILE
const struct kexec_file_ops * const kexec_file_loaders[] = {
&kexec_bzImage64_ops,
@@ -357,6 +360,9 @@ void arch_crash_save_vmcoreinfo(void)
vmcoreinfo_append_str("NUMBER(pgtable_l5_enabled)=%d\n",
pgtable_l5_enabled());
+ sme_mask = sme_me_mask;
+ VMCOREINFO_NUMBER(sme_mask);
+
#ifdef CONFIG_NUMA
VMCOREINFO_SYMBOL(node_data);
VMCOREINFO_LENGTH(node_data, MAX_NUMNODES);
--
> Thinking about it more, though, it might be better if you instead
> export a smaller value - not an u64 - and construct the mask in
> userspace. I.e., a u8 which should be enough for your current purposes.
>
> I say current because if it turns out we need to export more SME-related
> info to userspace, exporting an u64 and then OR-ing in more information
> in it would allow that. u8 not so much. So doing something like:
>
> [ misc ][ enc bit ][ other misc SME info ]
> 0000_0000_0000_0000_1000_0000_0000_0000_0000_0000_0000_0000_0000_0000_0000_0000
> 63 59 55 51 47 43 39 35 31 27 23 19 15 11 7 3
>
> would allow for exporting that additional info.
>
> Especially if we want to use VMCOREINFO for more than kexec things.
>
As you mentioned, if need, the definition of this variable(u64 sme_mask) can be extended
conveniently in the future(The bit might be redefined).
Thanks.
Lianbo
Powered by blists - more mailing lists