All of lore.kernel.org
 help / color / mirror / Atom feed
From: "Michael S. Tsirkin" <mst@redhat.com>
To: Peter Maydell <peter.maydell@linaro.org>
Cc: "Philippe Mathieu-Daudé" <philmd@redhat.com>,
	"QEMU Developers" <qemu-devel@nongnu.org>,
	"Andrew Baumann" <Andrew.Baumann@microsoft.com>,
	"Aurelien Jarno" <aurelien@aurel32.net>,
	kvm-devel <kvm@vger.kernel.org>,
	"Alex Williamson" <alex.williamson@redhat.com>,
	"Aleksandar Markovic" <amarkovic@wavecomp.com>,
	"Joel Stanley" <joel@jms.id.au>, qemu-arm <qemu-arm@nongnu.org>,
	"Marcelo Tosatti" <mtosatti@redhat.com>,
	"Alistair Francis" <alistair@alistair23.me>,
	"Eduardo Habkost" <ehabkost@redhat.com>,
	"Richard Henderson" <rth@twiddle.net>,
	"Aleksandar Rikalo" <aleksandar.rikalo@rt-rk.com>,
	"Paul Burton" <pburton@wavecomp.com>,
	"Marcel Apfelbaum" <marcel.apfelbaum@gmail.com>,
	"Edgar E. Iglesias" <edgar.iglesias@gmail.com>,
	"Paolo Bonzini" <pbonzini@redhat.com>
Subject: Re: [PATCH 0/8] Simplify memory_region_add_subregion_overlap(..., priority=0)
Date: Mon, 16 Dec 2019 06:39:56 -0500	[thread overview]
Message-ID: <20191216063529-mutt-send-email-mst@kernel.org> (raw)
In-Reply-To: <CAFEAcA9ZF3VTR7kG_D-cJ+vPFTgd8zjmt2VPfJC7urNemF-5AQ@mail.gmail.com>

On Sun, Dec 15, 2019 at 03:27:12PM +0000, Peter Maydell wrote:
> On Sun, 15 Dec 2019 at 09:51, Michael S. Tsirkin <mst@redhat.com> wrote:
> >
> > On Sat, Dec 14, 2019 at 04:28:08PM +0000, Peter Maydell wrote:
> > > (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.)
> >
> > It's not exactly legacy uses.
> >
> > To be more exact, the way the non overlap versions
> > are *used* is to mean "I don't care what happens when they overlap"
> > as opposed to "will never overlap".
> 
> Almost all of the use of the non-overlap versions is
> for "these are never going to overlap" -- devices or ram at
> fixed addresses in the address space that can't
> ever be mapped over by anything else. If you want
> "can overlap but I don't care which one wins" then
> that would be more clearly expressed by using the _overlap()
> version but just giving everything that can overlap there
> the same priority.

Problem is device doesn't always know whether something can overlap it.
Imagine device A at a fixed address.
Guest can program device B to overlap the fixed address.
How is device A supposed to know this can happen?



> > There are lots of regions where guest can make things overlapping
> > but doesn't, e.g. PCI BARs can be programmed to overlap
> > almost anything.
> >
> > What happens on real hardware if you then access one of
> > the BARs is undefined, but programming itself is harmless.
> > That's why we can't assert.
> 
> Yeah, good point, for the special case where it's the
> guest that's determining the addresses where something's
> mapped we might want to allow the behaviour to fall out
> of the implementation. (You could instead specify set of
> priorities that makes the undefined-behaviour something
> specific, rather than just an emergent property of
> the implementation QEMU happens to have, but it seems
> a bit hard to justify.)
> 
> thanks
> -- PMM

WARNING: multiple messages have this Message-ID (diff)
From: "Michael S. Tsirkin" <mst@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>,
	"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>,
	"Philippe Mathieu-Daudé" <philmd@redhat.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: Mon, 16 Dec 2019 06:39:56 -0500	[thread overview]
Message-ID: <20191216063529-mutt-send-email-mst@kernel.org> (raw)
In-Reply-To: <CAFEAcA9ZF3VTR7kG_D-cJ+vPFTgd8zjmt2VPfJC7urNemF-5AQ@mail.gmail.com>

On Sun, Dec 15, 2019 at 03:27:12PM +0000, Peter Maydell wrote:
> On Sun, 15 Dec 2019 at 09:51, Michael S. Tsirkin <mst@redhat.com> wrote:
> >
> > On Sat, Dec 14, 2019 at 04:28:08PM +0000, Peter Maydell wrote:
> > > (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.)
> >
> > It's not exactly legacy uses.
> >
> > To be more exact, the way the non overlap versions
> > are *used* is to mean "I don't care what happens when they overlap"
> > as opposed to "will never overlap".
> 
> Almost all of the use of the non-overlap versions is
> for "these are never going to overlap" -- devices or ram at
> fixed addresses in the address space that can't
> ever be mapped over by anything else. If you want
> "can overlap but I don't care which one wins" then
> that would be more clearly expressed by using the _overlap()
> version but just giving everything that can overlap there
> the same priority.

Problem is device doesn't always know whether something can overlap it.
Imagine device A at a fixed address.
Guest can program device B to overlap the fixed address.
How is device A supposed to know this can happen?



> > There are lots of regions where guest can make things overlapping
> > but doesn't, e.g. PCI BARs can be programmed to overlap
> > almost anything.
> >
> > What happens on real hardware if you then access one of
> > the BARs is undefined, but programming itself is harmless.
> > That's why we can't assert.
> 
> Yeah, good point, for the special case where it's the
> guest that's determining the addresses where something's
> mapped we might want to allow the behaviour to fall out
> of the implementation. (You could instead specify set of
> priorities that makes the undefined-behaviour something
> specific, rather than just an emergent property of
> the implementation QEMU happens to have, but it seems
> a bit hard to justify.)
> 
> thanks
> -- PMM



  reply	other threads:[~2019-12-16 11:40 UTC|newest]

Thread overview: 34+ 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 ` 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   ` Philippe Mathieu-Daudé
2019-12-14 15:56 ` [PATCH 2/8] hw/arm/raspi: " Philippe Mathieu-Daudé
2019-12-14 15:56   ` Philippe Mathieu-Daudé
2019-12-14 15:56 ` [PATCH 3/8] hw/arm/xlnx-versal: " Philippe Mathieu-Daudé
2019-12-14 15:56   ` 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   ` 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   ` Philippe Mathieu-Daudé
2019-12-14 15:56 ` [PATCH 6/8] hw/vfio/pci: " Philippe Mathieu-Daudé
2019-12-14 15:56   ` Philippe Mathieu-Daudé
2019-12-14 15:56 ` [PATCH 7/8] target/i386: " Philippe Mathieu-Daudé
2019-12-14 15:56   ` 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 15:56   ` Philippe Mathieu-Daudé
2019-12-14 16:28 ` [PATCH 0/8] Simplify memory_region_add_subregion_overlap(..., priority=0) Peter Maydell
2019-12-14 16:28   ` Peter Maydell
2019-12-14 18:17   ` Philippe Mathieu-Daudé
2019-12-14 18:17     ` Philippe Mathieu-Daudé
2019-12-14 20:01     ` Peter Maydell
2019-12-14 20:01       ` Peter Maydell
2019-12-15  9:54       ` Michael S. Tsirkin
2019-12-15  9:54         ` Michael S. Tsirkin
2019-12-15  9:51   ` Michael S. Tsirkin
2019-12-15  9:51     ` Michael S. Tsirkin
2019-12-15 15:27     ` Peter Maydell
2019-12-15 15:27       ` Peter Maydell
2019-12-16 11:39       ` Michael S. Tsirkin [this message]
2019-12-16 11:39         ` Michael S. Tsirkin
2019-12-16 11:46         ` Peter Maydell
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=20191216063529-mutt-send-email-mst@kernel.org \
    --to=mst@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=marcel.apfelbaum@gmail.com \
    --cc=mtosatti@redhat.com \
    --cc=pbonzini@redhat.com \
    --cc=pburton@wavecomp.com \
    --cc=peter.maydell@linaro.org \
    --cc=philmd@redhat.com \
    --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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.