All of lore.kernel.org
 help / color / mirror / Atom feed
From: Andrew Cooper <andrew.cooper3@citrix.com>
To: Jan Beulich <JBeulich@suse.com>
Cc: Wei Liu <wei.liu2@citrix.com>, Xen-devel <xen-devel@lists.xen.org>
Subject: Re: [PATCH 5/7] x86/traps: Lift all non-entrypoint logic in entry_int82() up into C
Date: Wed, 3 May 2017 19:29:12 +0100	[thread overview]
Message-ID: <24cbb437-39ab-5838-d989-9e7c1be0f696@citrix.com> (raw)
In-Reply-To: <5909EB2302000078001565B9@prv-mh.provo.novell.com>

On 03/05/17 13:37, Jan Beulich wrote:
>>>> On 03.05.17 at 14:18, <andrew.cooper3@citrix.com> wrote:
>> On 03/05/17 13:02, Jan Beulich wrote:
>>>>>> On 03.05.17 at 13:38, <andrew.cooper3@citrix.com> wrote:
>>>> On 03/05/17 12:26, Wei Liu wrote:
>>>>> On Wed, May 03, 2017 at 03:02:25AM -0600, Jan Beulich wrote:
>>>>>>>>> On 02.05.17 at 20:05, <andrew.cooper3@citrix.com> wrote:
>>>>>>> --- /dev/null
>>>>>>> +++ b/xen/arch/x86/pv/traps.c
>>>>>>> @@ -0,0 +1,44 @@
>>>>>>>
>> +/***************************************************************************
>>>> ***
>>>>>>> + * arch/x86/pv/traps.c
>>>>>>> + *
>>>>>>> + * PV low level entry points.
>>>>>>> + *
>>>>>>> + * This program is free software; you can redistribute it and/or modify
>>>>>>> + * it under the terms of the GNU General Public License as published by
>>>>>>> + * the Free Software Foundation; either version 2 of the License, or
>>>>>>> + * (at your option) any later version.
>>>>>>> + *
>>>>>>> + * This program is distributed in the hope that it will be useful,
>>>>>>> + * but WITHOUT ANY WARRANTY; without even the implied warranty of
>>>>>>> + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
>>>>>>> + * GNU General Public License for more details.
>>>>>>> + *
>>>>>>> + * You should have received a copy of the GNU General Public License
>>>>>>> + * along with this program; If not, see <http://www.gnu.org/licenses/>.
>>>>>>> + *
>>>>>>> + * Copyright (c) 2017 Citrix Systems Ltd.
>>>>>>> + */
>>>>>>> +
>>>>>>> +#include <xen/hypercall.h>
>>>>>>> +
>>>>>>> +#include <asm/apic.h>
>>>>>>> +
>>>>>>> +#ifdef CONFIG_COMPAT
>>>>>> As expressed before, I disagree to the re-introduction of such
>>>>>> conditionals in x86 code.
>>>>>>
>>>>> I'm curious to know how the COMPAT interface is treated long term.
>>>>>
>>>>> I guess you're of the opinion that we should always have them enabled?
>>>> There is a valid usecase to disable CONFIG_COMPAT, seeing as sufficient
>>>> PVH interfaces exist to start APs straight in 64bit mode, as it provides
>>>> a meaningful reduction in hypervisor attack surface.
>>> What does PVH have to do with 32-bit PV compat guest support?
>> Nothing.  I am unsure as to why do you think it does?
>>
>> The CONFIG_COMPAT infrastructure by HVM guests as well. 
> A rather small part of it, if at all. And if HVM guests really use parts
> of it, we can't disable it without breaking such guests running
> (perhaps just temporarily) in 32-bit mode.
>
>>>> As it is a configurable option, I intend to work in a direction which
>>>> eventually makes it usable under x86.
>>>>
>>>> If there is a wish to move in an opposite direction, that should be a
>>>> separate discussion made over a patch removing its entry from
>>>> common/Kconfig.
>>> Once again - from common code perspective this is a valid config
>>> option to have. X86, however, unconditionally selects it, so there's
>>> no point having such conditionals in x86 code.
>> I don't agree with this reasoning.  If it is a reasonable configuration
>> for common code to use, it is a reasonable configuration for x86 code to
>> use.
> Depends: It's there in common code to skip the respective pieces of
> code for architectures not needing it. It used to be a meaningful
> option in x86 as long as there was a 32-bit hypervisor.
>
>> Or do you disagree with my argument for why it should be a configurable
>> option which can be turned off in an x86 build?
> Well, I'd first of all have to check again how much of this really is
> being used by HVM code. Hmm, looks like it's more than I did
> remember. But with all CONFIG_COMPAT uses gone from x86
> code (minus the ones you introduced not very long ago), I don't
> see why you want to re-introduce a few more now. If we really
> want the option of disabling that code, a concerted effort should
> be made to re-add the conditionals wherever needed. Otherwise
> we'll end up with code where readers would legitimately ask why
> the conditionals are there in some places, but missing in many
> others. And no, I wouldn't view a patch like the one here as the
> beginning of a transitional period (as expressed before, I should
> have noticed and objected to the re-introduction of such #ifdef-s
> in your PV hypercall changes).

The reason c/s de82feebf2c uses CONFIG_COMPAT is because of

struct mc_state {
    unsigned long flags;
    union {
        struct multicall_entry call;
#ifdef CONFIG_COMPAT
        struct compat_multicall_entry compat_call;
#endif
    };
};

being defined using CONFIG_COMPAT.  It didn't even cross my mind that it
might have been ok to allow the code to fail to compile if CONFIG_COMPAT
was not selected.  I therefore wrote code which matched the structure
definition it was using.


Irrespective of the history which lead to this point, the important
question is whether we want to allow compiling x86 without CONFIG_COMPAT.

If the eventual decision is yes, then new code should specifically be
introduced as being CONFIG_COMPAT-clean, because decisions like that
affect how to structure the code in the first place, and therefore be
far cleaner changes than trying to retrofit CONFIG_COMPAT in the future.

~Andrew

_______________________________________________
Xen-devel mailing list
Xen-devel@lists.xen.org
https://lists.xen.org/xen-devel

  reply	other threads:[~2017-05-03 18:29 UTC|newest]

Thread overview: 48+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2017-05-02 18:05 [PATCH 0/7] XSAs 213-315 followups Andrew Cooper
2017-05-02 18:05 ` [PATCH 1/7] x86/traps: Drop 32bit fields out of tss_struct Andrew Cooper
2017-05-03  8:10   ` Jan Beulich
2017-05-03 12:33     ` Andrew Cooper
2017-05-03  9:48   ` Wei Liu
2017-05-02 18:05 ` [PATCH 2/7] x86/traps: Poison unused stack pointers in the TSS Andrew Cooper
2017-05-03  8:14   ` Jan Beulich
2017-05-03 12:47     ` Andrew Cooper
2017-05-03 13:29   ` [PATCH v2 " Andrew Cooper
2017-05-03 13:45     ` Jan Beulich
2017-05-02 18:05 ` [PATCH 3/7] x86/mm: Further restrict permissions on some virtual mappings Andrew Cooper
2017-05-03  8:49   ` Jan Beulich
2017-05-03 13:38     ` Andrew Cooper
2017-05-03 13:48       ` Jan Beulich
2017-05-03  9:48   ` Wei Liu
2017-05-03 10:11   ` Tim Deegan
2017-05-03 11:13   ` George Dunlap
2017-05-02 18:05 ` [PATCH 4/7] x86/traps: Rename compat_hypercall() to entry_int82() Andrew Cooper
2017-05-03  8:55   ` Jan Beulich
2017-05-03 13:41     ` Andrew Cooper
2017-05-02 18:05 ` [PATCH 5/7] x86/traps: Lift all non-entrypoint logic in entry_int82() up into C Andrew Cooper
2017-05-03  9:02   ` Jan Beulich
2017-05-03 11:26     ` Wei Liu
2017-05-03 11:38       ` Andrew Cooper
2017-05-03 11:43         ` Wei Liu
2017-05-03 12:02         ` Jan Beulich
2017-05-03 12:18           ` Andrew Cooper
2017-05-03 12:37             ` Jan Beulich
2017-05-03 18:29               ` Andrew Cooper [this message]
2017-05-04  7:27                 ` Jan Beulich
2017-05-04  9:27                   ` Andrew Cooper
2017-05-04  9:36                     ` Jan Beulich
2017-05-04  9:57                       ` Andrew Cooper
2017-05-03 12:00       ` Jan Beulich
2017-05-04 10:01     ` [PATCH v2 " Andrew Cooper
2017-05-04 10:16       ` Andrew Cooper
2017-05-04 10:28         ` Jan Beulich
2017-05-04 11:09           ` Andrew Cooper
2017-05-04 10:22       ` Jan Beulich
2017-05-02 18:05 ` [PATCH 6/7] x86/asm: Fold LOAD_C_CLOBBERED into RESTORE_ALL Andrew Cooper
2017-05-03  9:08   ` Jan Beulich
2017-05-03  9:48   ` Wei Liu
2017-05-02 18:05 ` [PATCH 7/7] x86/asm: Clobber %r{8..15} on exit to 32bit PV guests Andrew Cooper
2017-05-03  9:13   ` Jan Beulich
2017-05-03 17:51     ` [PATCH v2 " Andrew Cooper
2017-05-04  8:50       ` Jan Beulich
2017-05-04 11:11 ` [RFC for 4.9] [PATCH 0/7] XSAs 213-315 followups Andrew Cooper
2017-05-04 12:52   ` Julien Grall

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=24cbb437-39ab-5838-d989-9e7c1be0f696@citrix.com \
    --to=andrew.cooper3@citrix.com \
    --cc=JBeulich@suse.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.