From: "Yu, Zhang" <yu.c.zhang@linux.intel.com>
To: Jan Beulich <JBeulich@suse.com>, Paul Durrant <Paul.Durrant@citrix.com>
Cc: Kevin Tian <kevin.tian@intel.com>, Wei Liu <wei.liu2@citrix.com>,
Shuai Ruan <shuai.ruan@linux.intel.com>,
Andrew Cooper <Andrew.Cooper3@citrix.com>,
"xen-devel@lists.xen.org" <xen-devel@lists.xen.org>,
Stefano Stabellini <Stefano.Stabellini@citrix.com>,
"zhiyuan.lv@intel.com" <zhiyuan.lv@intel.com>,
Ian Jackson <Ian.Jackson@citrix.com>,
"Keir (Xen.org)" <keir@xen.org>
Subject: Re: [V9 3/3] Differentiate IO/mem resources tracked by ioreq server
Date: Thu, 7 Jan 2016 13:40:43 +0800 [thread overview]
Message-ID: <568DFA5B.6080005@linux.intel.com> (raw)
In-Reply-To: <568CF35102000078000C3D56@prv-mh.provo.novell.com>
On 1/6/2016 5:58 PM, Jan Beulich wrote:
>>>> On 06.01.16 at 10:44, <Paul.Durrant@citrix.com> wrote:
>>> -----Original Message-----
>>> From: Jan Beulich [mailto:JBeulich@suse.com]
>>> Sent: 06 January 2016 08:59
>>> To: Zhang Yu
>>> Cc: Andrew Cooper; Paul Durrant; Wei Liu; Ian Jackson; Stefano Stabellini;
>>> Kevin Tian; zhiyuan.lv@intel.com; Shuai Ruan; xen-devel@lists.xen.org; Keir
>>> (Xen.org)
>>> Subject: Re: [Xen-devel] [V9 3/3] Differentiate IO/mem resources tracked by
>>> ioreq server
>>>
>>>>>> On 31.12.15 at 10:33, <yu.c.zhang@linux.intel.com> wrote:
>>>> On 12/21/2015 10:45 PM, Jan Beulich wrote:
>>>>>>>> On 15.12.15 at 03:05, <shuai.ruan@linux.intel.com> wrote:
>>>>>> @@ -2593,6 +2597,16 @@ struct hvm_ioreq_server
>>> *hvm_select_ioreq_server(struct domain *d,
>>>>>> type = (p->type == IOREQ_TYPE_PIO) ?
>>>>>> HVMOP_IO_RANGE_PORT : HVMOP_IO_RANGE_MEMORY;
>>>>>> addr = p->addr;
>>>>>> + if ( type == HVMOP_IO_RANGE_MEMORY )
>>>>>> + {
>>>>>> + ram_page = get_page_from_gfn(d, p->addr >> PAGE_SHIFT,
>>>>>> + &p2mt, P2M_UNSHARE);
>>>>>> + if ( p2mt == p2m_mmio_write_dm )
>>>>>> + type = HVMOP_IO_RANGE_WP_MEM;
>>>>>> +
>>>>>> + if ( ram_page )
>>>>>> + put_page(ram_page);
>>>>>> + }
>>>>>
>>>>> You evaluate the page's current type here - what if it subsequently
>>>>> changes? I don't think it is appropriate to leave the hypervisor at
>>>>> the mercy of the device model here.
>>>>
>>>> Well. I do not quite understand your concern. :)
>>>> Here, the get_page_from_gfn() is used to determine if the addr is a MMIO
>>>> or a write-protected ram. If this p2m type is changed, it should be
>>>> triggered by the guest and device model, e.g. this RAM is not supposed
>>>> to be used as the graphic translation table. And it should be fine.
>>>> But I also wonder, if there's any other routine more appropriate to get
>>>> a p2m type from the gfn?
>>>
>>> No, the question isn't the choice of method to retrieve the
>>> current type, but the lack of measures against the retrieved
>>> type becoming stale by the time you actually use it.
>>
>> I don't think that issue is specific to this code. AFAIK nothing in the I/O
>> emulation system protects against a type change whilst a request is in
>> flight.
>> Also, what are the consequences of a change? Only that the wrong range type
>> is selected and the emulation goes to the wrong place. This may be a problem
>> for the VM but should cause no other problems.
>
> Okay, I buy this argument, but I think it would help if that was spelled
> out this way in the commit message.
Thank you, Paul & Jan. :)
A note will be added to explain this in the commit message in next
version.
Yu
>
> Jan
>
>
> _______________________________________________
> Xen-devel mailing list
> Xen-devel@lists.xen.org
> http://lists.xen.org/xen-devel
>
next prev parent reply other threads:[~2016-01-07 5:40 UTC|newest]
Thread overview: 20+ messages / expand[flat|nested] mbox.gz Atom feed top
2015-12-15 2:05 [V9 0/3] Refactor ioreq server for better performance Shuai Ruan
2015-12-15 2:05 ` [V9 1/3] Remove identical relationship between ioreq type and rangeset type Shuai Ruan
2015-12-20 7:36 ` Tian, Kevin
2015-12-15 2:05 ` [V9 2/3] Refactor rangeset structure for better performance Shuai Ruan
2015-12-21 14:38 ` Jan Beulich
2015-12-31 9:33 ` Yu, Zhang
2016-01-06 8:53 ` Jan Beulich
2016-01-06 9:46 ` Paul Durrant
2016-01-06 9:59 ` Jan Beulich
2016-01-06 10:14 ` Paul Durrant
2015-12-15 2:05 ` [V9 3/3] Differentiate IO/mem resources tracked by ioreq server Shuai Ruan
2015-12-20 7:37 ` Tian, Kevin
2015-12-21 14:45 ` Jan Beulich
2015-12-31 9:33 ` Yu, Zhang
2016-01-06 8:59 ` Jan Beulich
2016-01-06 9:44 ` Paul Durrant
2016-01-06 9:58 ` Jan Beulich
2016-01-07 5:40 ` Yu, Zhang [this message]
2016-01-07 5:38 ` Yu, Zhang
2015-12-31 9:32 ` [V9 0/3] Refactor ioreq server for better performance 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=568DFA5B.6080005@linux.intel.com \
--to=yu.c.zhang@linux.intel.com \
--cc=Andrew.Cooper3@citrix.com \
--cc=Ian.Jackson@citrix.com \
--cc=JBeulich@suse.com \
--cc=Paul.Durrant@citrix.com \
--cc=Stefano.Stabellini@citrix.com \
--cc=keir@xen.org \
--cc=kevin.tian@intel.com \
--cc=shuai.ruan@linux.intel.com \
--cc=wei.liu2@citrix.com \
--cc=xen-devel@lists.xen.org \
--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 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).