mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: "Yinghai Lu" <yhlu.kernel@gmail.com>
To: "Ingo Molnar" <mingo@elte.hu>
Cc: "Thomas Gleixner" <tglx@linutronix.de>,
	"H. Peter Anvin" <hpa@zytor.com>,
	"Andrew Morton" <akpm@linux-foundation.org>,
	"Jesse Barnes" <jbarnes@virtuousgeek.org>,
	"Linus Torvalds" <torvalds@linux-foundation.org>,
	linux-kernel@vger.kernel.org
Subject: Re: [PATCH] x86: split e820 reserved entries record to late v4
Date: Thu, 28 Aug 2008 23:47:14 -0700	[thread overview]
Message-ID: <86802c440808282347n66a6dfb7r2bebd9f65918614a@mail.gmail.com> (raw)
In-Reply-To: <20080829063012.GA19459@elte.hu>

On Thu, Aug 28, 2008 at 11:30 PM, Ingo Molnar <mingo@elte.hu> wrote:
>
> * Yinghai Lu <yhlu.kernel@gmail.com> wrote:
>
>> Linus said we should register some entries in e820 later,
>> so could let BAR res register at first, or even pnp?
>>
>> this one replace
>> | commit a2bd7274b47124d2fc4dfdb8c0591f545ba749dd
>> | Author: Yinghai Lu <yhlu.kernel@gmail.com>
>> | Date:   Mon Aug 25 00:56:08 2008 -0700
>> |
>> |    x86: fix HPET regression in 2.6.26 versus 2.6.25, check hpet against BAR, v3
>>
>> v2: insert e820 reserve resources before pnp_system_init
>> v3: fix merging problem in tip/x86/core
>>     please drop the one in tip/x86/core use this one instead
>> v4: address Linus's review about comments and condition in _late()
>>
>> Signed-off-by: Yinghai Lu <yhlu.kernel@gmail.com>
>
> applied to tip/x86/core, thanks.
>
> Let me outline the issue that i raised before:
>
>> +               if (!res->parent && res->end)
>> +                       insert_resource(&iomem_resource, res);
>
> what if this insertion fails due to partial overlap? Right now we drop
> it silently - which might be fine for most systems, but have a look on
> the specific system that had the hpet regression, there we have these
> reserved e820 entries:
>
>  BIOS-e820: 0000000077ff0000 - 0000000078000000 (reserved)
>  BIOS-e820: 00000000e0000000 - 00000000f0000000 (reserved)
>  BIOS-e820: 00000000fec00000 - 0000000100000000 (reserved)
>
> which overlaps with the chipset PCI BAR (hpet) resource:
>
>   pci 0000:00:14.0: BAR has HPET at fed00000-fed003ff
>
> so due to this 1K conflict we take the full e820-reserved entry out and
> give the range 0xfec00000-0x100000000 as 'free'.

you will get
fec00000 - ffffffff reserved
   fed0000 - fed003ff hpet
     fed0000 - fed003ff 0000:00:14.0

>
> And that failure to register can cause problems. In this case that
> 'reserved' e820 entry definitely has real meaning, both the local APIC
> and the IO-APIC is in that range:
>
>   ACPI: Local APIC address 0xfee00000
>   IOAPIC[0]: apic_id 2, version 0, address 0xfec00000, GSI 0-23
>
> Which might still be OK for all memory resources we happen to enumerate
> - but we dont necessarily enumerate all of them when we have e.g. an UP
> kernel, and we will definitely not enumerate any 'hidden' state a system
> might have there. (SMM, etc.) If we then allocate a dynamic PCI resource
> into that range later on (thinking it's "free" but in reality it's
> claimed) we get a crash or worse.
>
> So my worry, which i outlined before and which Peter agreed with, was
> that we should not mark areas 'free' that the BIOS thinks are
> 'reserved'. According to the map above, the BIOS declared non-RAM 'free'
> range in the first 4GB is 0x78000000..0xe0000000 - 1664 MB, plenty of
> space.

for the pci gap use?
e820_setup_gap will check e820_map directly to use that range as pci
gap for unassigned resources.

>
> The solution would be to insert such conflicting (even if partially
> overlapping)
>
> Also, a small code structure comment:
>
>> +             if (e820.map[i].type != E820_RESERVED || res->start < (1ULL<<20))
>> +                     insert_resource(&iomem_resource, res);
>
> this still needs a comment that we deal with resources that start below
> 1MB in a special way and insert them early.
>
> Perhaps split it out into a e820_entry_trusted() function and use that
> as a condition in both the early and the late logic. [plus the check for
> ->end in the late logic - that should be outside of the 'trust'
> definition]
>
> So whenever we tweak the definition of 'trust', we only have to do it in
> a single place. Agreed?

yes

YH

  reply	other threads:[~2008-08-29  6:47 UTC|newest]

Thread overview: 13+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2008-08-29  1:29 Yinghai Lu
2008-08-29  6:30 ` Ingo Molnar
2008-08-29  6:47   ` Yinghai Lu [this message]
2008-08-29  6:58     ` Ingo Molnar
2008-08-29  7:16       ` Yinghai Lu
2008-08-29  7:28         ` Ingo Molnar
2008-08-29  7:52           ` Yinghai Lu
2008-08-29 15:31       ` Linus Torvalds
2008-08-29 15:26   ` Linus Torvalds
2008-09-06 17:55     ` Ingo Molnar
2008-08-30  7:58 [PATCH] x86: unify using pci_mmcfg_insert_resource Yinghai Lu
2008-08-30  7:58 ` [PATCH] x86: split e820 reserved entries record to late v4 Yinghai Lu
2008-08-30 20:36 Yinghai Lu
2008-08-31  2:18 ` Yinghai Lu

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=86802c440808282347n66a6dfb7r2bebd9f65918614a@mail.gmail.com \
    --to=yhlu.kernel@gmail.com \
    --cc=akpm@linux-foundation.org \
    --cc=hpa@zytor.com \
    --cc=jbarnes@virtuousgeek.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=mingo@elte.hu \
    --cc=tglx@linutronix.de \
    --cc=torvalds@linux-foundation.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

all inboxes | Powered by JetHome®