Received: by 2002:ac0:98c7:0:0:0:0:0 with SMTP id g7-v6csp3075335imd; Mon, 29 Oct 2018 01:00:47 -0700 (PDT) X-Google-Smtp-Source: AJdET5djSrQGN39Id8/n+0bueJIbpI/gH4mvvX4kMM2IQ9BNJEEx2aMogMiY2GgvhZJovz1pgfNi X-Received: by 2002:a17:902:7587:: with SMTP id j7-v6mr13211876pll.67.1540800047551; Mon, 29 Oct 2018 01:00:47 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1540800047; cv=none; d=google.com; s=arc-20160816; b=0XmNAgSpW289OHH4TT9UImkBPWO80QVsQjSONIRyCipfcjYY5D5ptXJ7I/xGZDbmOw JZ9vUTzn1r7OKiXzhlDkeihNbmJaMxsAXxD/Ylx59ks/XjweCgBZdbfB9BeATeD/j+tt l7xIr0UynK0RkhazHPfr0SaIPtsJ0i9EbISnl5nynGq4h9qZG+gH5K9e4Kr/oDlR9wf3 pXDxSdEQPICQ1pmZLEZEX6O/5Fq2ES78VC+WAb2JCHQTJNB5ZAGY2mYUj4G46eV+WQgU yY8Jt1Q1+KGtEEFmV+badvDlYp8PhQEPs6f8YrZWnR7XsFVyqVu6m12xJUdWH5bc7AGn u8Dw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:content-transfer-encoding :content-language:in-reply-to:mime-version:user-agent:date :message-id:from:references:cc:to:subject; bh=kB8xFSqBfk5w0+reXlvBM7KDZXfgeeTdRawVYzTlcIc=; b=Jk3BbSsDoduQ8OLE59/LAzW1+w4hrHHo1jwsNiA6vT1aJrVfcmO6UQAb/Ug6rGT8a3 SGpJYSp30ODTVCH/JUDA+Ak5ilK4zDy1CH3P+fHA5ylbuFS+1wibvsv3dge7/ZYIfBnV xCNCATakPfDPWjfc8W6O93cgRxgTzBuPhmKGm5TYThP/txBoofZz7M/mV9Lr7DEyZO2j hYpJYpccn2zWWXO/MSF4HlVDCyUZVXt1fpquqgOdpd5+SkoVXWA5RblWoR4dBGX22QYw McMFy+hCEX7txKk3CBCX0VrujSWIAKakk7XJhVEzWOuvMBgqZx7Ua7qGFC1MRxBStqGg XIIQ== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=redhat.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id a80-v6si20252698pfj.195.2018.10.29.01.00.29; Mon, 29 Oct 2018 01:00:47 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=redhat.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1729271AbeJ2Qrg (ORCPT + 99 others); Mon, 29 Oct 2018 12:47:36 -0400 Received: from mx1.redhat.com ([209.132.183.28]:52026 "EHLO mx1.redhat.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1725969AbeJ2Qrg (ORCPT ); Mon, 29 Oct 2018 12:47:36 -0400 Received: from smtp.corp.redhat.com (int-mx07.intmail.prod.int.phx2.redhat.com [10.5.11.22]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id E288E30034AB; Mon, 29 Oct 2018 08:00:04 +0000 (UTC) Received: from localhost.localdomain (ovpn-12-109.pek2.redhat.com [10.72.12.109]) by smtp.corp.redhat.com (Postfix) with ESMTPS id AD86610018FD; Mon, 29 Oct 2018 07:59:53 +0000 (UTC) Subject: Re: [PATCH] kdump, vmcoreinfo: Export sme_me_mask value to vmcoreinfo To: Borislav Petkov Cc: Baoquan He , Petr Tesarik , linux-kernel@vger.kernel.org, x86@kernel.org, kexec@lists.infradead.org, mingo@redhat.com, tglx@linutronix.de, dyoung@redhat.com References: <1263471c-a27d-a698-15f0-b5947f13ea93@redhat.com> <20181026182440.20a4b107@ezekiel.suse.cz> <20181026222517.GB26927@nazgul.tnic> <20181027081343.GA1884@MiWiFi-R3L-srv> <20181027091007.GB1046@nazgul.tnic> <20181027093917.GA14493@MiWiFi-R3L-srv> <20181027101221.GC1046@nazgul.tnic> <20181027110858.GB14493@MiWiFi-R3L-srv> <20181027145151.GA7338@nazgul.tnic> From: lijiang Message-ID: <390b16ba-05d7-3590-c3b2-4b69aa3ae051@redhat.com> Date: Mon, 29 Oct 2018 15:59:48 +0800 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:52.0) Gecko/20100101 Thunderbird/52.9.1 MIME-Version: 1.0 In-Reply-To: <20181027145151.GA7338@nazgul.tnic> Content-Type: text/plain; charset=utf-8 Content-Language: en-US Content-Transfer-Encoding: 8bit X-Scanned-By: MIMEDefang 2.84 on 10.5.11.22 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.47]); Mon, 29 Oct 2018 08:00:05 +0000 (UTC) Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org 在 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 #include +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