All of lore.kernel.org
 help / color / mirror / Atom feed
From: Jane Malalane <Jane.Malalane@citrix.com>
To: Roger Pau Monne <roger.pau@citrix.com>, Jan Beulich <jbeulich@suse.com>
Cc: Xen-devel <xen-devel@lists.xenproject.org>, Wei Liu <wl@xen.org>,
	"Anthony Perard" <anthony.perard@citrix.com>,
	Juergen Gross <jgross@suse.com>,
	"Andrew Cooper" <Andrew.Cooper3@citrix.com>,
	George Dunlap <George.Dunlap@citrix.com>,
	Julien Grall <julien@xen.org>,
	Stefano Stabellini <sstabellini@kernel.org>,
	Christian Lindig <christian.lindig@citrix.com>,
	David Scott <dave@recoil.org>,
	Volodymyr Babchuk <Volodymyr_Babchuk@epam.com>
Subject: Re: [PATCH v5 2/2] x86/xen: Allow per-domain usage of hardware virtualized APIC
Date: Tue, 8 Mar 2022 14:31:31 +0000	[thread overview]
Message-ID: <81dc2758-accc-25a3-7b3c-d9988757dd0c@citrix.com> (raw)
In-Reply-To: <YidM/Wu5lqF48zg2@Air-de-Roger>

On 08/03/2022 12:33, Roger Pau Monné wrote:
> On Tue, Mar 08, 2022 at 01:24:23PM +0100, Jan Beulich wrote:
>> On 08.03.2022 12:38, Roger Pau Monné wrote:
>>> On Mon, Mar 07, 2022 at 03:06:09PM +0000, Jane Malalane wrote:
>>>> @@ -685,13 +687,31 @@ int arch_sanitise_domain_config(struct xen_domctl_createdomain *config)
>>>>           }
>>>>       }
>>>>   
>>>> -    if ( config->arch.misc_flags & ~XEN_X86_MSR_RELAXED )
>>>> +    if ( config->arch.misc_flags & ~(XEN_X86_MSR_RELAXED |
>>>> +                                     XEN_X86_ASSISTED_XAPIC |
>>>> +                                     XEN_X86_ASSISTED_X2APIC) )
>>>>       {
>>>>           dprintk(XENLOG_INFO, "Invalid arch misc flags %#x\n",
>>>>                   config->arch.misc_flags);
>>>>           return -EINVAL;
>>>>       }
>>>>   
>>>> +    if ( (assisted_xapic || assisted_x2apic) && !hvm )
>>>> +    {
>>>> +        dprintk(XENLOG_INFO,
>>>> +                "Interrupt Controller Virtualization not supported for PV\n");
>>>> +        return -EINVAL;
>>>> +    }
>>>> +
>>>> +    if ( (assisted_xapic && !assisted_xapic_available) ||
>>>> +         (assisted_x2apic && !assisted_x2apic_available) )
>>>> +    {
>>>> +        dprintk(XENLOG_INFO,
>>>> +                "Hardware assisted x%sAPIC requested but not available\n",
>>>> +                assisted_xapic && !assisted_xapic_available ? "" : "2");
>>>> +        return -EINVAL;
>>>
>>> I think for those two you could return -ENODEV if others agree.
>>
>> If by "two" you mean the xAPIC and x2APIC aspects here (and not e.g. this
>> and the earlier if()), then I agree. I'm always in favor of using distinct
>> error codes when possible and at least halfway sensible.
> 
> I would be fine by using it for the !hvm if also. IMO it makes sense
> as PV doesn't have an APIC 'device' at all, so ENODEV would seem
> fitting. EINVAL is also fine as the caller shouldn't even attempt that
> in the first place.
> 
> So let's use it for the last if only.
Wouldn't it make more sense to use -ENODEV particularly for the first? I 
agree that -ENODEV should be reported in the first case because it 
doesn't make sense to request acceleration of something that doesn't 
exist and I should have put that. But having a look at the hap code 
(since it resembles the second case), it returns -EINVAL when it is not 
available, unless you deem this to be different or, in retrospective, 
that the hap code should too have been coded to return -ENODEV.

if ( hap && !hvm_hap_supported() )
     {
         dprintk(XENLOG_INFO, "HAP requested but not available\n");
         return -EINVAL;
     }

I agree with all the other comments and have made the approp changes for 
v6. Thanks a lot.

Jane.

  reply	other threads:[~2022-03-08 14:31 UTC|newest]

Thread overview: 27+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-03-07 15:06 [PATCH v5 0/2] xen: Report and use hardware APIC virtualization capabilities Jane Malalane
2022-03-07 15:06 ` [PATCH v5 1/2] xen+tools: Report Interrupt Controller Virtualization capabilities on x86 Jane Malalane
2022-03-08 10:39   ` Roger Pau Monné
2022-03-08 17:31   ` [PATCH v6 " Jane Malalane
2022-03-09 10:36     ` Roger Pau Monné
2022-03-11 15:09       ` Jane Malalane
2022-03-11 15:04     ` [PATCH v7 " Jane Malalane
2022-03-14  6:40   ` [PATCH v5 " Tian, Kevin
2022-03-07 15:06 ` [PATCH v5 2/2] x86/xen: Allow per-domain usage of hardware virtualized APIC Jane Malalane
2022-03-08 11:38   ` Roger Pau Monné
2022-03-08 12:24     ` Jan Beulich
2022-03-08 12:33       ` Roger Pau Monné
2022-03-08 14:31         ` Jane Malalane [this message]
2022-03-08 14:41           ` Jan Beulich
2022-03-09 15:56             ` Jane Malalane
2022-03-09 16:51               ` Jan Beulich
2022-03-09 17:02                 ` Jane Malalane
2022-03-08 15:44     ` Jane Malalane
2022-03-08 16:02       ` Roger Pau Monné
2022-03-08 16:13         ` Jane Malalane
2022-03-08 16:16         ` Jane Malalane
2022-03-08 16:22           ` Roger Pau Monné
2022-03-08 17:36   ` [PATCH v6 " Jane Malalane
2022-03-09 11:48     ` Roger Pau Monné
2022-03-09 13:23     ` Jan Beulich
2022-03-09 13:51     ` Roger Pau Monné
2022-03-11 15:08     ` [PATCH v7 " Jane Malalane

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=81dc2758-accc-25a3-7b3c-d9988757dd0c@citrix.com \
    --to=jane.malalane@citrix.com \
    --cc=Andrew.Cooper3@citrix.com \
    --cc=George.Dunlap@citrix.com \
    --cc=Volodymyr_Babchuk@epam.com \
    --cc=anthony.perard@citrix.com \
    --cc=christian.lindig@citrix.com \
    --cc=dave@recoil.org \
    --cc=jbeulich@suse.com \
    --cc=jgross@suse.com \
    --cc=julien@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 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.