qemu-devel.nongnu.org archive mirror
 help / color / mirror / Atom feed
From: Christophe de Dinechin <dinechin@redhat.com>
To: Paolo Bonzini <pbonzini@redhat.com>
Cc: "Kevin Wolf" <kwolf@redhat.com>, "Thomas Huth" <thuth@redhat.com>,
	qemu-block@nongnu.org, qemu-devel@nongnu.org,
	"Wainer dos Santos Moschetta" <wainersm@redhat.com>,
	"Max Reitz" <mreitz@redhat.com>,
	"Philippe Mathieu-Daudé" <philmd@redhat.com>
Subject: Re: Priority of -accel (was: [PATCH] tests/qemu-iotests: Update tests to recent desugarized -accel option)
Date: Tue, 7 Jan 2020 14:55:55 +0100	[thread overview]
Message-ID: <1A5859EA-4403-4921-B527-DFD07C59C702@redhat.com> (raw)
In-Reply-To: <12334054-4ae7-e580-9727-2d322bfa2bda@redhat.com>



> On 7 Jan 2020, at 11:14, Paolo Bonzini <pbonzini@redhat.com> wrote:
> 
> On 07/01/20 11:03, Thomas Huth wrote:
>>> 
>>> vm = QEMUMachine(iotests.qemu_prog)
>>> -vm.add_args('-machine', 'accel=kvm:tcg')
>>> +vm.add_args('-accel', 'kvm', '-accel', 'tcg')
>> Looking at this, I wonder whether we really want the "-accel" option to
>> prioritize the accelerators in the order of appearance? A lot of other
>> CLI tools give the highest priority to the last parameter instead, e.g.
>> "gcc -O3 -O1" compiles with -O1, and not with -O3.
>> 
>> Also I think it might be quite common that there are shell scripts which
>> call "qemu-system-xxx -accel xyz $*" ... and if we don't invert the
>> priorities of -accel, it will be impossible to override -accel in that
>> case...
> 
> Hmm, it does match "-machine accel=kvm:tcg" and in general I think it's
> more self-explanatory.  However, it is indeed less friendly to scripts.
> On one hand those could be changed to place "-accel xyz" after $* (or
> better "$@"), on the other hand we could also add a priority option to
> "-accel".  What do you think?

I tend to agree with Thomas’ assessment that in general, later options
tend to override earlier ones, if only because that’s typically how getopt
works with the typical usage of setting global variables.

I also agree that when it’s a single list given to an option, then it
generally makes more sense to interpret the later ones as a “fallback”
if you could not get the previous ones. Which I believe gives me a
hint of what the intent of specifying multiple options would be…

So what about ranking the accelerators, so that all combinaisons
-accel=kvm:tcg, -accel=tcg:kvm, -accel kvm -accel tcg, etc would
all pickup kvm if available, and tcg as a fallback? Implementation-wise,
it would simply mean ranking the accelerators and updating the accelerator
only if it’s available and better.

To allow full override, we might add something like -accel reset
to reset to the default, i.e. as if no option had been given.

I personally don’t like “priority=n” being explicit on the command-line
because that IMO pushes the problem of ranking the accelerators
to the user, without guidance on how to do that. For example, if I
have a script that reliably overrode before, then it might stop
overriding because the inner script has set priority=2, so I put
priority=3, not knowing that the maintainer thinks my override
broke something, so the inner script maintainers escalates to
priority=4 to “fix” my priority=3. In the end, the whole universe
crumbles or something equally unpredictable.


Cheers,
Christophe

> 
> Paolo
> 
> 



  parent reply	other threads:[~2020-01-07 14:58 UTC|newest]

Thread overview: 38+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-01-06 13:09 [PATCH] tests/qemu-iotests: Update tests to recent desugarized -accel option Philippe Mathieu-Daudé
2020-01-06 13:16 ` Max Reitz
2020-01-07 10:03 ` Priority of -accel (was: [PATCH] tests/qemu-iotests: Update tests to recent desugarized -accel option) Thomas Huth
2020-01-07 10:14   ` Paolo Bonzini
2020-01-07 12:18     ` Thomas Huth
2020-01-07 12:23       ` Paolo Bonzini
2020-01-07 12:54         ` Daniel P. Berrangé
2020-01-07 14:14           ` Thomas Huth
2020-01-07 14:20             ` Priority of -accel Philippe Mathieu-Daudé
2020-01-07 14:27               ` Daniel P. Berrangé
2020-01-07 14:35                 ` Thomas Huth
2020-01-13 14:39                   ` Markus Armbruster
2020-01-13 16:14                     ` Christophe de Dinechin
2020-01-13 16:23                       ` Paolo Bonzini
2020-01-07 14:26             ` Priority of -accel (was: [PATCH] tests/qemu-iotests: Update tests to recent desugarized -accel option) Daniel P. Berrangé
2020-01-08 10:39             ` Alex Bennée
2020-01-08 10:58               ` Thomas Huth
2020-01-08 12:41                 ` Paolo Bonzini
2020-01-08 13:10                   ` Daniel P. Berrangé
2020-01-08 13:24                     ` Paolo Bonzini
2020-01-08 14:00                       ` Priority of -accel Thomas Huth
2020-01-08 11:00               ` Priority of -accel (was: [PATCH] tests/qemu-iotests: Update tests to recent desugarized -accel option) Peter Maydell
2020-01-10 10:43                 ` Peter Maydell
2020-01-07 12:29       ` Kevin Wolf
2020-01-07 12:34       ` Priority of -accel Philippe Mathieu-Daudé
2020-01-07 12:37         ` Philippe Mathieu-Daudé
2020-01-07 13:55     ` Christophe de Dinechin [this message]
2020-01-07 14:37       ` Priority of -accel (was: [PATCH] tests/qemu-iotests: Update tests to recent desugarized -accel option) Paolo Bonzini
2020-01-07 14:42         ` Thomas Huth
2020-01-07 17:43         ` Christophe de Dinechin
2020-01-07 17:53           ` Peter Maydell
2020-01-08  9:47           ` Kevin Wolf
2020-01-13 16:17         ` Priority of -accel Markus Armbruster
2020-01-13 16:25           ` Paolo Bonzini
2020-01-14  8:59             ` Markus Armbruster
2020-01-14 10:44               ` Paolo Bonzini
2020-01-14 17:49             ` Christophe de Dinechin
2020-01-14 17:59               ` Daniel P. Berrangé

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=1A5859EA-4403-4921-B527-DFD07C59C702@redhat.com \
    --to=dinechin@redhat.com \
    --cc=kwolf@redhat.com \
    --cc=mreitz@redhat.com \
    --cc=pbonzini@redhat.com \
    --cc=philmd@redhat.com \
    --cc=qemu-block@nongnu.org \
    --cc=qemu-devel@nongnu.org \
    --cc=thuth@redhat.com \
    --cc=wainersm@redhat.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).