xen-devel.lists.xenproject.org archive mirror
 help / color / mirror / Atom feed
From: Jan Beulich <jbeulich@suse.com>
To: Oleksandr Tyshchenko <olekstysh@gmail.com>
Cc: xen-devel@lists.xenproject.org,
	"Oleksandr Tyshchenko" <oleksandr_tyshchenko@epam.com>,
	"Paul Durrant" <paul@xen.org>,
	"Andrew Cooper" <andrew.cooper3@citrix.com>,
	"Wei Liu" <wl@xen.org>, "Roger Pau Monné" <roger.pau@citrix.com>,
	"Julien Grall" <julien@xen.org>,
	"Stefano Stabellini" <sstabellini@kernel.org>,
	"Julien Grall" <julien.grall@arm.com>
Subject: Re: [PATCH V1 01/16] x86/ioreq: Prepare IOREQ feature for making it common
Date: Mon, 14 Sep 2020 15:52:46 +0200	[thread overview]
Message-ID: <98420567-40a9-7297-d243-4af90f692bf9@suse.com> (raw)
In-Reply-To: <1599769330-17656-2-git-send-email-olekstysh@gmail.com>

On 10.09.2020 22:21, Oleksandr Tyshchenko wrote:
> From: Oleksandr Tyshchenko <oleksandr_tyshchenko@epam.com>
> 
> As a lot of x86 code can be re-used on Arm later on, this patch
> prepares IOREQ support before moving to the common code. This way
> we will get almost a verbatim copy for a code movement.
> 
> This support is going to be used on Arm to be able run device
> emulator outside of Xen hypervisor.

This is all fine, but you should then go on and explain what you're
doing, and why (at which point it may become obvious that it would
be more helpful to split this into a couple of steps). In particular
something as suspicious as ...

> Changes RFC -> V1:
>    - new patch, was split from:
>      "[RFC PATCH V1 01/12] hvm/ioreq: Make x86's IOREQ feature common"
>    - fold the check of p->type into hvm_get_ioreq_server_range_type()
>      and make it return success/failure
>    - remove relocate_portio_handler() call from arch_hvm_ioreq_destroy()
>      in arch/x86/hvm/ioreq.c

... this (see below).

> --- a/xen/arch/x86/hvm/ioreq.c
> +++ b/xen/arch/x86/hvm/ioreq.c
> @@ -170,6 +170,29 @@ static bool hvm_wait_for_io(struct hvm_ioreq_vcpu *sv, ioreq_t *p)
>      return true;
>  }
>  
> +bool arch_handle_hvm_io_completion(enum hvm_io_completion io_completion)

Do we need "handle" in here? Without it, I'd also not have to ask about
moving hvm further to the front of the name...

> @@ -836,6 +848,12 @@ int hvm_create_ioreq_server(struct domain *d, int bufioreq_handling,
>      return rc;
>  }
>  
> +/* Called when target domain is paused */
> +int arch_hvm_destroy_ioreq_server(struct hvm_ioreq_server *s)
> +{
> +    return p2m_set_ioreq_server(s->target, 0, s);
> +}

Why return "int" when ...

> @@ -855,7 +873,7 @@ int hvm_destroy_ioreq_server(struct domain *d, ioservid_t id)
>  
>      domain_pause(d);
>  
> -    p2m_set_ioreq_server(d, 0, s);
> +    arch_hvm_destroy_ioreq_server(s);

... the result has been ignored anyway? Or otherwise I guess you'd
want to add error handling here (but then the result of
p2m_set_ioreq_server() should still get ignored, for backwards
compatibility).

> @@ -1215,8 +1233,7 @@ void hvm_destroy_all_ioreq_servers(struct domain *d)
>      struct hvm_ioreq_server *s;
>      unsigned int id;
>  
> -    if ( !relocate_portio_handler(d, 0xcf8, 0xcf8, 4) )
> -        return;
> +    arch_hvm_ioreq_destroy(d);

So the call to relocate_portio_handler() simply goes away. No
replacement, no explanation?

> @@ -1239,19 +1256,15 @@ void hvm_destroy_all_ioreq_servers(struct domain *d)
>      spin_unlock_recursive(&d->arch.hvm.ioreq_server.lock);
>  }
>  
> -struct hvm_ioreq_server *hvm_select_ioreq_server(struct domain *d,
> -                                                 ioreq_t *p)
> +int hvm_get_ioreq_server_range_type(struct domain *d,
> +                                    ioreq_t *p,

At least p, but perhaps also d can gain const?

> +                                    uint8_t *type,
> +                                    uint64_t *addr)

By the name the function returns a type for a range (albeit without
it being clear where the two bounds of such a range actually live).
By the implementation is looks more like you mean "range_and_type",
albeit still without there really being a range passed back to the
caller. Therefore I think I need some clarification on what's
intended before even being able to suggest something. From ...

> +struct hvm_ioreq_server *hvm_select_ioreq_server(struct domain *d,
> +                                                 ioreq_t *p)
> +{
> +    struct hvm_ioreq_server *s;
> +    uint8_t type;
> +    uint64_t addr;
> +    unsigned int id;
> +
> +    if ( hvm_get_ioreq_server_range_type(d, p, &type, &addr) )
> +        return NULL;

... this use - maybe hvm_ioreq_server_get_type_addr() (albeit I
don't like this name very much)?

> @@ -1351,7 +1378,7 @@ static int hvm_send_buffered_ioreq(struct hvm_ioreq_server *s, ioreq_t *p)
>      pg = iorp->va;
>  
>      if ( !pg )
> -        return X86EMUL_UNHANDLEABLE;
> +        return IOREQ_IO_UNHANDLED;

At this example - why the IO infix, duplicating the prefix? I'd
suggest to either drop it (if the remaining identifiers are deemed
unambiguous enough) or use e.g. IOREQ_STATUS_*.

> @@ -1515,11 +1542,21 @@ static int hvm_access_cf8(
>      return X86EMUL_UNHANDLEABLE;
>  }
>  
> +void arch_hvm_ioreq_init(struct domain *d)
> +{
> +    register_portio_handler(d, 0xcf8, 4, hvm_access_cf8);
> +}
> +
> +void arch_hvm_ioreq_destroy(struct domain *d)
> +{
> +
> +}

Stray blank line?

Jan


  reply	other threads:[~2020-09-14 13:53 UTC|newest]

Thread overview: 111+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-09-10 20:21 [PATCH V1 00/16] IOREQ feature (+ virtio-mmio) on Arm Oleksandr Tyshchenko
2020-09-10 20:21 ` [PATCH V1 01/16] x86/ioreq: Prepare IOREQ feature for making it common Oleksandr Tyshchenko
2020-09-14 13:52   ` Jan Beulich [this message]
2020-09-21 12:22     ` Oleksandr
2020-09-21 12:31       ` Jan Beulich
2020-09-21 12:47         ` Oleksandr
2020-09-21 13:29           ` Jan Beulich
2020-09-21 14:43             ` Oleksandr
2020-09-21 15:28               ` Jan Beulich
2020-09-23 17:22   ` Julien Grall
2020-09-23 18:08     ` Oleksandr
2020-09-10 20:21 ` [PATCH V1 02/16] xen/ioreq: Make x86's IOREQ feature common Oleksandr Tyshchenko
2020-09-14 14:17   ` Jan Beulich
2020-09-21 19:02     ` Oleksandr
2020-09-22  6:33       ` Jan Beulich
2020-09-22  9:58         ` Oleksandr
2020-09-22 10:54           ` Jan Beulich
2020-09-22 15:05             ` Oleksandr
2020-09-22 15:52               ` Jan Beulich
2020-09-23 12:28                 ` Oleksandr
2020-09-24 10:58                   ` Jan Beulich
2020-09-24 15:38                     ` Oleksandr
2020-09-24 15:51                       ` Jan Beulich
2020-09-24 18:01   ` Julien Grall
2020-09-25  8:19     ` Paul Durrant
2020-09-30 13:39       ` Oleksandr
2020-09-30 17:47         ` Julien Grall
2020-10-01  6:59           ` Paul Durrant
2020-10-01  8:49           ` Jan Beulich
2020-10-01  8:50             ` Paul Durrant
2020-09-10 20:21 ` [PATCH V1 03/16] xen/ioreq: Make x86's hvm_ioreq_needs_completion() common Oleksandr Tyshchenko
2020-09-14 14:59   ` Jan Beulich
2020-09-22 16:16     ` Oleksandr
2020-09-23 17:27     ` Julien Grall
2020-09-10 20:21 ` [PATCH V1 04/16] xen/ioreq: Provide alias for the handle_mmio() Oleksandr Tyshchenko
2020-09-14 15:10   ` Jan Beulich
2020-09-22 16:20     ` Oleksandr
2020-09-23 17:28   ` Julien Grall
2020-09-23 18:17     ` Oleksandr
2020-09-10 20:21 ` [PATCH V1 05/16] xen/ioreq: Make x86's hvm_mmio_first(last)_byte() common Oleksandr Tyshchenko
2020-09-14 15:13   ` Jan Beulich
2020-09-22 16:24     ` Oleksandr
2020-09-10 20:22 ` [PATCH V1 06/16] xen/ioreq: Make x86's hvm_ioreq_(page/vcpu/server) structs common Oleksandr Tyshchenko
2020-09-14 15:16   ` Jan Beulich
2020-09-14 15:59     ` Julien Grall
2020-09-22 16:33     ` Oleksandr
2020-09-10 20:22 ` [PATCH V1 07/16] xen/dm: Make x86's DM feature common Oleksandr Tyshchenko
2020-09-14 15:56   ` Jan Beulich
2020-09-22 16:46     ` Oleksandr
2020-09-24 11:03       ` Jan Beulich
2020-09-24 12:47         ` Oleksandr
2020-09-23 17:35   ` Julien Grall
2020-09-23 18:28     ` Oleksandr
2020-09-10 20:22 ` [PATCH V1 08/16] xen/mm: Make x86's XENMEM_resource_ioreq_server handling common Oleksandr Tyshchenko
2020-09-10 20:22 ` [PATCH V1 09/16] arm/ioreq: Introduce arch specific bits for IOREQ/DM features Oleksandr Tyshchenko
2020-09-11 10:14   ` Oleksandr
2020-09-16  7:51   ` Jan Beulich
2020-09-22 17:12     ` Oleksandr
2020-09-23 18:03   ` Julien Grall
2020-09-23 20:16     ` Oleksandr
2020-09-24 11:08       ` Jan Beulich
2020-09-24 16:02         ` Oleksandr
2020-09-24 18:02           ` Oleksandr
2020-09-25  6:51             ` Jan Beulich
2020-09-25  9:47               ` Oleksandr
2020-09-26 13:12             ` Julien Grall
2020-09-26 13:18               ` Oleksandr
2020-09-24 16:51         ` Julien Grall
2020-09-24 17:25       ` Julien Grall
2020-09-24 18:22         ` Oleksandr
2020-09-26 13:21           ` Julien Grall
2020-09-26 14:57             ` Oleksandr
2020-09-10 20:22 ` [PATCH V1 10/16] xen/mm: Handle properly reference in set_foreign_p2m_entry() on Arm Oleksandr Tyshchenko
2020-09-16  7:17   ` Jan Beulich
2020-09-16  8:50     ` Julien Grall
2020-09-16  8:52       ` Jan Beulich
2020-09-16  8:55         ` Julien Grall
2020-09-22 17:30           ` Oleksandr
2020-09-16  8:08   ` Jan Beulich
2020-09-10 20:22 ` [PATCH V1 11/16] xen/ioreq: Introduce hvm_domain_has_ioreq_server() Oleksandr Tyshchenko
2020-09-16  8:04   ` Jan Beulich
2020-09-16  8:13     ` Paul Durrant
2020-09-16  8:39       ` Julien Grall
2020-09-16  8:43         ` Paul Durrant
2020-09-22 18:39           ` Oleksandr
2020-09-22 18:23     ` Oleksandr
2020-09-10 20:22 ` [PATCH V1 12/16] xen/dm: Introduce xendevicemodel_set_irq_level DM op Oleksandr Tyshchenko
2020-09-26 13:50   ` Julien Grall
2020-09-26 14:21     ` Oleksandr
2020-09-10 20:22 ` [PATCH V1 13/16] xen/ioreq: Make x86's invalidate qemu mapcache handling common Oleksandr Tyshchenko
2020-09-16  8:50   ` Jan Beulich
2020-09-22 19:32     ` Oleksandr
2020-09-24 11:16       ` Jan Beulich
2020-09-24 16:45         ` Oleksandr
2020-09-25  7:03           ` Jan Beulich
2020-09-25 13:05             ` Oleksandr
2020-10-02  9:55               ` Oleksandr
2020-10-07 10:38                 ` Julien Grall
2020-10-07 12:01                   ` Oleksandr
2020-09-10 20:22 ` [PATCH V1 14/16] xen/ioreq: Use guest_cmpxchg64() instead of cmpxchg() Oleksandr Tyshchenko
2020-09-16  9:04   ` Jan Beulich
2020-09-16  9:07     ` Julien Grall
2020-09-16  9:09       ` Paul Durrant
2020-09-16  9:12         ` Julien Grall
2020-09-22 20:05           ` Oleksandr
2020-09-23 18:12             ` Julien Grall
2020-09-23 20:29               ` Oleksandr
2020-09-16  9:07     ` Paul Durrant
2020-09-23 18:05   ` Julien Grall
2020-09-10 20:22 ` [PATCH V1 15/16] libxl: Introduce basic virtio-mmio support on Arm Oleksandr Tyshchenko
2020-09-10 20:22 ` [PATCH V1 16/16] [RFC] libxl: Add support for virtio-disk configuration Oleksandr Tyshchenko

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=98420567-40a9-7297-d243-4af90f692bf9@suse.com \
    --to=jbeulich@suse.com \
    --cc=andrew.cooper3@citrix.com \
    --cc=julien.grall@arm.com \
    --cc=julien@xen.org \
    --cc=oleksandr_tyshchenko@epam.com \
    --cc=olekstysh@gmail.com \
    --cc=paul@xen.org \
    --cc=roger.pau@citrix.com \
    --cc=sstabellini@kernel.org \
    --cc=wl@xen.org \
    --cc=xen-devel@lists.xenproject.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;
as well as URLs for NNTP newsgroup(s).