All of lore.kernel.org
 help / color / mirror / Atom feed
From: Thomas Gleixner <tglx@linutronix.de>
To: Andreas Larsson <andreas@gaisler.com>,
	sparclinux <sparclinux@vger.kernel.org>,
	linux-mm@kvack.org
Cc: "David S. Miller" <davem@davemloft.net>,
	Arnd Bergmann <arnd@arndb.de>,
	"linux-kernel\@vger.kernel.org" <linux-kernel@vger.kernel.org>,
	Sam Ravnborg <sam@ravnborg.org>
Subject: Re: sparc32: Init process fails to load with generic kmap atomic
Date: Wed, 23 Dec 2020 00:52:28 +0100	[thread overview]
Message-ID: <87v9ctcsar.fsf@nanos.tec.linutronix.de> (raw)
In-Reply-To: <c1dc2579-17b1-493b-ef23-0b9ed1ec13c3@gaisler.com>

On Tue, Dec 22 2020 at 18:58, Andreas Larsson wrote:
>  From as far as I have gotten into hunting down the problem, I get a
> failure from load_elf_binary here:
>
> 	/* First of all, some simple consistency checks */
> 	if (memcmp(elf_ex->e_ident, ELFMAG, SELFMAG) != 0)
> 		goto out;
>
> at least seemingly due to the kaddr from copy_page_to_iter in
> lib/iov_iter.c
>
> 	if (i->type & (ITER_BVEC|ITER_KVEC)) {
> 		void *kaddr = kmap_atomic(page);
> 		size_t wanted = copy_to_iter(kaddr + offset, bytes, i);
>
> where kaddr points to memory with all zeroes (from an earlier bzero) in 
> this context:

The kaddr might be misleading you here. If the code flow is:

    kaddr1 = kmap_atomic(page1);
    ...
    kunmap_atomic(kaddr1);

    kaddr2 = kmap_atomic(page2);

Then kaddr1 == kaddr2, but first it maps page1 and then page2, but that
was the same in the original code.

> I will have to continue to dig deeper into this in January. If anyone
> has any ideas how this could stem from this kmap patch, I am all ears.

I can't spot it either. I'll send you a debug patch after the holidays.

Thanks,

        tglx

WARNING: multiple messages have this Message-ID (diff)
From: Thomas Gleixner <tglx@linutronix.de>
To: Andreas Larsson <andreas@gaisler.com>,
	sparclinux <sparclinux@vger.kernel.org>,
	linux-mm@kvack.org
Cc: "David S. Miller" <davem@davemloft.net>,
	Arnd Bergmann <arnd@arndb.de>,
	"linux-kernel@vger.kernel.org" <linux-kernel@vger.kernel.org>,
	Sam Ravnborg <sam@ravnborg.org>
Subject: Re: sparc32: Init process fails to load with generic kmap atomic
Date: Tue, 22 Dec 2020 23:52:28 +0000	[thread overview]
Message-ID: <87v9ctcsar.fsf@nanos.tec.linutronix.de> (raw)
In-Reply-To: <c1dc2579-17b1-493b-ef23-0b9ed1ec13c3@gaisler.com>

On Tue, Dec 22 2020 at 18:58, Andreas Larsson wrote:
>  From as far as I have gotten into hunting down the problem, I get a
> failure from load_elf_binary here:
>
> 	/* First of all, some simple consistency checks */
> 	if (memcmp(elf_ex->e_ident, ELFMAG, SELFMAG) != 0)
> 		goto out;
>
> at least seemingly due to the kaddr from copy_page_to_iter in
> lib/iov_iter.c
>
> 	if (i->type & (ITER_BVEC|ITER_KVEC)) {
> 		void *kaddr = kmap_atomic(page);
> 		size_t wanted = copy_to_iter(kaddr + offset, bytes, i);
>
> where kaddr points to memory with all zeroes (from an earlier bzero) in 
> this context:

The kaddr might be misleading you here. If the code flow is:

    kaddr1 = kmap_atomic(page1);
    ...
    kunmap_atomic(kaddr1);

    kaddr2 = kmap_atomic(page2);

Then kaddr1 = kaddr2, but first it maps page1 and then page2, but that
was the same in the original code.

> I will have to continue to dig deeper into this in January. If anyone
> has any ideas how this could stem from this kmap patch, I am all ears.

I can't spot it either. I'll send you a debug patch after the holidays.

Thanks,

        tglx

  parent reply	other threads:[~2020-12-22 23:53 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-12-22 17:58 sparc32: Init process fails to load with generic kmap atomic Andreas Larsson
2020-12-22 17:58 ` Andreas Larsson
2020-12-22 20:13 ` Arnd Bergmann
2020-12-22 20:13   ` Arnd Bergmann
2020-12-22 20:13   ` Arnd Bergmann
2020-12-22 23:52 ` Thomas Gleixner [this message]
2020-12-22 23:52   ` Thomas Gleixner

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=87v9ctcsar.fsf@nanos.tec.linutronix.de \
    --to=tglx@linutronix.de \
    --cc=andreas@gaisler.com \
    --cc=arnd@arndb.de \
    --cc=davem@davemloft.net \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-mm@kvack.org \
    --cc=sam@ravnborg.org \
    --cc=sparclinux@vger.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.