All of lore.kernel.org
 help / color / mirror / Atom feed
From: "Yu, Zhang" <yu.c.zhang@linux.intel.com>
To: Jan Beulich <JBeulich@suse.com>, Tim Deegan <tim@xen.org>
Cc: kevin.tian@intel.com, keir@xen.org, ian.campbell@citrix.com,
	stefano.stabellini@eu.citrix.com, ian.jackson@eu.citrix.com,
	donald.d.dugger@intel.com, Xen-devel@lists.xen.org,
	Paul.Durrant@citrix.com, zhiyuan.lv@intel.com,
	yang.z.zhang@intel.com
Subject: Re: [PATCH v4] x86: add p2m_mmio_write_dm
Date: Tue, 02 Dec 2014 15:48:38 +0800	[thread overview]
Message-ID: <547D6ED6.2030803@linux.intel.com> (raw)
In-Reply-To: <547C6D98020000780004BB9D@mail.emea.novell.com>



On 12/1/2014 8:31 PM, Jan Beulich wrote:
>>>> On 01.12.14 at 13:13, <tim@xen.org> wrote:
>> At 11:17 +0000 on 01 Dec (1417429027), Jan Beulich wrote:
>>>>>> On 01.12.14 at 11:30, <tim@xen.org> wrote:
>>>> At 09:32 +0000 on 01 Dec (1417422746), Jan Beulich wrote:
>>>>>>>> On 01.12.14 at 09:49, <yu.c.zhang@linux.intel.com> wrote:
>>>>>> To my understanding, pages with p2m_ram_ro are not supposed to be
>>>>>> modified by guest. So in __hvm_copy(), when p2m type of a page is
>>>>>> p2m_ram_rom, no copy will occur.
>>>>>> However, to our usage, we just wanna this page to be write protected, so
>>>>>> that our device model can be triggered to do some emulation. The content
>>>>>> written to this page is supposed not to be dropped. This way, if
>>>>>> sequentially a read operation is performed by guest to this page, the
>>>>>> guest will still see its anticipated value.
>>>>>
>>>>> __hvm_copy() is only a helper function, and doesn't write to
>>>>> mmio_dm space either; instead its (indirect) callers would invoke
>>>>> hvmemul_do_mmio() upon seeing HVMCOPY_bad_gfn_to_mfn
>>>>> returns. The question hence is about the apparent inconsistency
>>>>> resulting from writes to ram_ro being dropped here but getting
>>>>> passed to the DM by hvm_hap_nested_page_fault(). Tim - is
>>>>> that really intentional?
>>>>
>>>> No - and AFAICT it shouldn't be happening.  It _is_ how it was
>>>> implemented originally, because it involved fewer moving parts and
>>>> didn't need to be efficient (and after all, writes to entirely missing
>>>> addresses go to the device model too).
>>>>
>>>> But the code was later updated to log and discard writes to read-only
>>>> memory (see 4d8aa29 from Trolle Selander).
>>>>
>>>> Early version of p2m_ram_ro were documented in the internal headers as
>>>> sending the writes to the DM, but the public interface (HVMMEM_ram_ro)
>>>> has always said that writes are discarded.
>>>
>>> Hmm, so which way do you recommend resolving the inconsistency
>>> then - match what the public interface says or what the apparent
>>> original intention for the internal type was? Presumably we need to
>>> follow the public interface mandated model, and hence require the
>>> new type to be introduced.
>>
>> Sorry, I was unclear -- there isn't an inconsistency; both internal
>> and public headers currently say that writes are discarded and AFAICT
>> that is what the code does.
>
> Not for hvm_hap_nested_page_fault() afaict - the forwarding to
> DM there contradicts the "writes are discarded" model that other
> code paths follow.
>
Thanks, Jan.
By "inconsistency", do you mean the p2m_ram_ro shall not trigger the 
handle_mmio_with_translation() in hvm_hap_nested_page_fault()?
I'm also a bit confused with the "writes are discarded/dropped" comments 
in the code. Does this mean writes to the p2m_ram_ro pages should be 
abandoned without going to the dm, or going to the dm and  ignored 
later? The code seems to be the second one.

> Jan
>
>
>

  reply	other threads:[~2014-12-02  7:48 UTC|newest]

Thread overview: 19+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2014-11-28  7:59 [PATCH v4] x86: add p2m_mmio_write_dm Yu Zhang
2014-11-28  9:57 ` Jan Beulich
2014-12-01  8:49   ` Yu, Zhang
2014-12-01  9:32     ` Jan Beulich
2014-12-01 10:30       ` Tim Deegan
2014-12-01 11:17         ` Jan Beulich
2014-12-01 12:13           ` Tim Deegan
2014-12-01 12:31             ` Jan Beulich
2014-12-02  7:48               ` Yu, Zhang [this message]
2014-12-02  9:39                 ` Jan Beulich
2014-12-02 10:37               ` Tim Deegan
2014-12-02 11:03                 ` Jan Beulich
2014-12-02  7:38             ` Yu, Zhang
2014-12-02 11:40               ` Tim Deegan
2014-12-02 11:52                 ` Jan Beulich
2014-12-03  6:58                 ` Yu, Zhang
2014-12-04  9:01                 ` Yu, Zhang
2014-12-04  9:36                   ` Tim Deegan
2014-12-04  9:42                     ` Yu, Zhang

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=547D6ED6.2030803@linux.intel.com \
    --to=yu.c.zhang@linux.intel.com \
    --cc=JBeulich@suse.com \
    --cc=Paul.Durrant@citrix.com \
    --cc=Xen-devel@lists.xen.org \
    --cc=donald.d.dugger@intel.com \
    --cc=ian.campbell@citrix.com \
    --cc=ian.jackson@eu.citrix.com \
    --cc=keir@xen.org \
    --cc=kevin.tian@intel.com \
    --cc=stefano.stabellini@eu.citrix.com \
    --cc=tim@xen.org \
    --cc=yang.z.zhang@intel.com \
    --cc=zhiyuan.lv@intel.com \
    /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.