All of lore.kernel.org
 help / color / mirror / Atom feed
From: "Jan Beulich" <JBeulich@suse.com>
To: 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: Tue, 03 Feb 2015 14:58:34 +0000	[thread overview]
Message-ID: <54D0F02A020000780005C720@mail.emea.novell.com> (raw)
In-Reply-To: <1422890524-19678-4-git-send-email-dslutz@verizon.com>

>>> On 02.02.15 at 16:22, <dslutz@verizon.com> wrote:
>   Jan Beulich:
>     The change on what to do when hvm_send_assist_req() fails is bad.
>       That is correct.  Made hvm_has_dm() do full checking so
>       that the extra VMEXIT and VMENTRY can be skipped.
>     hvm_complete_assist_req() be a separate function yet having only
>     a single caller ...
>       Folded hvm_complete_assist_req() in to hvm_has_dm() which
>       is the only place it is called.

This makes pretty little sense to me - previously the only caller was
hvm_send_assist_req(), folding into which would make sense. But
moving this code into hvm_has_dm() doesn't look right both from
an abstract perspective (completely contrary to the function's name)
and from what operations get carried out when:

> --- 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.

> @@ -227,11 +230,12 @@ static int hvmemul_do_io(
>          else
>          {
>              rc = X86EMUL_RETRY;
> -            if ( !hvm_send_assist_req(&p) )
> +            if ( !hvm_send_assist_req_to_ioreq_server(s, &p) )
>                  vio->io_state = HVMIO_none;
>              else if ( p_data == NULL )
>                  rc = X86EMUL_OKAY;
>          }

In particular, the returning of X86EMUL_RETRY vs X86EMUL_OKAY
now change for the case where !s but also
!list_empty(&d->arch.hvm_domain.ioreq_server.list). While this
_may_ be intended, the description of the patch still doesn't make
clear why this is so (again keeping in mind why the behavior prior to
this patch was done in this particular way).

So in the end, considering that Paul approved of what you do, maybe
all is well and it's just one step too many folded together for me to
grok. In which case - please take the time to describe your changes
suitably; this isn't the first time I have to ask you to do so.

> +    }
>          break;

For indentation to be meaningful, the closing brace should follow
the break statement.

> --- a/xen/include/asm-x86/hvm/hvm.h
> +++ b/xen/include/asm-x86/hvm/hvm.h
> @@ -228,7 +228,9 @@ int hvm_vcpu_cacheattr_init(struct vcpu *v);
>  void hvm_vcpu_cacheattr_destroy(struct vcpu *v);
>  void hvm_vcpu_reset_state(struct vcpu *v, uint16_t cs, uint16_t ip);
>  
> -bool_t hvm_send_assist_req(ioreq_t *p);
> +struct hvm_ioreq_server;

I think you could avoid this by simply moving up here the
hvm_has_dm() declaration.

> +bool_t hvm_send_assist_req_to_ioreq_server(struct hvm_ioreq_server *s,
> +                                           ioreq_t *p);

If, with the comments above in mind, you still intend to remove
hvm_send_assist_req(), I'd much favor you renaming
hvm_send_assist_req_to_ioreq_server() to hvm_send_assist_req().

Jan

  parent reply	other threads:[~2015-02-03 14:58 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 [this message]
2015-02-05 19:02     ` Don Slutz
2015-02-06  7:35       ` Jan Beulich
2015-02-06 17:01         ` Don Slutz

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=54D0F02A020000780005C720@mail.emea.novell.com \
    --to=jbeulich@suse.com \
    --cc=andrew.cooper3@citrix.com \
    --cc=dslutz@verizon.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.