qemu-devel.nongnu.org archive mirror
 help / color / mirror / Atom feed
From: Claudio Fontana <cfontana@suse.de>
To: Eduardo Habkost <ehabkost@redhat.com>
Cc: Thomas Huth <thuth@redhat.com>,
	Richard Henderson <richard.henderson@linaro.org>,
	qemu-devel@nongnu.org, Roman Bolshakov <r.bolshakov@yadro.com>,
	Gerd Hoffmann <kraxel@redhat.com>,
	Paolo Bonzini <pbonzini@redhat.com>
Subject: Re: [PATCH v2 2/6] accel: accel_available() function
Date: Fri, 27 Nov 2020 10:04:37 +0100	[thread overview]
Message-ID: <55ed249f-9fd3-fe3d-c63a-8d74803a72ca@suse.de> (raw)
In-Reply-To: <20201126214810.GR2271382@habkost.net>

On 11/26/20 10:48 PM, Eduardo Habkost wrote:
> On Thu, Nov 26, 2020 at 10:06:03PM +0100, Claudio Fontana wrote:
>> On 11/26/20 3:25 PM, Paolo Bonzini wrote:
>>> On 26/11/20 15:13, Claudio Fontana wrote:
>>>> One option I see is simply to document the behavior where
>>>> accel_available() is declared in accel.h (ie do not use in fast
>>>> path), as well as in accel_find() actually, so that both accel_find()
>>>> and accel_available() are avoided in fast path and avoid being called
>>>> frequently at runtime.
>>>>
>>>> Another option could be to remove the allocation completely, and use
>>>> for example accel_find(ACCEL_CLASS_NAME("tcg")), or another option
>>>> again would be to remove the allocation and use either a fixed buffer
>>>> + snprintf, or alloca -like builtin code to use the stack, ...
>>>>
>>>> Not a big deal, but with a general utility and short name like
>>>> accel_available(name) it might be tempting to use this more in the
>>>> future?
>>>
>>> I think it's just that the usecase is not that common.  "Is this 
>>> accelerator compiled in the binary" is not something you need after 
>>> startup (or if querying the monitor).
>>>
>>> Paolo
>>>
>>>
>>
>> A script that repeatedly uses the QMP interface to query for
>> the status could generate fragmentation this way I think.
> 
> Is this a problem?  Today, execution of a "query-kvm" command
> calls g_malloc() 37 times.
> 

Not ideal in my view, but not the end of the world either.

Ciao,

Claudio


  reply	other threads:[~2020-11-27  9:09 UTC|newest]

Thread overview: 27+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-11-25 20:56 [PATCH v2 0/6] arch_init.c cleanup Eduardo Habkost
2020-11-25 20:56 ` [PATCH v2 1/6] arch_init: Move QEMU_ARCH definitions to cpu.h Eduardo Habkost
2020-11-26 12:31   ` Thomas Huth
2020-11-27 11:35   ` Cornelia Huck
2020-11-25 20:56 ` [PATCH v2 2/6] accel: accel_available() function Eduardo Habkost
2020-11-26  9:14   ` Claudio Fontana
2020-11-26 13:36     ` Eduardo Habkost
2020-11-26 14:13       ` Claudio Fontana
2020-11-26 14:25         ` Paolo Bonzini
2020-11-26 21:06           ` Claudio Fontana
2020-11-26 21:48             ` Eduardo Habkost
2020-11-27  9:04               ` Claudio Fontana [this message]
2020-11-27 14:45                 ` Markus Armbruster
2020-11-27 14:58                   ` Claudio Fontana
2020-11-27 16:47                     ` Markus Armbruster
2020-11-27  5:00             ` Paolo Bonzini
2020-11-27 12:08   ` Cornelia Huck
2020-11-25 20:56 ` [PATCH v2 3/6] kvm: Remove kvm_available() function Eduardo Habkost
2020-11-27 12:10   ` Cornelia Huck
2020-11-25 20:56 ` [PATCH v2 4/6] xen: Delete xen_available() function Eduardo Habkost
2020-11-27 12:11   ` Cornelia Huck
2020-11-27 14:52   ` Anthony PERARD via
2020-11-25 20:56 ` [PATCH v2 5/6] Remove unnecessary usage of arch_init.h Eduardo Habkost
2020-11-27 12:23   ` Cornelia Huck
2020-11-25 20:56 ` [PATCH v2 6/6] Rename arch_init.h to arch_type.h Eduardo Habkost
2020-11-27 12:25   ` Cornelia Huck
2020-11-25 22:23 ` [PATCH v2 0/6] arch_init.c cleanup Roman Bolshakov

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=55ed249f-9fd3-fe3d-c63a-8d74803a72ca@suse.de \
    --to=cfontana@suse.de \
    --cc=ehabkost@redhat.com \
    --cc=kraxel@redhat.com \
    --cc=pbonzini@redhat.com \
    --cc=qemu-devel@nongnu.org \
    --cc=r.bolshakov@yadro.com \
    --cc=richard.henderson@linaro.org \
    --cc=thuth@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).