From: Don Slutz <dslutz@verizon.com>
To: Jan Beulich <JBeulich@suse.com>, Don Slutz <dslutz@verizon.com>
Cc: Wei Liu <wei.liu2@citrix.com>,
Ian Campbell <ian.campbell@citrix.com>,
Stefano Stabellini <stefano.stabellini@eu.citrix.com>,
George Dunlap <george.dunlap@eu.citrix.com>,
Andrew Cooper <andrew.cooper3@citrix.com>,
Ian Jackson <ian.jackson@eu.citrix.com>,
xen-devel@lists.xen.org, Paul Durrant <paul.durrant@citrix.com>,
Keir Fraser <keir@xen.org>
Subject: Re: [PATCH v2 3/3] hvm_has_dm: Do a full check for backing DM
Date: Fri, 06 Feb 2015 12:01:21 -0500 [thread overview]
Message-ID: <54D4F361.5060106@terremark.com> (raw)
In-Reply-To: <54D47CC2020000780005D963@mail.emea.novell.com>
On 02/06/15 02:35, Jan Beulich wrote:
>>>> On 05.02.15 at 20:02, <dslutz@verizon.com> wrote:
>> On 02/03/15 09:58, Jan Beulich wrote:
>>>>>> On 02.02.15 at 16:22, <dslutz@verizon.com> wrote:
>> Ok, will be working on a much better commit message. Do you want the
>> new commit message copied here (in the summary of the changes), or just
>> that fact that there is a new commit message?
>
> Only mention it there.
>
Ok
>>>> --- a/xen/arch/x86/hvm/emulate.c
>>>> +++ b/xen/arch/x86/hvm/emulate.c
>>>> @@ -218,8 +218,11 @@ static int hvmemul_do_io(
>>>> vio->io_state = HVMIO_handle_mmio_awaiting_completion;
>>>> break;
>>>> case X86EMUL_UNHANDLEABLE:
>>>> + {
>>>> + struct hvm_ioreq_server *s = hvm_has_dm(curr->domain, &p);
>>>> +
>>>> /* If there is no backing DM, just ignore accesses */
>>>> - if ( !hvm_has_dm(curr->domain) )
>>>> + if ( !s )
>>>> {
>>>> rc = X86EMUL_OKAY;
>>>> vio->io_state = HVMIO_none;
>>>
>>> You alter the flow here, but leave the (now stale) comment
>>> untouched - !hvm_has_dm() no longer has the original meaning.
>>>
>>
>> I will say that the comment is not stale. Also this code flow change
>> is what I am trying to do in this patch. Since I am talking about
>> Paul's code also, I might be off base.
>>
>> It is true that hvm_has_dm() has changed. However the change
>> is from "there is no backing DM" to "there is no backing DM
>> that will process this request". To me they mean the same thing.
>>
>> That is why I did not change the name and did not see a need
>> to change the comment. However I can adjust the comment to be much longer.
>>
>> How does:
>>
>> /*
>> * If there is no backing DM, or there is no backing DM to handle
>> * this request, act just like a missing device.
>> */
>>
>> look as a new comment?
>
> Simply inserting "suitable" into the original comment would do imo.
>
Will change to:
/* If there is no suitable backing DM, just ignore accesses */
>> Would it help to s/hvm_has_dm/hvm_has_dm_for_req/?
>
> No, not really. But see also below for the name.
>
ok
>> Here is the proposed new commit message:
>
> Looks a lot better.
>
>> The key part of skipping the retry is to do "rc = X86EMUL_OKAY"
>> which is what the error path on the call to hvm_has_dm() does in
>> hvmemul_do_io() (the only call on hvm_has_dm()).
>>
>> Since this case is no longer handled in hvm_send_assist_req(), move
>> the call to hvm_complete_assist_req() into hvm_has_dm().
>>
>> As part of this change, do the work of hvm_complete_assist_req() in
>> the PVH case. Acting more like real hardware looks to be better.
>>
>> Since there is only one caller of hvm_complete_assist_req(), fold
>> that routine into the changed hvm_has_dm().
>
> As said before, with the current name it's not reasonable for the
> function to also complete the request (the name strictly suggests
> a "read-only" operation). But as it looks this one has only a single
> caller too, so maybe apart from renaming an alternative might
> again be to fold it into that single caller?
>
I think that folding routines between files is not the way I would
normally go. So how about not folding hvm_complete_assist_req()
anywhere, just change it to return void. Drop the routine
hvm_has_dm(), and have hvmemul_do_io() call hvm_select_ioreq_server()
and in the error path call hvm_complete_assist_req(). This does
leave only one caller of hvm_complete_assist_req(), but the code blocks
are not changing files. Here is the diff in hvmemul_do_io() to match
these words:
--- a/xen/arch/x86/hvm/emulate.c
+++ b/xen/arch/x86/hvm/emulate.c
@@ -218,21 +218,27 @@ static int hvmemul_do_io(
vio->io_state = HVMIO_handle_mmio_awaiting_completion;
break;
case X86EMUL_UNHANDLEABLE:
- /* If there is no backing DM, just ignore accesses */
- if ( !hvm_has_dm(curr->domain) )
+ {
+ struct hvm_ioreq_server *s =
+ hvm_select_ioreq_server(curr->domain, &p);
+
+ /* If there is no suitable backing DM, just ignore accesses */
+ if ( !s )
{
+ hvm_complete_assist_req(&p);
rc = X86EMUL_OKAY;
vio->io_state = HVMIO_none;
}
else
>> Adding "rc = X86EMUL_OKAY" in the failing case of
>> hvm_send_assist_req() would unfix what was done in commit
>> bac0999325056a3b3a92f7622df7ffbc5388b1c3 and commit
>> f20f3c8ece5c10fa7626f253d28f570a43b23208. We are currently doing
>> the succeeding case of hvm_send_assist_req() and retying the I/O.
>
> Maybe s/unfix/break/ ?
>
Yes.
-Don Slutz
> Jan
>
prev parent reply other threads:[~2015-02-06 17:01 UTC|newest]
Thread overview: 12+ messages / expand[flat|nested] mbox.gz Atom feed top
2015-02-02 15:22 [PATCH v2 0/3] Skip unneeded VMENTRY & VMEXIT Don Slutz
2015-02-02 15:22 ` [PATCH v2 1/3] xentrace: Adjust IOPORT & MMIO format Don Slutz
2015-02-05 21:28 ` George Dunlap
2015-02-02 15:22 ` [PATCH v2 2/3] hvm_complete_assist_req: We should not be able to get here on IOREQ_TYPE_PCI_CONFIG Don Slutz
2015-02-03 11:05 ` Jan Beulich
2015-02-04 0:37 ` Don Slutz
2015-02-02 15:22 ` [PATCH v2 3/3] hvm_has_dm: Do a full check for backing DM Don Slutz
2015-02-03 10:37 ` Paul Durrant
2015-02-03 14:58 ` Jan Beulich
2015-02-05 19:02 ` Don Slutz
2015-02-06 7:35 ` Jan Beulich
2015-02-06 17:01 ` Don Slutz [this message]
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=54D4F361.5060106@terremark.com \
--to=dslutz@verizon.com \
--cc=JBeulich@suse.com \
--cc=andrew.cooper3@citrix.com \
--cc=george.dunlap@eu.citrix.com \
--cc=ian.campbell@citrix.com \
--cc=ian.jackson@eu.citrix.com \
--cc=keir@xen.org \
--cc=paul.durrant@citrix.com \
--cc=stefano.stabellini@eu.citrix.com \
--cc=wei.liu2@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 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.