xen-devel.lists.xenproject.org archive mirror
 help / color / mirror / Atom feed
From: Zhenzhong Duan <zhenzhong.duan@oracle.com>
To: Jan Beulich <JBeulich@suse.com>
Cc: Andrew Cooper <andrew.cooper3@citrix.com>,
	Xen-Devel <xen-devel@lists.xen.org>,
	manoj.gopalasetty@hpe.com, david.westwood@hpe.com,
	Boris Ostrovsky <boris.ostrovsky@oracle.com>,
	Srinivas REDDY Eeda <srinivas.eeda@oracle.com>
Subject: Re: [PATCH v2 2/2] x86/mmcfg/drhd: Move acpi_mmcfg_init() call before calling acpi_parse_dmar()
Date: Mon, 20 Aug 2018 11:38:30 +0800	[thread overview]
Message-ID: <a0b89642-abc8-5fe2-36b1-27dd9ca66c0a@oracle.com> (raw)
In-Reply-To: <5B76BF8902000078001DF69C@prv1-mh.provo.novell.com>

On 2018/8/17 20:28, Jan Beulich wrote:
>>>> On 17.08.18 at 09:01, <zhenzhong.duan@oracle.com> wrote:
>> pci_conf_read8() needs pci mmcfg mapping to work on multiple pci segments
>> system such as HPE Superdome-Flex.
>>
>> Move acpi_mmcfg_init() call in acpi_boot_init() before calling
>> acpi_parse_dmar() so that when pci_conf_read8() is called in
>> acpi_parse_dev_scope(), we already have the mapping set up.
>>
>> acpi_mmcfg_init() only setup mmcfg mapping and has some global variables
>> initialized so there is no hazard to move it ahead.
> 
> I'm afraid this is a gross understatement. "Setup mappings"
> alone is already putting such movement under question. Have
> you checked explicitly that the initialization needed for this
> setting up of mappings, if any, has actually occurred before
> the new point the function gets called?
> 
> In particular, mmio_ro_ranges looks to get set up only after
> the call to acpi_boot_init(). I guess you didn't see a crash
> solely because you also move the invocation across the call
> to zap_low_mappings().
> 
> Similary pci_mmcfg_check_hostbridge() doesn't look all that
> trivial.
> 
> Please may I ask that you be quite a bit more careful here,
> even more so when you've been warned already?
> 
>> Meanwhile from its
>> name, acpi_boot_init() is a proper place to call it.
>>
>> The alternative is moving the acpi_parse_dev_scope() call to a later point
>> after acpi_mmcfg_init(). But acpi_parse_one_drhd(), acpi_parse_one_rmrr()
>> and acpi_parse_one_atsr() all called acpi_parse_dev_scope() as their main
>> job. Splitting those functions to two pieces looks less optimal and
>> meaningless.
> 
> Certainly not meaningless; I'm also not sure why you consider
> the device scope parsing their main job. It's perhaps their
> most involved part, but the fact alone that for the purposes
> here we could probably get away without that part already
> suggests to me that this is a secondary (yet necessary) aspect.
> 
> Furthermore MMCFG will continue to not work this early (or
> more precisely not at all until Dom0 boot has progressed far
> enough) if the range(s) isn't/aren't marked reserved in E820.
> It would be worthwhile saying half a sentence to this effect
> in the description.
Jan,

I meet some difficulty moving dev scope parsing to later point. Please 
suggest.

First, acpi_parse_dev_scope() may fail and disable_all_dmar_units() is 
called to free all dmar related allocations which is already used by 
iommu_supports_eim().

Second, In acpi_parse_one_drhd(), acpi_register_drhd_unit() should not 
be moved later so that acpi_drhd_units is setup early, but it's called 
if pci_device_detect() return true, pci_device_detect() depends on mmcfg 
to work which isn't setup mapping yet.

I'm thinking about moving below piece of code earlier too, and I checked 
pci_mmcfg_check_hostbridge() carefully, it's secure, what do you think 
about that?

     mmio_ro_ranges = rangeset_new(NULL, "r/o mmio ranges",
                                   RANGESETF_prettyprint_hex);


Thanks
Zhenzhong

_______________________________________________
Xen-devel mailing list
Xen-devel@lists.xenproject.org
https://lists.xenproject.org/mailman/listinfo/xen-devel

  reply	other threads:[~2018-08-20  3:38 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2018-08-17  7:01 [PATCH v2 2/2] x86/mmcfg/drhd: Move acpi_mmcfg_init() call before calling acpi_parse_dmar() Zhenzhong Duan
2018-08-17 12:28 ` Jan Beulich
2018-08-20  3:38   ` Zhenzhong Duan [this message]
2018-08-20  7:45     ` Jan Beulich
2018-08-20  9:38       ` Zhenzhong Duan
2018-08-20 11:35         ` Jan Beulich
  -- strict thread matches above, loose matches on Subject: below --
2018-08-17 13:05 zhenzhong.duan

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=a0b89642-abc8-5fe2-36b1-27dd9ca66c0a@oracle.com \
    --to=zhenzhong.duan@oracle.com \
    --cc=JBeulich@suse.com \
    --cc=andrew.cooper3@citrix.com \
    --cc=boris.ostrovsky@oracle.com \
    --cc=david.westwood@hpe.com \
    --cc=manoj.gopalasetty@hpe.com \
    --cc=srinivas.eeda@oracle.com \
    --cc=xen-devel@lists.xen.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).