All of lore.kernel.org
 help / color / mirror / Atom feed
From: Bhushan Bharat-R65777 <R65777@freescale.com>
To: Alexander Graf <agraf@suse.de>
Cc: Wood Scott-B07421 <B07421@freescale.com>,
	"kvm-ppc@vger.kernel.org" <kvm-ppc@vger.kernel.org>,
	"kvm@vger.kernel.org" <kvm@vger.kernel.org>
Subject: RE: [PATCH 1/2] kvm/powerpc: rename kvm_hypercall() to epapr_hypercall()
Date: Mon, 7 Oct 2013 16:04:23 +0000	[thread overview]
Message-ID: <6A3DF150A5B70D4F9B66A25E3F7C888D071945CB@039-SN2MPN1-011.039d.mgd.msft.net> (raw)
In-Reply-To: <577DB53B-9313-4B98-A1E1-C9C97ED53819@suse.de>



> -----Original Message-----
> From: kvm-ppc-owner@vger.kernel.org [mailto:kvm-ppc-owner@vger.kernel.org] On
> Behalf Of Alexander Graf
> Sent: Monday, October 07, 2013 9:16 PM
> To: Bhushan Bharat-R65777
> Cc: Wood Scott-B07421; kvm-ppc@vger.kernel.org; kvm@vger.kernel.org
> Subject: Re: [PATCH 1/2] kvm/powerpc: rename kvm_hypercall() to
> epapr_hypercall()
> 
> 
> On 07.10.2013, at 17:43, Bhushan Bharat-R65777 <R65777@freescale.com> wrote:
> 
> >>>>>>>>> at least when I can avoid it. With the current code the
> >>>>>>>>> compiler would be
> >>>>>> smart enough to just optimize out the complete branch.
> >>>>>>>>
> >>>>>>>> Sure.  My point is, where would you be calling that where the
> >>>>>>>> entire file isn't predicated on (or selecting) CONFIG_KVM_GUEST
> >>>>>>>> or
> >> similar?
> >>>>>>>>
> >>>>>>>> We don't do these stubs for every single function in the kernel
> >>>>>>>> -- only ones where the above is a reasonable use case.
> >>>>>>>
> >>>>>>> Yeah, I'm fine on dropping it, but we need to make that a
> >>>>>>> conscious decision
> >>>>>> and verify that no caller relies on it.
> >>>>>>
> >>>>>> kvm_para_has_feature() is called from arch/powerpc/kernel/kvm.c,
> >>>>>> arch/x86/kernel/kvm.c, and arch/x86/kernel/kvmclock.c, all of
> >>>>>> which are enabled by CONFIG_KVM_GUEST.
> >>>>>>
> >>>>>> I did find one example of kvm_para_available() being used in an
> >>>>>> unexpected place
> >>>>>> -- sound/pci/intel8x0.c.  It defines its own non-CONFIG_KVM_GUEST
> >>>>>> stub, even though x86 defines kvm_para_available() using inline
> >>>>>> CPUID stuff which should work without CONFIG_KVM_GUEST.
> >>>>>> I'm not sure why it even needs to do that, though -- shouldn't
> >>>>>> the subsequent PCI subsystem vendor/device check should be sufficient?
> >>>>>> No hypercalls are involved.
> >>>>>>
> >>>>>> That said, the possibility that some random driver might want to
> >>>>>> make use of paravirt features is a decent argument for keeping the stub.
> >>>>>>
> >>>>>
> >>>>> I am not sure where we are agreeing on?
> >>>>> Do we want to remove the stub in
> >>>>> arch/powerpc/include/asm/kvm_para.h
> >>>>> ? as
> >>>> there is no caller without KVM_GUEST and in future caller ensure
> >>>> this to be called only from code selected by KVM_GUEST?
> >>>>>
> >>>>> Or let this stub stay to avoid any random driver calling this ?
> >>>>
> >>>> I think the most reasonable way forward is to add a stub for
> >>>> non-CONFIG_EPAPR to the epapr code, then replace the kvm bits with
> >>>> generic epapr bits (which your patches already do).
> >>>
> >>> Please describe which stub you are talking about.
> >>
> >> kvm_hypercall is always available, regardless of the config option,
> >> which makes all its subfunctions always available as well.
> >
> > This patch renames kvm_hypercall() to epapr_hypercall() and which is always
> available. And the kvm_hypercall() friends now directly calls epapr_hypercall().
> > IIUC, So what you are trying to say is let the kvm_hypercall() friends keep on
> calling kvm_hypercall() itself and a sub something like this:
> 
> No, what I'm saying is that we either
> 
>   a) drop the whole #ifndef code path consciously. This would have to be a
> separate patch with a separate discussion. It's orthogonal to combining
> kvm_hypercall() and epapr_hypercall()
> 
>   b) add the #ifndef path to epapr_hypercall()

Do you mean like this in arch/powerpc/include/asm/epapr_hcalls.h

#ifdef CONFIG_KVM_GUEST
static inline unsigned long epapr_hypercall(unsigned long *in,
                           unsigned long *out,
                           unsigned long nr)
{
 // code for this function
} 
#else
static inline unsigned long epapr_hypercall(unsigned long *in,
                           unsigned long *out,
                           unsigned long nr)
{
	return EV_UNIMPLEMENTED;
}
#endif

> 
> I prefer b, Scott prefers b.
> 
> 
> Alex
> 
> --
> To unsubscribe from this list: send the line "unsubscribe kvm-ppc" in the body
> of a message to majordomo@vger.kernel.org More majordomo info at
> http://vger.kernel.org/majordomo-info.html

WARNING: multiple messages have this Message-ID (diff)
From: Bhushan Bharat-R65777 <R65777@freescale.com>
To: Alexander Graf <agraf@suse.de>
Cc: Wood Scott-B07421 <B07421@freescale.com>,
	"kvm-ppc@vger.kernel.org" <kvm-ppc@vger.kernel.org>,
	"kvm@vger.kernel.org" <kvm@vger.kernel.org>
Subject: RE: [PATCH 1/2] kvm/powerpc: rename kvm_hypercall() to epapr_hypercall()
Date: Mon, 07 Oct 2013 16:04:23 +0000	[thread overview]
Message-ID: <6A3DF150A5B70D4F9B66A25E3F7C888D071945CB@039-SN2MPN1-011.039d.mgd.msft.net> (raw)
In-Reply-To: <577DB53B-9313-4B98-A1E1-C9C97ED53819@suse.de>



> -----Original Message-----
> From: kvm-ppc-owner@vger.kernel.org [mailto:kvm-ppc-owner@vger.kernel.org] On
> Behalf Of Alexander Graf
> Sent: Monday, October 07, 2013 9:16 PM
> To: Bhushan Bharat-R65777
> Cc: Wood Scott-B07421; kvm-ppc@vger.kernel.org; kvm@vger.kernel.org
> Subject: Re: [PATCH 1/2] kvm/powerpc: rename kvm_hypercall() to
> epapr_hypercall()
> 
> 
> On 07.10.2013, at 17:43, Bhushan Bharat-R65777 <R65777@freescale.com> wrote:
> 
> >>>>>>>>> at least when I can avoid it. With the current code the
> >>>>>>>>> compiler would be
> >>>>>> smart enough to just optimize out the complete branch.
> >>>>>>>>
> >>>>>>>> Sure.  My point is, where would you be calling that where the
> >>>>>>>> entire file isn't predicated on (or selecting) CONFIG_KVM_GUEST
> >>>>>>>> or
> >> similar?
> >>>>>>>>
> >>>>>>>> We don't do these stubs for every single function in the kernel
> >>>>>>>> -- only ones where the above is a reasonable use case.
> >>>>>>>
> >>>>>>> Yeah, I'm fine on dropping it, but we need to make that a
> >>>>>>> conscious decision
> >>>>>> and verify that no caller relies on it.
> >>>>>>
> >>>>>> kvm_para_has_feature() is called from arch/powerpc/kernel/kvm.c,
> >>>>>> arch/x86/kernel/kvm.c, and arch/x86/kernel/kvmclock.c, all of
> >>>>>> which are enabled by CONFIG_KVM_GUEST.
> >>>>>>
> >>>>>> I did find one example of kvm_para_available() being used in an
> >>>>>> unexpected place
> >>>>>> -- sound/pci/intel8x0.c.  It defines its own non-CONFIG_KVM_GUEST
> >>>>>> stub, even though x86 defines kvm_para_available() using inline
> >>>>>> CPUID stuff which should work without CONFIG_KVM_GUEST.
> >>>>>> I'm not sure why it even needs to do that, though -- shouldn't
> >>>>>> the subsequent PCI subsystem vendor/device check should be sufficient?
> >>>>>> No hypercalls are involved.
> >>>>>>
> >>>>>> That said, the possibility that some random driver might want to
> >>>>>> make use of paravirt features is a decent argument for keeping the stub.
> >>>>>>
> >>>>>
> >>>>> I am not sure where we are agreeing on?
> >>>>> Do we want to remove the stub in
> >>>>> arch/powerpc/include/asm/kvm_para.h
> >>>>> ? as
> >>>> there is no caller without KVM_GUEST and in future caller ensure
> >>>> this to be called only from code selected by KVM_GUEST?
> >>>>>
> >>>>> Or let this stub stay to avoid any random driver calling this ?
> >>>>
> >>>> I think the most reasonable way forward is to add a stub for
> >>>> non-CONFIG_EPAPR to the epapr code, then replace the kvm bits with
> >>>> generic epapr bits (which your patches already do).
> >>>
> >>> Please describe which stub you are talking about.
> >>
> >> kvm_hypercall is always available, regardless of the config option,
> >> which makes all its subfunctions always available as well.
> >
> > This patch renames kvm_hypercall() to epapr_hypercall() and which is always
> available. And the kvm_hypercall() friends now directly calls epapr_hypercall().
> > IIUC, So what you are trying to say is let the kvm_hypercall() friends keep on
> calling kvm_hypercall() itself and a sub something like this:
> 
> No, what I'm saying is that we either
> 
>   a) drop the whole #ifndef code path consciously. This would have to be a
> separate patch with a separate discussion. It's orthogonal to combining
> kvm_hypercall() and epapr_hypercall()
> 
>   b) add the #ifndef path to epapr_hypercall()

Do you mean like this in arch/powerpc/include/asm/epapr_hcalls.h

#ifdef CONFIG_KVM_GUEST
static inline unsigned long epapr_hypercall(unsigned long *in,
                           unsigned long *out,
                           unsigned long nr)
{
 // code for this function
} 
#else
static inline unsigned long epapr_hypercall(unsigned long *in,
                           unsigned long *out,
                           unsigned long nr)
{
	return EV_UNIMPLEMENTED;
}
#endif

> 
> I prefer b, Scott prefers b.
> 
> 
> Alex
> 
> --
> To unsubscribe from this list: send the line "unsubscribe kvm-ppc" in the body
> of a message to majordomo@vger.kernel.org More majordomo info at
> http://vger.kernel.org/majordomo-info.html



  reply	other threads:[~2013-10-07 16:04 UTC|newest]

Thread overview: 48+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2013-09-23  5:23 [PATCH 0/2] kvm/powerpc: hypercall related cleanup Bharat Bhushan
2013-09-23  5:35 ` Bharat Bhushan
2013-09-23  5:23 ` [PATCH 1/2] kvm/powerpc: rename kvm_hypercall() to epapr_hypercall() Bharat Bhushan
2013-09-23  5:35   ` Bharat Bhushan
2013-09-23 22:45   ` Scott Wood
2013-09-23 22:45     ` Scott Wood
2013-09-23 22:57     ` Scott Wood
2013-09-23 22:57       ` Scott Wood
2013-10-02 14:19   ` Alexander Graf
2013-10-02 14:19     ` Alexander Graf
2013-10-02 16:40     ` Scott Wood
2013-10-02 16:40       ` Scott Wood
2013-10-02 16:53       ` Alexander Graf
2013-10-02 16:53         ` Alexander Graf
2013-10-02 17:04         ` Scott Wood
2013-10-02 17:04           ` Scott Wood
2013-10-02 17:17           ` Alexander Graf
2013-10-02 17:17             ` Alexander Graf
2013-10-02 17:42             ` Scott Wood
2013-10-02 17:42               ` Scott Wood
2013-10-02 17:46               ` Alexander Graf
2013-10-02 17:46                 ` Alexander Graf
2013-10-02 17:49                 ` Scott Wood
2013-10-02 17:49                   ` Scott Wood
2013-10-02 17:54                   ` Alexander Graf
2013-10-02 17:54                     ` Alexander Graf
2013-10-02 18:33                     ` Scott Wood
2013-10-02 18:33                       ` Scott Wood
2013-10-04  4:26                       ` Bhushan Bharat-R65777
2013-10-04  4:26                         ` Bhushan Bharat-R65777
2013-10-04 11:16                         ` Alexander Graf
2013-10-04 11:16                           ` Alexander Graf
2013-10-07 15:15                           ` Bhushan Bharat-R65777
2013-10-07 15:15                             ` Bhushan Bharat-R65777
2013-10-07 15:20                             ` Alexander Graf
2013-10-07 15:20                               ` Alexander Graf
2013-10-07 15:43                               ` Bhushan Bharat-R65777
2013-10-07 15:43                                 ` Bhushan Bharat-R65777
2013-10-07 15:46                                 ` Alexander Graf
2013-10-07 15:46                                   ` Alexander Graf
2013-10-07 16:04                                   ` Bhushan Bharat-R65777 [this message]
2013-10-07 16:04                                     ` Bhushan Bharat-R65777
2013-10-07 16:12                                     ` Alexander Graf
2013-10-07 16:12                                       ` Alexander Graf
2013-10-07 16:15                                       ` Bhushan Bharat-R65777
2013-10-07 16:15                                         ` Bhushan Bharat-R65777
2013-09-23  5:23 ` [PATCH 2/2] kvm/powerpc: move kvm_hypercall0() and friends to epapr_hypercall0() Bharat Bhushan
2013-09-23  5:35   ` Bharat Bhushan

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=6A3DF150A5B70D4F9B66A25E3F7C888D071945CB@039-SN2MPN1-011.039d.mgd.msft.net \
    --to=r65777@freescale.com \
    --cc=B07421@freescale.com \
    --cc=agraf@suse.de \
    --cc=kvm-ppc@vger.kernel.org \
    --cc=kvm@vger.kernel.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.