All of lore.kernel.org
 help / color / mirror / Atom feed
From: "Jan Beulich" <JBeulich@suse.com>
To: Andrew Cooper <andrew.cooper3@citrix.com>,
	Paul Durrant <paul.durrant@citrix.com>
Cc: Keir Fraser <keir@xen.org>,
	xen-devel@lists.xen.org, Ian Jackson <ian.jackson@eu.citrix.com>,
	Ian Campbell <ian.campbell@citrix.com>,
	Stefano Stabellini <stefano.stabellini@eu.citrix.com>
Subject: Re: [PATCH v2 1/3] x86/viridian: Re-purpose the HVM parameter to be a feature mask
Date: Mon, 04 Aug 2014 14:50:02 +0100	[thread overview]
Message-ID: <53DFABAA02000078000290C4@mail.emea.novell.com> (raw)
In-Reply-To: <53DF8B21.2040907@citrix.com>

>>> On 04.08.14 at 15:31, <andrew.cooper3@citrix.com> wrote:
> On 04/08/14 14:12, Paul Durrant wrote:
>> --- a/xen/arch/x86/hvm/hvm.c
>> +++ b/xen/arch/x86/hvm/hvm.c
>> @@ -5533,8 +5533,22 @@ long do_hvm_op(unsigned long op, 
> XEN_GUEST_HANDLE_PARAM(void) arg)
>>                      rc = -EINVAL;
>>                  break;
>>              case HVM_PARAM_VIRIDIAN:
>> -                if ( a.value > 1 )
>> -                    rc = -EINVAL;
>> +                /* This should only ever be set once by the tools and read by the guest. */
>> +                rc = -EPERM;
>> +                if ( curr_d == d )
>> +                    break;
>> +
>> +                rc = -EPERM;
>> +                if ( d->arch.hvm_domain.params[a.index] &&
>> +                     a.value != d->arch.hvm_domain.params[a.index] )
>> +                    break;
> 
> Setting it twice should be an error, even if it is set to the same value
> again.

I specifically asked for it to be done this way, such that redundant
calls wouldn't needlessly fail. Remember that we're altering an
existing interface, and hence should be careful about breaking
existing callers.

>  Also, EEXIST would be a better error.

I agree with this part.

>> +/* Disable timer frequency MSRs (HV_X64_MSR_TSC_FREQUENCY and
>> + * HV_X64_MSR_APIC_FREQUENCY).
>> + * This modification restores the viridian feature set to the
>> + * original 'base' set exposed in releases prior to Xen 4.4.
>> + */
>> +#define _HVMPV_no_freq 1
>> +#define HVMPV_no_freq  (1 << _HVMPV_no_freq)
>> +
>> +#define HVMPV_feature_mask (HVMPV_base_freq|HVMPV_no_freq)
> 
> Please could we avoid introducing new negated-sense booleans, especially
> when their predominant use is "if ( !$FOO_no_BAR )"

What would your alternative proposal be, again keeping in mind that
existing callers must not observe a behavioral change?

Jan

  reply	other threads:[~2014-08-04 13:50 UTC|newest]

Thread overview: 18+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2014-08-04 13:12 [PATCH v2 0/3] x86/viridian improvements Paul Durrant
2014-08-04 13:12 ` [PATCH v2 1/3] x86/viridian: Re-purpose the HVM parameter to be a feature mask Paul Durrant
2014-08-04 13:31   ` Andrew Cooper
2014-08-04 13:50     ` Jan Beulich [this message]
2014-08-04 14:50       ` Andrew Cooper
2014-08-04 15:13         ` Jan Beulich
2014-08-04 17:19     ` Paul Durrant
2014-08-04 13:45   ` Jan Beulich
2014-08-04 13:12 ` [PATCH v2 2/3] x86/viridian: Note that logging is under control of the guest Paul Durrant
2014-08-04 13:38   ` Andrew Cooper
2014-08-04 13:45     ` Paul Durrant
2014-08-04 13:12 ` [PATCH v2 3/3] x86/viridian: Add partition time reference counter MSR support Paul Durrant
2014-08-04 14:01   ` Jan Beulich
2014-08-04 14:12     ` Paul Durrant
2014-08-04 14:47       ` Paul Durrant
2014-08-04 15:11         ` Paul Durrant
2014-08-04 15:15           ` Jan Beulich
2014-08-04 15:23             ` Paul Durrant

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=53DFABAA02000078000290C4@mail.emea.novell.com \
    --to=jbeulich@suse.com \
    --cc=andrew.cooper3@citrix.com \
    --cc=ian.campbell@citrix.com \
    --cc=ian.jackson@eu.citrix.com \
    --cc=keir@xen.org \
    --cc=paul.durrant@citrix.com \
    --cc=stefano.stabellini@eu.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.