qemu-devel.nongnu.org archive mirror
 help / color / mirror / Atom feed
From: Viktor Mihajlovski <mihajlov@linux.vnet.ibm.com>
To: David Hildenbrand <david@redhat.com>, qemu-devel@nongnu.org
Cc: borntraeger@de.ibm.com, Eduardo Habkost <ehabkost@redhat.com>,
	jjherne@linux.vnet.ibm.com
Subject: Re: [Qemu-devel] [PATCH] s390: return unavailable features via query-cpu-definitions
Date: Mon, 3 Jul 2017 09:04:19 +0200	[thread overview]
Message-ID: <e2c34fc2-97e0-0a16-c04d-9a039e2d402d@linux.vnet.ibm.com> (raw)
In-Reply-To: <5566d3c2-f791-eab2-cafa-795c96739d8c@redhat.com>

On 30.06.2017 18:47, David Hildenbrand wrote:
> On 30.06.2017 15:25, Viktor Mihajlovski wrote:
>> The response for query-cpu-definitions didn't include the
>> unavailable-features field, which is used by libvirt to figure
>> out whether a certain cpu model is usable on the host.
>>
>> The unavailable features are now computed by obtaining the host CPU
>> model and comparing its feature bitmap with the feature bitmaps of
>> the known CPU models.
>>
>> I.e. the output of virsh domcapabilities would change from
>>  ...
>>      <mode name='custom' supported='yes'>
>>       <model usable='unknown'>z10EC-base</model>
>>       <model usable='unknown'>z9EC-base</model>
>>       <model usable='unknown'>z196.2-base</model>
>>       <model usable='unknown'>z900-base</model>
>>       <model usable='unknown'>z990</model>
>>  ...
>> to
>>  ...
>>      <mode name='custom' supported='yes'>
>>       <model usable='yes'>z10EC-base</model>
>>       <model usable='yes'>z9EC-base</model>
>>       <model usable='no'>z196.2-base</model>
>>       <model usable='yes'>z900-base</model>
>>       <model usable='yes'>z990</model>
>>  ...
>>
>> Signed-off-by: Viktor Mihajlovski <mihajlov@linux.vnet.ibm.com>
>> ---
>>  target/s390x/cpu_models.c | 51 ++++++++++++++++++++++++++++++++++++++++++-----
>>  1 file changed, 46 insertions(+), 5 deletions(-)
>>
>> diff --git a/target/s390x/cpu_models.c b/target/s390x/cpu_models.c
>> index 63903c2..dc3371f 100644
>> --- a/target/s390x/cpu_models.c
>> +++ b/target/s390x/cpu_models.c
>> @@ -283,14 +283,43 @@ void s390_cpu_list(FILE *f, fprintf_function print)
>>      }
>>  }
>>  
>> +static S390CPUModel *get_max_cpu_model(Error **errp);
>> +
>>  #ifndef CONFIG_USER_ONLY
>> +static void list_add_feat(const char *name, void *opaque);
>> +
>> +static void check_unavailable_features(const S390CPUModel *max_model,
>> +                                       const S390CPUModel *model,
>> +                                       strList **unavailable)
>> +{
>> +    S390FeatBitmap missing;
>> +
>> +    /* detect missing features if any to properly report them */
>> +    bitmap_andnot(missing, model->features, max_model->features,
>> +                  S390_FEAT_MAX);
>> +    if (!bitmap_empty(missing, S390_FEAT_MAX)) {
>> +        s390_feat_bitmap_to_ascii(missing,
>> +                                  unavailable,
>> +                                  list_add_feat);
> 
> I remember discussing this with Eduardo when he introduced this.
> 
> There is one additional case to handle here that might turn a CPU model
> not runnable. This can happen when trying to run a new CPU model on an
> old host, where the features are not the problem, but the model itself.
> E.g. running a GA2 version on a GA1 is not allowed. But this can happen
> more generally also between hardware generations.
> 
> Therefore, whenever the model is never than the host model, we have to
> add here the special property "type" as missing feature. The
> documentation partly coveres what we had in mind.>
> qapi-schema.json:
> # @unavailable-features is a list of QOM property names that
> 
> # represent CPU model attributes that prevent the CPU from running.
> 
> # If the QOM property is read-only, that means there's no known
> 
> # way to make the CPU model run in the current host. Implementations
> 
> # that choose not to provide specific information return the
> 
> # property name "type".
> 
> We discussed that "type" should always be added if there is no way to
> make the model runnable (by simply removing features).
Thanks for the clarification.
I guess I was reading that too narrow-minded (no specific information vs
type), although I had the suspicion that features alone wouldn't
suffice. I will follow the query_cpu_model_comparison pattern and return
both "type" and the real features.
> > See check_compatibility() for details. For these cases, add "type" to
> the list. (you might be able to extend check_compatibility(), making
> e.g. the *errp and *unavailable parameters optional).
> 

-- 

Mit freundlichen Grüßen/Kind Regards
   Viktor Mihajlovski

IBM Deutschland Research & Development GmbH
Vorsitzender des Aufsichtsrats: Martina Köderitz
Geschäftsführung: Dirk Wittkopp
Sitz der Gesellschaft: Böblingen
Registergericht: Amtsgericht Stuttgart, HRB 243294

      reply	other threads:[~2017-07-03  7:04 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2017-06-30 13:25 [Qemu-devel] [PATCH] s390: return unavailable features via query-cpu-definitions Viktor Mihajlovski
2017-06-30 16:47 ` David Hildenbrand
2017-07-03  7:04   ` Viktor Mihajlovski [this message]

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=e2c34fc2-97e0-0a16-c04d-9a039e2d402d@linux.vnet.ibm.com \
    --to=mihajlov@linux.vnet.ibm.com \
    --cc=borntraeger@de.ibm.com \
    --cc=david@redhat.com \
    --cc=ehabkost@redhat.com \
    --cc=jjherne@linux.vnet.ibm.com \
    --cc=qemu-devel@nongnu.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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).