qemu-devel.nongnu.org archive mirror
 help / color / mirror / Atom feed
From: "Philippe Mathieu-Daudé" <philmd@redhat.com>
To: Peter Maydell <peter.maydell@linaro.org>
Cc: Paul Burton <pburton@wavecomp.com>,
	Alistair Francis <alistair@alistair23.me>,
	Eduardo Habkost <ehabkost@redhat.com>,
	kvm-devel <kvm@vger.kernel.org>,
	"Michael S. Tsirkin" <mst@redhat.com>,
	Marcelo Tosatti <mtosatti@redhat.com>,
	QEMU Developers <qemu-devel@nongnu.org>,
	Andrew Baumann <Andrew.Baumann@microsoft.com>,
	Alex Williamson <alex.williamson@redhat.com>,
	qemu-arm <qemu-arm@nongnu.org>, Joel Stanley <joel@jms.id.au>,
	Aleksandar Markovic <amarkovic@wavecomp.com>,
	Paolo Bonzini <pbonzini@redhat.com>,
	"Edgar E. Iglesias" <edgar.iglesias@gmail.com>,
	Aleksandar Rikalo <aleksandar.rikalo@rt-rk.com>,
	Aurelien Jarno <aurelien@aurel32.net>,
	Richard Henderson <rth@twiddle.net>
Subject: Re: [PATCH 0/8] Simplify memory_region_add_subregion_overlap(..., priority=0)
Date: Sat, 14 Dec 2019 19:17:23 +0100	[thread overview]
Message-ID: <31acb07b-a61b-1bc4-ee6e-faa511745a61@redhat.com> (raw)
In-Reply-To: <CAFEAcA_QZtU9X4fxZk2oWAkN-zxXdQZejrSKZbDxPKLMwdFWgw@mail.gmail.com>

On 12/14/19 5:28 PM, Peter Maydell wrote:
> On Sat, 14 Dec 2019 at 15:56, Philippe Mathieu-Daudé <philmd@redhat.com> wrote:
>>
>> Hi,
>>
>> In this series we use coccinelle to replace:
>> - memory_region_add_subregion_overlap(..., priority=0)
>> + memory_region_add_subregion(...)
>>
>> Rationale is the code is easier to read, and reviewers don't
>> have to worry about overlapping because it isn't used.
> 
> So our implementation of these two functions makes them
> have the same behaviour, but the documentation comments
> in memory.h describe them as different: a subregion added
> with memory_region_add_subregion() is not supposed to
> overlap any other subregion unless that other subregion
> was explicitly marked as overlapping. My intention with the
> API design here was that using the _overlap() version is
> a statement of intent -- this region is *expected* to be
> overlapping with some other regions, which hopefully
> have a priority set so they go at the right order wrt this one.

I didn't notice the documentation differences, now it is clear.

> Use of the non-overlap function says "I don't expect this
> to overlap". (It doesn't actually assert that it doesn't
> overlap because we have some legacy uses, notably
> in the x86 PC machines, which do overlap without using
> the right function, which we've never tried to tidy up.)
> 
> We used to have some #if-ed out code in memory.c which
> was able to detect incorrect overlap, but it got removed
> in commit b613597819587. I thought then and still do
> that rather than removing code and API distinctions that
> allow us to tell if the board code has done something
> wrong (unintentional overlap, especially unintentional
> overlap at the same priority value) it would be better to
> fix the board bugs so we could enable the warnings/asserts...

Maybe we can a warning if priority=0, to force board designers to use 
explicit priority (explicit overlap).



  reply	other threads:[~2019-12-14 21:20 UTC|newest]

Thread overview: 17+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2019-12-14 15:56 [PATCH 0/8] Simplify memory_region_add_subregion_overlap(..., priority=0) Philippe Mathieu-Daudé
2019-12-14 15:56 ` [PATCH 1/8] hw/arm/nrf51_soc: Use memory_region_add_subregion() when priority is 0 Philippe Mathieu-Daudé
2019-12-14 15:56 ` [PATCH 2/8] hw/arm/raspi: " Philippe Mathieu-Daudé
2019-12-14 15:56 ` [PATCH 3/8] hw/arm/xlnx-versal: " Philippe Mathieu-Daudé
2019-12-14 15:56 ` [PATCH 4/8] hw/i386/intel_iommu: Use memory_region_add_subregion " Philippe Mathieu-Daudé
2019-12-14 15:56 ` [PATCH 5/8] hw/mips/boston: Use memory_region_add_subregion() " Philippe Mathieu-Daudé
2019-12-14 15:56 ` [PATCH 6/8] hw/vfio/pci: " Philippe Mathieu-Daudé
2019-12-14 15:56 ` [PATCH 7/8] target/i386: " Philippe Mathieu-Daudé
2019-12-14 15:56 ` [PATCH 8/8] target/i386/cpu: Use 'mr' for MemoryRegion variables Philippe Mathieu-Daudé
2019-12-14 16:28 ` [PATCH 0/8] Simplify memory_region_add_subregion_overlap(..., priority=0) Peter Maydell
2019-12-14 18:17   ` Philippe Mathieu-Daudé [this message]
2019-12-14 20:01     ` Peter Maydell
2019-12-15  9:54       ` Michael S. Tsirkin
2019-12-15  9:51   ` Michael S. Tsirkin
2019-12-15 15:27     ` Peter Maydell
2019-12-16 11:39       ` Michael S. Tsirkin
2019-12-16 11:46         ` Peter Maydell

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=31acb07b-a61b-1bc4-ee6e-faa511745a61@redhat.com \
    --to=philmd@redhat.com \
    --cc=Andrew.Baumann@microsoft.com \
    --cc=aleksandar.rikalo@rt-rk.com \
    --cc=alex.williamson@redhat.com \
    --cc=alistair@alistair23.me \
    --cc=amarkovic@wavecomp.com \
    --cc=aurelien@aurel32.net \
    --cc=edgar.iglesias@gmail.com \
    --cc=ehabkost@redhat.com \
    --cc=joel@jms.id.au \
    --cc=kvm@vger.kernel.org \
    --cc=mst@redhat.com \
    --cc=mtosatti@redhat.com \
    --cc=pbonzini@redhat.com \
    --cc=pburton@wavecomp.com \
    --cc=peter.maydell@linaro.org \
    --cc=qemu-arm@nongnu.org \
    --cc=qemu-devel@nongnu.org \
    --cc=rth@twiddle.net \
    /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).