public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
From: David Vrabel <david.vrabel@citrix.com>
To: Anthony Liguori <anthony@codemonkey.ws>
Cc: "Matt Wilson" <msw@linux.com>,
	"Roger Pau Monné" <roger.pau@citrix.com>,
	"Ian Campbell" <Ian.Campbell@citrix.com>,
	linux-kernel@vger.kernel.org, xen-devel@lists.xen.org,
	"David Vrabel" <david.vrabel@citrix.com>,
	"Matt Wilson" <msw@amazon.com>
Subject: Re: [Xen-devel] [PATCH] grant-table: don't set m2p override if	kmap_ops is not set
Date: Wed, 6 Nov 2013 11:34:27 +0000	[thread overview]
Message-ID: <527A2943.7050400@citrix.com> (raw)
In-Reply-To: <878ux2vade.fsf@codemonkey.ws>

On 05/11/13 20:53, Anthony Liguori wrote:
> Matt Wilson <msw@linux.com> writes:
> 
>> On Tue, Nov 05, 2013 at 05:03:58PM +0100, Roger Pau Monné wrote:
>>> On 05/11/13 16:08, Ian Campbell wrote:
>>>> On Tue, 2013-11-05 at 16:01 +0100, Roger Pau Monné wrote:
>>>>> On 05/11/13 15:56, Konrad Rzeszutek Wilk wrote:
>>>>>> On Tue, Nov 05, 2013 at 03:47:08PM +0100, Roger Pau Monné wrote:
>>>>>>> On 05/11/13 13:36, David Vrabel wrote:
>>>>>>>> On 05/11/13 11:24, Roger Pau Monne wrote:
>>>>>>>>> IMHO there's no reason to set a m2p override if the mapping is done in
>>>>>>>>> kernel space, so only set the m2p override when kmap_ops is set.
>>>>>>>>
>>>>>>>> Can you provide a more detailed reasoning about why this is safe?
>>>>>>>
>>>>>>> To tell the truth, I don't understand why we need to use the m2p
>>>>>>> override for kernel space only mappings, my understanding is that this
>>>>>>> m2p override is needed for user space mappings only (where we actually
>>>>>>> end up doing two mappings, one in kernel space and one in user space).
>>>>>>> For kernel space I don't see why we need to do anything else than
>>>>>>> setting the right p2m translation.
>>>>>>
>>>>>> We needed the m2p when doing DMA operations. As the driver would
>>>>>> want the bus address (so p2m) and then when unmapping the DMA we
>>>>>> only get the bus address  - so we needed to do a m2p lookup.

No. A m2p lookup should not be needed for DMA unmap.

We only need the p2m lookup on DMA map to get the bus address -- there's
should be nothing to do on the unmap.

However, there is dma_mark_clean(phys_to_virt(phys), size) call in
xen_unmap_single() which would require the m2p lookup but this call is
not necessary as dma_mark_clean() is a no-op for anything except ia64
and we do not care about ia64.

>>>>> OK, we need a m2p (that we already have in machine_to_phys_mapping),
>>>>> what I don't understand is why we need the m2p override.
>>>>
>>>> The m2p is a host global table.
>>>>
>>>> For a foreign page grant mapped into the current domain the m2p will
>>>> give you the foreign (owner) domain's p from the m, not the local one.
>>>
>>> Yes, you are completely right, then I have to figure out why blkback
>>> works fine with this patch applied (or at least it seems to work fine).
>>
>> blkback also works for me when testing a similar patch. I'm still
>> confused. One thing with your proposed patch: I'm not sure that you're
>> putting back the correct mfn.

Matt, Anthony, I presume you have profiling results or performance data
that support this proposed change?  Can you provide them?

> It's perfectly fine to store a foreign pfn in the m2p table.  The m2p
> override table is used by the grant device to allow a reverse lookup of
> the real mfn to a pfn even if it's foreign.
> 
> blkback doesn't actually need this though.  This was introduced in:
> 
> commit 5dc03639cc903f887931831d69895facb5260f4b
> Author: Konrad Rzeszutek Wilk <konrad.wilk@oracle.com>
> Date:   Tue Mar 1 16:46:45 2011 -0500
> 
>     xen/blkback: Utilize the M2P override mechanism for GNTMAP_host_map
> 
> Purely as an optimization.  In practice though due to lock contention it
> slows things down.

The full changeset description for this change doesn't make sense to me.

    xen/blkback: Utilize the M2P override mechanism for GNTMAP_host_map

    Instead of doing copy grants lets do mapping grants using
    the M2P(and P2M) override mechanism.

As all it is doing is replacing set_phys_to_machine() calls with
m2p_add_override().

David

  parent reply	other threads:[~2013-11-06 11:34 UTC|newest]

Thread overview: 19+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2013-11-05 11:24 [PATCH] grant-table: don't set m2p override if kmap_ops is not set Roger Pau Monne
2013-11-05 11:26 ` Roger Pau Monné
2013-11-05 12:36 ` David Vrabel
2013-11-05 14:47   ` Roger Pau Monné
2013-11-05 14:56     ` Konrad Rzeszutek Wilk
2013-11-05 15:01       ` Roger Pau Monné
2013-11-05 15:08         ` [Xen-devel] " Ian Campbell
2013-11-05 16:03           ` Roger Pau Monné
2013-11-05 20:06             ` Matt Wilson
2013-11-05 20:53               ` Anthony Liguori
2013-11-05 21:16                 ` Konrad Rzeszutek Wilk
2013-11-05 22:09                   ` Anthony Liguori
2013-11-05 22:19                     ` Matt Wilson
2013-11-06 10:22                 ` Ian Campbell
2013-11-06 18:46                   ` Anthony Liguori
2013-11-06 11:34                 ` David Vrabel [this message]
2013-11-06 17:59                   ` Matt Wilson
2013-11-06 18:52                     ` Konrad Rzeszutek Wilk
2013-11-07 20:15                       ` Stefano Stabellini

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=527A2943.7050400@citrix.com \
    --to=david.vrabel@citrix.com \
    --cc=Ian.Campbell@citrix.com \
    --cc=anthony@codemonkey.ws \
    --cc=linux-kernel@vger.kernel.org \
    --cc=msw@amazon.com \
    --cc=msw@linux.com \
    --cc=roger.pau@citrix.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