linux-mips.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Joshua Kinard <kumba@gentoo.org>
To: Linux/MIPS <linux-mips@vger.kernel.org>
Cc: Thomas Bogendoerfer <tsbogend@alpha.franken.de>,
	Huang Pei <huangpei@loongson.cn>
Subject: [RFC]: Maybe revert 'MIPS: add PMD table accounting into MIPS'pmd_alloc_one' from 5.4 LTS?
Date: Tue, 20 Jul 2021 20:45:45 -0400	[thread overview]
Message-ID: <370c2578-5032-08d6-9f48-c2f284a9b62d@gentoo.org> (raw)

(resend using the correct list address)

Hi all,

I think there may be an issue with upstream commit
ed914d48b6a1040d1039d371b56273d422c0081e (MIPS: add PMD table accounting
into MIPS'pmd_alloc_one), which got backported to 5.4 LTS.

I am running my SGI Octane on the 5.4 LTS kernel series w/ Gentoo's IP30
patches, since basic IP30 support didn't get fully mainlined until ~5.7 and
I am just behind on kernels for the time being.  Generally, the 5.4 series
is stable on this machine, but as of using 5.4.133 yesterday and 5.4.134
today, I have had three kernel panics, all with completely different stack
traces, while building a multilib-enabled glibc-2.33 package.

Since the stack traces are all completely different, I am suspecting an
issue with memory allocation, which picking through the 5.4.133 changelog,
got me to look at commit ed914d48b6a1.  My initial thought is it looks like
this patch should not have been backported to 5.4, because 5.4 is missing
the asm-generic version of pmd_free(), which means the MIPS-specific version
is likely used instead, and that function was not updated alongside
pmd_alloc_one().

Now, I am not a memory person, but some quick reading indicates there may be
some other issues with this patch as well:

- use of 'GFP_KERNEL | __GFP_ACCOUNT' when there is GFP_KERNEL_ACCOUNT
available.

- the return value of pgtable_pmd_page_ctor(pg); is not checked to make sure
it succeeded.  Per Documentation/vm/split_page_table_lock, "NOTE:
pgtable_page_ctor() and pgtable_pmd_page_ctor() can fail -- it must
be handled properly."

- there is no call to pgtable_pmd_page_dtor() in pmd_free() in MIPS'
pgalloc.  The commit message indicates that pmd_free in asm-generic will
handle this, but that function doesn't exist in 5.4, leading to mismatched
implementations.

I think the fix is to either revert ed914d48b6a1 on the 5.4 stable series
(and any earlier series that are missing asm-generic pmd_free), or the MIPS
pmd_free() needs to be updated to call pgtable_pmd_page_dtor() in a similar
manner to x86 and arm64.  I'd opt for reverting.

Currently testing a build of 5.4.134 with this patch reverted running some
compile jobs.  If it survives building multilib glibc, then I think my
suspicions may be valid.

-- 
Joshua Kinard
Gentoo/MIPS
kumba@gentoo.org
rsa6144/5C63F4E3F5C6C943 2015-04-27
177C 1972 1FB8 F254 BAD0 3E72 5C63 F4E3 F5C6 C943

"The past tempts us, the present confuses us, the future frightens us.  And
our lives slip away, moment by moment, lost in that vast, terrible in-between."

--Emperor Turhan, Centauri Republic


             reply	other threads:[~2021-07-21  0:45 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-07-21  0:45 Joshua Kinard [this message]
2021-07-21  2:11 ` [RFC]: Maybe revert 'MIPS: add PMD table accounting into MIPS'pmd_alloc_one' from 5.4 LTS? Huang Pei
2021-07-24 23:22   ` Joshua Kinard
2021-07-26  1:51     ` loongson

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=370c2578-5032-08d6-9f48-c2f284a9b62d@gentoo.org \
    --to=kumba@gentoo.org \
    --cc=huangpei@loongson.cn \
    --cc=linux-mips@vger.kernel.org \
    --cc=tsbogend@alpha.franken.de \
    /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).