linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Thomas Gleixner <tglx@linutronix.de>
To: Mike Lothian <mike@fireburn.co.uk>
Cc: thomas.lendacky@amd.com, bhe@redhat.com,
	Borislav Petkov <bp@alien8.de>,
	dave.hansen@linux.intel.com, lijiang@redhat.com,
	Linux Kernel Mailing List <linux-kernel@vger.kernel.org>,
	Andy Lutomirski <luto@kernel.org>,
	mingo@redhat.com, Peter Zijlstra <peterz@infradead.org>,
	x86@kernel.org, "H.J. Lu" <hjl.tools@gmail.com>
Subject: Re: [PATCH v3 1/2] x86/mm: Identify the end of the kernel area to be reserved
Date: Mon, 15 Jul 2019 12:35:33 +0200 (CEST)	[thread overview]
Message-ID: <alpine.DEB.2.21.1907151140080.1669@nanos.tec.linutronix.de> (raw)
In-Reply-To: <alpine.DEB.2.21.1907151118570.1669@nanos.tec.linutronix.de>

On Mon, 15 Jul 2019, Thomas Gleixner wrote:
> On Mon, 15 Jul 2019, Mike Lothian wrote:
> > That build failure is from the current tip of Linus's tree
> > If the fix is in, then it hasn't fixed the issue
> 
> The reverted commit caused a build fail with gold as well. Let me stare at
> your issue.

So with gold the build fails in the reloc tool complaining about that
relocation:

  Invalid absolute R_X86_64_32S relocation: __end_of_kernel_reserve

The commit does:
 
+extern char __end_of_kernel_reserve[];
+
 
 void __init setup_arch(char **cmdline_p)
 {
+	/*
+	 * Reserve the memory occupied by the kernel between _text and
+	 * __end_of_kernel_reserve symbols. Any kernel sections after the
+	 * __end_of_kernel_reserve symbol must be explicitly reserved with a
+	 * separate memblock_reserve() or they will be discarded.
+	 */
 	memblock_reserve(__pa_symbol(_text),
-			 (unsigned long)__bss_stop - (unsigned long)_text);
+			 (unsigned long)__end_of_kernel_reserve - (unsigned long)_text);

So it replaces __bss_stop with __end_of_kernel_reserve here.

--- a/arch/x86/kernel/vmlinux.lds.S
+++ b/arch/x86/kernel/vmlinux.lds.S
@@ -368,6 +368,14 @@ SECTIONS
 		__bss_stop = .;
 	}
 
+	/*
+	 * The memory occupied from _text to here, __end_of_kernel_reserve, is
+	 * automatically reserved in setup_arch(). Anything after here must be
+	 * explicitly reserved using memblock_reserve() or it will be discarded
+	 * and treated as available memory.
+	 */
+	__end_of_kernel_reserve = .;

And from the linker script __bss_stop and __end_of_kernel_reserve are
exactly the same. From System.map (of a successful ld build):

ffffffff82c00000 B __brk_base
ffffffff82c00000 B __bss_stop
ffffffff82c00000 B __end_bss_decrypted
ffffffff82c00000 B __end_of_kernel_reserve
ffffffff82c00000 B __start_bss_decrypted
ffffffff82c00000 B __start_bss_decrypted_unused

So how on earth can gold fail with that __end_of_kernel_reserve change?

For some unknown reason it turns that relocation into an absolute
one. That's clearly a gold bug^Wfeature and TBH, I'm more than concerned
about that kind of behaviour.

If we just revert that commit, then what do we achieve? We paper over the
underlying problem, which is not really helping anything.

Aside of that gold still fails to build the X32 VDSO and it does so for a
very long time....

Until we really understand what the problem is, this stays as is.

@H.J.: Any insight on that?

Thanks,

	tglx




  reply	other threads:[~2019-07-15 10:35 UTC|newest]

Thread overview: 32+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2019-06-19 18:40 [PATCH v3 0/2] x86: SME: Kexec/kdump memory loading fix Lendacky, Thomas
2019-06-19 18:40 ` [PATCH v3 1/2] x86/mm: Identify the end of the kernel area to be reserved Lendacky, Thomas
2019-06-20  9:58   ` [tip:x86/kdump] " tip-bot for Thomas Lendacky
2019-07-13 14:59   ` [PATCH v3 1/2] " Mike Lothian
2019-07-14 10:16     ` Thomas Gleixner
2019-07-14 10:27       ` Mike Lothian
2019-07-15  8:12         ` Thomas Gleixner
     [not found]           ` <CAHbf0-F9yUDJ=DKug+MZqsjW+zPgwWaLUC40BLOsr5+t4kYOLQ@mail.gmail.com>
2019-07-15  9:25             ` Thomas Gleixner
2019-07-15 10:35               ` Thomas Gleixner [this message]
2019-07-15 20:16                 ` H.J. Lu
2019-07-23 13:05                   ` Greg KH
2019-07-23 13:31                     ` Thomas Gleixner
2019-07-23 13:44                       ` Greg KH
2019-07-24 15:34                         ` Greg KH
2019-07-24 15:49                           ` Thomas Gleixner
2019-07-24 15:57                             ` Greg KH
2019-07-24 16:03                               ` Thomas Gleixner
2019-07-24 16:16                                 ` Greg KH
2019-07-24 20:02                                   ` Thomas Gleixner
2019-07-24 20:20                                     ` Thomas Gleixner
2019-07-25  6:24                                       ` Greg KH
2019-08-14 11:09                                         ` Mike Lothian
2019-08-19 12:53                                           ` Mike Lothian
2019-08-19 13:08                                             ` Thomas Gleixner
2019-08-19 13:21                                               ` Mike Lothian
2019-08-19 13:31                                                 ` Thomas Gleixner
2019-08-20 12:46                                                   ` Mike Lothian
2019-07-24 16:22                               ` Peter Zijlstra
2019-07-24 16:01                             ` Thomas Gleixner
2019-07-23 13:43                     ` Greg KH
2019-06-19 18:40 ` [PATCH v3 2/2] x86/mm: Create a workarea in the kernel for SME early encryption Lendacky, Thomas
2019-06-20  9:58   ` [tip:x86/kdump] " tip-bot for Thomas Lendacky

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=alpine.DEB.2.21.1907151140080.1669@nanos.tec.linutronix.de \
    --to=tglx@linutronix.de \
    --cc=bhe@redhat.com \
    --cc=bp@alien8.de \
    --cc=dave.hansen@linux.intel.com \
    --cc=hjl.tools@gmail.com \
    --cc=lijiang@redhat.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=luto@kernel.org \
    --cc=mike@fireburn.co.uk \
    --cc=mingo@redhat.com \
    --cc=peterz@infradead.org \
    --cc=thomas.lendacky@amd.com \
    --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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).