qemu-devel.nongnu.org archive mirror
 help / color / mirror / Atom feed
From: Paolo Bonzini <pbonzini@redhat.com>
To: Markus Armbruster <armbru@redhat.com>,
	Roman Bolshakov <r.bolshakov@yadro.com>
Cc: Kevin Wolf <kwolf@redhat.com>, John Snow <jsnow@redhat.com>,
	"Daniel P. Berrange" <berrange@redhat.com>,
	Eduardo Habkost <ehabkost@redhat.com>,
	qemu-devel@nongnu.org
Subject: Re: [PATCH for-6.0 1/6] qapi: Add query-accel command
Date: Wed, 18 Nov 2020 10:21:06 +0100	[thread overview]
Message-ID: <b9307f87-5350-21a6-68dd-d4efbae5e502@redhat.com> (raw)
In-Reply-To: <87ft57oycu.fsf@dusky.pond.sub.org>

On 18/11/20 09:36, Markus Armbruster wrote:
> 
> The part that counts is do_configure_accelerator().  I works as follows:
> 
> 1. Look up the chosen accelerator's QOM type (can fail)
> 2. Instantiate it (can't fail)
> 3. Set properties (can fail)
> 4. Connect the accelerator to the current machine (can fail)
> 
> Aside: step 3 uses &error_fatal, unlike the other failures.  Fishy.

That's because step 3 is a user error, unlike (in the usual case) the 
others:

1. You get it from "-accel whpx" if whpx is not available; this is not a 
user error if there is a fallback.  You also get it from misspellings 
such as "-accel kvmm", which is presumably a user error, but it's hard 
to distinguish the two especially if a future version of QEMU ends up 
adding a "kvmm" accelerator

3. You get it from "-accel tcg,misspeled-property=off".  This is a user 
error.  You also get it from "-accel tcg,absent-property=on" and "-accel 
tcg,invalid-value=42".  This may be a property that the user wants to 
set but was only added in a future version of QEMU.  Either way, it's 
quite likely that the user does _not_ want a fallback here.

4. Here the accelerator exists but the machine does not support it.  The 
choice is to fallback to the next accelerato.

This means there is no way for the user to distinguish "the accelerator 
doesn't exist" from "the accelerator exists but is not supported".  This 
was done for no particular reason other than to keep the code simple.

> Failure in step 1 is "accelerator not compiled in".  Predictable with
> qom-list-types.
> 
> Failure in step 3 doesn't look predictable.

It's more or less predictable with qom-list-properties, though of course 
not the "invalid value for the property" case.

> Failure in step 4 can be due to kernel lacking (a workable version of)
> KVM, but the current machine gets a say, too.  Also doesn't look
> predictable.
> 
> Aside: kvm_init() reports errors with fprintf(), tsk, tsk, tsk.
> 
> Existing query-kvm doesn't really predict failure, either.  'present' is
> true if CONFIG_KVM.  Should be equivalent to "QOM type exists",
> i.e. step 1.  I guess 'enabled' is true when the KVM accelerator is in
> use.
> 
> While figuring this out, I noticed that the TYPE_ACCEL instance we
> create doesn't get its parent set.  It's therefore not in the QOM
> composition tree, and inaccessible with qom-get.  Paolo, is this as it
> should be?

It should be added, I agree, perhaps as /machine/accel.

Paolo



  reply	other threads:[~2020-11-18  9:21 UTC|newest]

Thread overview: 45+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-11-16 13:10 [PATCH for-6.0 0/6] Add HMP/QMP commands to query accelerator Roman Bolshakov
2020-11-16 13:10 ` [PATCH for-6.0 1/6] qapi: Add query-accel command Roman Bolshakov
2020-11-16 16:20   ` Eric Blake
2020-11-16 18:56     ` Roman Bolshakov
2020-11-16 21:13     ` Eduardo Habkost
2020-11-17  8:51       ` Markus Armbruster
2020-11-18  1:19         ` Roman Bolshakov
2020-11-18  8:36           ` Markus Armbruster
2020-11-18  9:21             ` Paolo Bonzini [this message]
2020-11-18 13:08               ` Markus Armbruster
2020-11-18 13:46                 ` Paolo Bonzini
2020-11-18 14:45                   ` Markus Armbruster
2020-11-18 14:54                     ` Paolo Bonzini
2020-11-18 14:00                 ` Roman Bolshakov
2020-11-18 11:28             ` Kevin Wolf
2020-11-18 11:56               ` Daniel P. Berrangé
2020-11-18 13:53                 ` Markus Armbruster
2020-11-18 15:45                   ` Eduardo Habkost
2020-11-18 15:56                     ` Eric Blake
2020-11-18 16:23                       ` Eduardo Habkost
2020-11-19 13:17                         ` Markus Armbruster
2020-11-30 17:05   ` Philippe Mathieu-Daudé
2020-11-16 13:10 ` [PATCH for-6.0 2/6] qapi: Rename KvmInfo to AccelInfo Roman Bolshakov
2020-11-27 10:40   ` Dr. David Alan Gilbert
2020-11-27 12:08     ` Markus Armbruster
2020-11-16 13:10 ` [PATCH for-6.0 3/6] qapi: Use qmp_query_accel() in qmp_query_kvm() Roman Bolshakov
2020-11-16 13:10 ` [PATCH for-6.0 4/6] softmmu: Remove kvm_available() Roman Bolshakov
2020-11-16 13:10 ` [PATCH for-6.0 5/6] hmp: Add 'info accel' command Roman Bolshakov
2020-11-27 10:39   ` Dr. David Alan Gilbert
2020-11-16 13:10 ` [PATCH for-6.0 6/6] qapi: Deprecate 'query-kvm' Roman Bolshakov
2020-11-27 10:50   ` Daniel P. Berrangé
2020-11-27 11:21     ` Peter Krempa
2020-11-27 11:45       ` Roman Bolshakov
2020-11-27 12:18         ` Peter Krempa
2020-11-27 15:44           ` Markus Armbruster
2020-11-27 16:30             ` Peter Krempa
2020-11-30  9:21               ` Markus Armbruster
2020-11-30 10:09                 ` Peter Krempa
2020-11-30 16:03                   ` Markus Armbruster
2020-11-30 15:30               ` Eric Blake
2020-11-27 15:53           ` Daniel P. Berrangé
2020-11-27 16:35             ` Peter Krempa
2020-11-19 14:41 ` [PATCH for-6.0 0/6] Add HMP/QMP commands to query accelerator Claudio Fontana
2020-11-19 15:46   ` Roman Bolshakov
2020-11-19 15:54     ` Claudio Fontana

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=b9307f87-5350-21a6-68dd-d4efbae5e502@redhat.com \
    --to=pbonzini@redhat.com \
    --cc=armbru@redhat.com \
    --cc=berrange@redhat.com \
    --cc=ehabkost@redhat.com \
    --cc=jsnow@redhat.com \
    --cc=kwolf@redhat.com \
    --cc=qemu-devel@nongnu.org \
    --cc=r.bolshakov@yadro.com \
    /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).