All of lore.kernel.org
 help / color / mirror / Atom feed
From: Alexander Graf <agraf@suse.de>
To: Gleb Natapov <gleb@redhat.com>
Cc: Scott Wood <scottwood@freescale.com>,
	Bharat Bhushan <r65777@freescale.com>,
	kvm@vger.kernel.org, kvm-ppc@vger.kernel.org,
	stuart.yoder@freescale.com,
	Bharat Bhushan <Bharat.Bhushan@freescale.com>
Subject: Re: [PATCH 3/5] booke: define reset and shutdown hcalls
Date: Wed, 17 Jul 2013 14:19:24 +0200	[thread overview]
Message-ID: <10FE6A8C-161E-404C-AEA0-715C72F2B2FE@suse.de> (raw)
In-Reply-To: <20130717110032.GV11772@redhat.com>


On 17.07.2013, at 13:00, Gleb Natapov wrote:

> On Tue, Jul 16, 2013 at 06:04:34PM -0500, Scott Wood wrote:
>> On 07/16/2013 01:35:55 AM, Gleb Natapov wrote:
>>> On Mon, Jul 15, 2013 at 01:17:33PM -0500, Scott Wood wrote:
>>>> On 07/15/2013 06:30:20 AM, Gleb Natapov wrote:
>>>>> There is no much sense to share hypercalls between architectures.
>>>>> There
>>>>> is zero probability x86 will implement those for instance
>>>> 
>>>> This is similar to the question of whether to keep device API
>>>> enumerations per-architecture...  It costs very little to keep it in
>>>> a common place, and it's hard to go back in the other direction if
>>>> we later realize there are things that should be shared.
>>>> 
>>> This is different from device API since with device API all arches
>>> have
>>> to create/destroy devices, so it make sense to put device lifecycle
>>> management into the common code, and device API has single entry point
>>> to the code - device fd ioctl - where it makes sense to handle common
>>> tasks, if any, and despatch others to specific device implementation.
>>> 
>>> This is totally unlike hypercalls which are, by definition, very
>>> architecture specific (the way they are triggered, the way parameter
>>> are passed from guest to host, what hypercalls arch needs...).
>> 
>> The ABI is architecture specific.  The API doesn't need to be, any
>> more than it does with syscalls (I consider the
>> architecture-specific definition of syscall numbers and similar
>> constants in Linux to be unfortunate, especially for tools such as
>> strace or QEMU's linux-user emulation).
>> 
> Unlike syscalls different arches have very different ideas what
> hypercalls they need to implement, so while with unified syscall space I
> can see how it may benefit (very) small number of tools, I do not see
> what advantage it will give us. The disadvantage is one more global name
> space to manage.
> 
>>>> Keeping it in a common place also makes it more visible to people
>>>> looking to add new hcalls, which could cut down on reinventing the
>>>> wheel.
>>> I do not want other arches to start using hypercalls in the way
>>> powerpc
>>> started to use them: separate device io space, so it is better to hide
>>> this as far away from common code as possible :) But on a more serious
>>> note hypercalls should be a last resort and added only when no other
>>> possibility exists, so people should not look what hcalls others
>>> implemented, so they can add them to their favorite arch, but they
>>> should have a problem at hand that they cannot solve without
>>> hcall, but
>>> at this point they will have pretty good idea what this hcall
>>> should do.
>> 
>> Why are hcalls such a bad thing?
>> 
> Because they often used to do non architectural things making OSes
> behave different from how they runs on real HW and real HW is what
> OSes are designed and tested for. Example: there once was a KVM (XEN
> have/had similar one) hypercall to accelerate MMU operation.  One thing it
> allowed is to to flush tlb without doing IPI if vcpu is not running. Later
> optimization was added to Linux MMU code that _relies_ on those IPIs for
> synchronisation. Good that at that point those hypercalls were already
> deprecated on KVM (IIRC XEN was broke for some time in that regard). Which
> brings me to another point: they often get obsoleted by code improvement
> and HW advancement (happened to aforementioned MMU hypercalls), but they
> hard to deprecate if hypervisor supports live migration, without live
> migration it is less of a problem. Next point is that people often try
> to use them instead of emulate PV or real device just because they
> think it is easier, but it is often not so. Example: pvpanic device was
> initially proposed as hypercall, so lets say we would implement it as
> such. It would have been KVM specific, implementation would touch core
> guest KVM code and would have been Linux guest specific. Instead it was
> implemented as platform device with very small platform driver confined
> in drivers/ directory, immediately usable by XEN and QEMU tcg in addition

This is actually a very good point. How do we support reboot and shutdown for TCG guests? We surely don't want to expose TCG as KVM hypervisor.


Alex

WARNING: multiple messages have this Message-ID (diff)
From: Alexander Graf <agraf@suse.de>
To: Gleb Natapov <gleb@redhat.com>
Cc: Scott Wood <scottwood@freescale.com>,
	Bharat Bhushan <r65777@freescale.com>,
	kvm@vger.kernel.org, kvm-ppc@vger.kernel.org,
	stuart.yoder@freescale.com,
	Bharat Bhushan <Bharat.Bhushan@freescale.com>
Subject: Re: [PATCH 3/5] booke: define reset and shutdown hcalls
Date: Wed, 17 Jul 2013 12:19:24 +0000	[thread overview]
Message-ID: <10FE6A8C-161E-404C-AEA0-715C72F2B2FE@suse.de> (raw)
In-Reply-To: <20130717110032.GV11772@redhat.com>


On 17.07.2013, at 13:00, Gleb Natapov wrote:

> On Tue, Jul 16, 2013 at 06:04:34PM -0500, Scott Wood wrote:
>> On 07/16/2013 01:35:55 AM, Gleb Natapov wrote:
>>> On Mon, Jul 15, 2013 at 01:17:33PM -0500, Scott Wood wrote:
>>>> On 07/15/2013 06:30:20 AM, Gleb Natapov wrote:
>>>>> There is no much sense to share hypercalls between architectures.
>>>>> There
>>>>> is zero probability x86 will implement those for instance
>>>> 
>>>> This is similar to the question of whether to keep device API
>>>> enumerations per-architecture...  It costs very little to keep it in
>>>> a common place, and it's hard to go back in the other direction if
>>>> we later realize there are things that should be shared.
>>>> 
>>> This is different from device API since with device API all arches
>>> have
>>> to create/destroy devices, so it make sense to put device lifecycle
>>> management into the common code, and device API has single entry point
>>> to the code - device fd ioctl - where it makes sense to handle common
>>> tasks, if any, and despatch others to specific device implementation.
>>> 
>>> This is totally unlike hypercalls which are, by definition, very
>>> architecture specific (the way they are triggered, the way parameter
>>> are passed from guest to host, what hypercalls arch needs...).
>> 
>> The ABI is architecture specific.  The API doesn't need to be, any
>> more than it does with syscalls (I consider the
>> architecture-specific definition of syscall numbers and similar
>> constants in Linux to be unfortunate, especially for tools such as
>> strace or QEMU's linux-user emulation).
>> 
> Unlike syscalls different arches have very different ideas what
> hypercalls they need to implement, so while with unified syscall space I
> can see how it may benefit (very) small number of tools, I do not see
> what advantage it will give us. The disadvantage is one more global name
> space to manage.
> 
>>>> Keeping it in a common place also makes it more visible to people
>>>> looking to add new hcalls, which could cut down on reinventing the
>>>> wheel.
>>> I do not want other arches to start using hypercalls in the way
>>> powerpc
>>> started to use them: separate device io space, so it is better to hide
>>> this as far away from common code as possible :) But on a more serious
>>> note hypercalls should be a last resort and added only when no other
>>> possibility exists, so people should not look what hcalls others
>>> implemented, so they can add them to their favorite arch, but they
>>> should have a problem at hand that they cannot solve without
>>> hcall, but
>>> at this point they will have pretty good idea what this hcall
>>> should do.
>> 
>> Why are hcalls such a bad thing?
>> 
> Because they often used to do non architectural things making OSes
> behave different from how they runs on real HW and real HW is what
> OSes are designed and tested for. Example: there once was a KVM (XEN
> have/had similar one) hypercall to accelerate MMU operation.  One thing it
> allowed is to to flush tlb without doing IPI if vcpu is not running. Later
> optimization was added to Linux MMU code that _relies_ on those IPIs for
> synchronisation. Good that at that point those hypercalls were already
> deprecated on KVM (IIRC XEN was broke for some time in that regard). Which
> brings me to another point: they often get obsoleted by code improvement
> and HW advancement (happened to aforementioned MMU hypercalls), but they
> hard to deprecate if hypervisor supports live migration, without live
> migration it is less of a problem. Next point is that people often try
> to use them instead of emulate PV or real device just because they
> think it is easier, but it is often not so. Example: pvpanic device was
> initially proposed as hypercall, so lets say we would implement it as
> such. It would have been KVM specific, implementation would touch core
> guest KVM code and would have been Linux guest specific. Instead it was
> implemented as platform device with very small platform driver confined
> in drivers/ directory, immediately usable by XEN and QEMU tcg in addition

This is actually a very good point. How do we support reboot and shutdown for TCG guests? We surely don't want to expose TCG as KVM hypervisor.


Alex


  reply	other threads:[~2013-07-17 12:19 UTC|newest]

Thread overview: 103+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2013-07-15 11:11 [PATCH 0/5] powerpc: implement reset/shutdown hcalls Bharat Bhushan
2013-07-15 11:23 ` Bharat Bhushan
2013-07-15 11:11 ` [PATCH 1/5] powerpc: define ePAPR hcall exit interface Bharat Bhushan
2013-07-15 11:23   ` Bharat Bhushan
2013-07-15 11:21   ` Alexander Graf
2013-07-15 11:21     ` Alexander Graf
2013-07-15 11:32     ` Bhushan Bharat-R65777
2013-07-15 11:11 ` [PATCH 2/5] booke: exit to guest userspace for unimplemented hcalls in kvm Bharat Bhushan
2013-07-15 11:23   ` Bharat Bhushan
2013-07-15 11:31   ` Alexander Graf
2013-07-15 11:31     ` Alexander Graf
2013-07-15 11:38     ` Bhushan Bharat-R65777
2013-07-15 11:38       ` Bhushan Bharat-R65777
2013-07-15 11:46       ` Alexander Graf
2013-07-15 11:46         ` Alexander Graf
2013-07-15 14:50         ` Bhushan Bharat-R65777
2013-07-15 14:56           ` Alexander Graf
2013-07-15 14:56             ` Alexander Graf
2013-07-15 15:13             ` Bhushan Bharat-R65777
2013-07-15 15:29               ` Alexander Graf
2013-07-15 15:29                 ` Alexander Graf
2013-07-15 15:35                 ` Bhushan Bharat-R65777
2013-07-15 15:38                   ` Alexander Graf
2013-07-15 15:38                     ` Alexander Graf
2013-07-15 18:07   ` Scott Wood
2013-07-15 18:07     ` Scott Wood
2013-07-16  4:46     ` Bhushan Bharat-R65777
2013-07-16  4:46       ` Bhushan Bharat-R65777
2013-07-15 11:11 ` [PATCH 3/5] booke: define reset and shutdown hcalls Bharat Bhushan
2013-07-15 11:23   ` Bharat Bhushan
2013-07-15 11:30   ` Gleb Natapov
2013-07-15 11:30     ` Gleb Natapov
2013-07-15 11:44     ` Alexander Graf
2013-07-15 11:44       ` Alexander Graf
2013-07-15 12:15       ` Gleb Natapov
2013-07-15 12:15         ` Gleb Natapov
2013-07-15 12:21         ` Alexander Graf
2013-07-15 12:21           ` Alexander Graf
2013-07-15 12:24           ` Gleb Natapov
2013-07-15 12:24             ` Gleb Natapov
2013-07-15 12:26             ` Alexander Graf
2013-07-15 12:26               ` Alexander Graf
2013-07-15 12:31               ` Gleb Natapov
2013-07-15 12:31                 ` Gleb Natapov
2013-07-15 18:17     ` Scott Wood
2013-07-15 18:17       ` Scott Wood
2013-07-16  6:35       ` Gleb Natapov
2013-07-16  6:35         ` Gleb Natapov
2013-07-16 23:04         ` Scott Wood
2013-07-16 23:04           ` Scott Wood
2013-07-17 11:00           ` Gleb Natapov
2013-07-17 11:00             ` Gleb Natapov
2013-07-17 12:19             ` Alexander Graf [this message]
2013-07-17 12:19               ` Alexander Graf
2013-07-17 15:19               ` Yoder Stuart-B08248
2013-07-17 15:21                 ` Alexander Graf
2013-07-17 15:21                   ` Alexander Graf
2013-07-17 15:36                   ` Yoder Stuart-B08248
2013-07-17 15:41                     ` Alexander Graf
2013-07-17 15:41                       ` Alexander Graf
2013-07-17 15:47                       ` Bhushan Bharat-R65777
2013-07-17 15:52                         ` Alexander Graf
2013-07-17 15:52                           ` Alexander Graf
2013-07-17 15:59                           ` Bhushan Bharat-R65777
2013-07-17 16:04                             ` Alexander Graf
2013-07-17 16:04                               ` Alexander Graf
2013-07-17 16:21                               ` Bhushan Bharat-R65777
2013-07-17 16:23                                 ` Alexander Graf
2013-07-17 16:23                                   ` Alexander Graf
2013-07-17 16:59                               ` Scott Wood
2013-07-17 16:59                                 ` Scott Wood
2013-07-17 17:05                                 ` Alexander Graf
2013-07-17 17:05                                   ` Alexander Graf
2013-07-17 17:09                                   ` Scott Wood
2013-07-17 17:09                                     ` Scott Wood
2013-07-15 11:11 ` [PATCH 4/5] powerpc: Resolve KVM_HC_FEATURES compilation dependeny Bharat Bhushan
2013-07-15 11:23   ` Bharat Bhushan
2013-07-15 11:46   ` Alexander Graf
2013-07-15 11:46     ` Alexander Graf
2013-07-15 11:11 ` [PATCH 5/5] powerpc: using reset hcall when kvm,has-reset Bharat Bhushan
2013-07-15 11:23   ` Bharat Bhushan
2013-07-15 11:50   ` Alexander Graf
2013-07-15 11:50     ` Alexander Graf
2013-07-15 15:05     ` Bhushan Bharat-R65777
2013-07-15 15:09       ` Alexander Graf
2013-07-15 15:09         ` Alexander Graf
2013-07-15 15:16         ` Bhushan Bharat-R65777
2013-07-15 18:21           ` Scott Wood
2013-07-15 18:21             ` Scott Wood
2013-07-15 20:28             ` Alexander Graf
2013-07-15 20:28               ` Alexander Graf
2013-07-15 20:52               ` Scott Wood
2013-07-15 20:52                 ` Scott Wood
2013-07-15 20:55                 ` Alexander Graf
2013-07-15 20:55                   ` Alexander Graf
2013-07-15 22:23                   ` Scott Wood
2013-07-15 22:23                     ` Scott Wood
2013-07-16 23:21                     ` Alexander Graf
2013-07-16 23:21                       ` Alexander Graf
2013-07-16 23:26                       ` Scott Wood
2013-07-16 23:26                         ` Scott Wood
2013-07-16 23:37                         ` Scott Wood
2013-07-16 23:37                           ` Scott Wood

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=10FE6A8C-161E-404C-AEA0-715C72F2B2FE@suse.de \
    --to=agraf@suse.de \
    --cc=Bharat.Bhushan@freescale.com \
    --cc=gleb@redhat.com \
    --cc=kvm-ppc@vger.kernel.org \
    --cc=kvm@vger.kernel.org \
    --cc=r65777@freescale.com \
    --cc=scottwood@freescale.com \
    --cc=stuart.yoder@freescale.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.