linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Ingo Molnar <mingo@kernel.org>
To: Yinghai Lu <yinghai@kernel.org>
Cc: hpa@zytor.com, linux-kernel@vger.kernel.org, jacob.shin@amd.com,
	tglx@linutronix.de, trini@ti.com, hpa@linux.intel.com,
	linux-tip-commits@vger.kernel.org
Subject: Re: [tip:x86/urgent] x86, mm: Find_early_table_space based on ranges that are actually being mapped
Date: Thu, 25 Oct 2012 09:55:08 +0200	[thread overview]
Message-ID: <20121025075508.GD3712@gmail.com> (raw)
In-Reply-To: <CAE9FiQX0MvxAsZKFwH50joR5qz1oGhbXz+BD9W-QC_BrD9zKFQ@mail.gmail.com>


* Yinghai Lu <yinghai@kernel.org> wrote:

> On Wed, Oct 24, 2012 at 2:49 PM, tip-bot for Jacob Shin
> <jacob.shin@amd.com> wrote:
> > Commit-ID:  844ab6f993b1d32eb40512503d35ff6ad0c57030
> > Gitweb:     http://git.kernel.org/tip/844ab6f993b1d32eb40512503d35ff6ad0c57030
> > Author:     Jacob Shin <jacob.shin@amd.com>
> > AuthorDate: Wed, 24 Oct 2012 14:24:44 -0500
> > Committer:  H. Peter Anvin <hpa@linux.intel.com>
> > CommitDate: Wed, 24 Oct 2012 13:37:04 -0700
> >
> > x86, mm: Find_early_table_space based on ranges that are actually being mapped
> >
> > Current logic finds enough space for direct mapping page tables from 0
> > to end. Instead, we only need to find enough space to cover mr[0].start
> > to mr[nr_range].end -- the range that is actually being mapped by
> > init_memory_mapping()
> >
> > This is needed after 1bbbbe779aabe1f0768c2bf8f8c0a5583679b54a, to address
> > the panic reported here:
> >
> >   https://lkml.org/lkml/2012/10/20/160
> >   https://lkml.org/lkml/2012/10/21/157
> >
> > Signed-off-by: Jacob Shin <jacob.shin@amd.com>
> > Link: http://lkml.kernel.org/r/20121024195311.GB11779@jshin-Toonie
> > Tested-by: Tom Rini <trini@ti.com>
> > Signed-off-by: H. Peter Anvin <hpa@linux.intel.com>
> > ---
> >  arch/x86/mm/init.c |   70 ++++++++++++++++++++++++++++++---------------------
> >  1 files changed, 41 insertions(+), 29 deletions(-)
> >
> > diff --git a/arch/x86/mm/init.c b/arch/x86/mm/init.c
> > index 8653b3a..bc287d6 100644
> > --- a/arch/x86/mm/init.c
> > +++ b/arch/x86/mm/init.c
> > @@ -29,36 +29,54 @@ int direct_gbpages
> >  #endif
> >  ;
> >
> > -static void __init find_early_table_space(unsigned long end, int use_pse,
> > -                                         int use_gbpages)
> > +struct map_range {
> > +       unsigned long start;
> > +       unsigned long end;
> > +       unsigned page_size_mask;
> > +};
> > +
> > +/*
> > + * First calculate space needed for kernel direct mapping page tables to cover
> > + * mr[0].start to mr[nr_range - 1].end, while accounting for possible 2M and 1GB
> > + * pages. Then find enough contiguous space for those page tables.
> > + */
> > +static void __init find_early_table_space(struct map_range *mr, int nr_range)
> >  {
> > -       unsigned long puds, pmds, ptes, tables, start = 0, good_end = end;
> > +       int i;
> > +       unsigned long puds = 0, pmds = 0, ptes = 0, tables;
> > +       unsigned long start = 0, good_end;
> >         phys_addr_t base;
> >
> > -       puds = (end + PUD_SIZE - 1) >> PUD_SHIFT;
> > -       tables = roundup(puds * sizeof(pud_t), PAGE_SIZE);
> > +       for (i = 0; i < nr_range; i++) {
> > +               unsigned long range, extra;
> >
> > -       if (use_gbpages) {
> > -               unsigned long extra;
> > +               range = mr[i].end - mr[i].start;
> > +               puds += (range + PUD_SIZE - 1) >> PUD_SHIFT;
> >
> > -               extra = end - ((end>>PUD_SHIFT) << PUD_SHIFT);
> > -               pmds = (extra + PMD_SIZE - 1) >> PMD_SHIFT;
> > -       } else
> > -               pmds = (end + PMD_SIZE - 1) >> PMD_SHIFT;
> > -
> > -       tables += roundup(pmds * sizeof(pmd_t), PAGE_SIZE);
> > +               if (mr[i].page_size_mask & (1 << PG_LEVEL_1G)) {
> > +                       extra = range - ((range >> PUD_SHIFT) << PUD_SHIFT);
> > +                       pmds += (extra + PMD_SIZE - 1) >> PMD_SHIFT;
> > +               } else {
> > +                       pmds += (range + PMD_SIZE - 1) >> PMD_SHIFT;
> > +               }
> >
> > -       if (use_pse) {
> > -               unsigned long extra;
> > -
> > -               extra = end - ((end>>PMD_SHIFT) << PMD_SHIFT);
> > +               if (mr[i].page_size_mask & (1 << PG_LEVEL_2M)) {
> > +                       extra = range - ((range >> PMD_SHIFT) << PMD_SHIFT);
> >  #ifdef CONFIG_X86_32
> > -               extra += PMD_SIZE;
> > +                       extra += PMD_SIZE;
> >  #endif
> > -               ptes = (extra + PAGE_SIZE - 1) >> PAGE_SHIFT;
> > -       } else
> > -               ptes = (end + PAGE_SIZE - 1) >> PAGE_SHIFT;
> > +                       /* The first 2/4M doesn't use large pages. */
> > +                       if (mr[i].start < PMD_SIZE)
> > +                               extra += range;
> 
> those three lines should be added back.
> 
> it just get reverted in 7b16bbf9

Could you please send a delta patch against tip:x86/urgent?

Thanks,

	Ingo

  reply	other threads:[~2012-10-25  7:55 UTC|newest]

Thread overview: 31+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
     [not found] <903a3ead-98b5-4afa-88a4-3dc723895e82@blur>
     [not found] ` <d556fc0f-da5d-4531-b331-6dc086461f34@blur>
2012-10-21  0:17   ` BUG: 1bbbbe7 (x86: Exclude E820_RESERVED regions...) PANIC on boot Tom Rini
2012-10-21  4:01     ` Yinghai Lu
2012-10-21  4:18       ` Jacob Shin
2012-10-21 17:51         ` Tom Rini
2012-10-21 21:06           ` Jacob Shin
2012-10-21 21:23             ` Tom Rini
2012-10-22 14:40               ` Jacob Shin
2012-10-22 18:05                 ` Yinghai Lu
2012-10-22 18:38                   ` Jacob Shin
2012-10-22 19:46                     ` Yinghai Lu
2012-10-22 20:26                       ` H. Peter Anvin
2012-10-22 20:50                         ` Yinghai Lu
2012-10-22 20:52                           ` H. Peter Anvin
2012-10-22 21:25                             ` Yinghai Lu
2012-10-22 21:27                               ` H. Peter Anvin
2012-10-22 23:35                                 ` Yinghai Lu
2012-10-24 16:48                                   ` Jacob Shin
2012-10-24 18:53                                     ` H. Peter Anvin
2012-10-24 19:53                                       ` Jacob Shin
2012-10-24 21:49                                         ` [tip:x86/urgent] x86, mm: Find_early_table_space based on ranges that are actually being mapped tip-bot for Jacob Shin
2012-10-25  6:42                                           ` Yinghai Lu
2012-10-25  7:55                                             ` Ingo Molnar [this message]
2012-10-25 14:33                                               ` Yinghai Lu
2012-10-25 22:23                                                 ` Jacob Shin
2012-10-25 23:31                                                 ` [tip:x86/urgent] x86, mm: Undo incorrect revert in arch/x86/mm/ init.c tip-bot for Yinghai Lu
2012-10-24 19:01                                   ` [tip:x86/urgent] x86, mm: Trim memory in memblock to be page aligned tip-bot for Yinghai Lu
2012-10-24 19:02                                   ` [tip:x86/urgent] x86, mm: Use memblock memory loop instead of e820_RAM tip-bot for Yinghai Lu
2012-10-22 21:00                           ` BUG: 1bbbbe7 (x86: Exclude E820_RESERVED regions...) PANIC on boot H. Peter Anvin
2012-10-22 21:06                             ` Yinghai Lu
2012-10-28 20:48                 ` Tom Rini
2012-10-21 17:52       ` Tom Rini

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=20121025075508.GD3712@gmail.com \
    --to=mingo@kernel.org \
    --cc=hpa@linux.intel.com \
    --cc=hpa@zytor.com \
    --cc=jacob.shin@amd.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-tip-commits@vger.kernel.org \
    --cc=tglx@linutronix.de \
    --cc=trini@ti.com \
    --cc=yinghai@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).