all lists on lists.proxmox.com
 help / color / mirror / Atom feed
From: Dominik Csapak <d.csapak@proxmox.com>
To: Fiona Ebner <f.ebner@proxmox.com>, pve-devel@lists.proxmox.com
Subject: Re: [PATCH qemu-server v3 2/3] tests: improve multiarch build support by allowing re-init of cpu models
Date: Tue, 10 Feb 2026 15:33:06 +0100	[thread overview]
Message-ID: <4feb4a83-a9dd-4df8-bd11-9bfd49780a53@proxmox.com> (raw)
In-Reply-To: <43f313d3-3907-4b0e-acf8-32ef3f8db0b1@proxmox.com>



On 2/10/26 2:20 PM, Fiona Ebner wrote:
> Am 05.02.26 um 3:18 PM schrieb Dominik Csapak:
>> instead of simply saving 'host_arch','all_cpu_models' and
>> 'cpu_models_by_arch' in the global package namespace, after initializing
>> directly in the module, use an initialization function and a getter to
>> generate this.
>>
>> This has two advantages:
>> * Only the first use actually fills the package wide variable
>>    (currently the $cpu_fmt uses this on module load)
>> * We can call the initialization manually in the tests where we need it
>>
>> Signed-off-by: Dominik Csapak <d.csapak@proxmox.com>
> 
> Reviewed-by: Fiona Ebner <f.ebner@proxmox.com>
> 
> but one comment below
> 
>> +# returns the cpu models for the given architecture, or if $arch is not given, a
>> +# map from available architectures to models
>> +sub get_cpu_models_by_arch {
>> +    my ($arch) = @_;
>> +    initialize_cpu_models() if !defined($cpu_models_by_arch);
>> +    return $cpu_models_by_arch->{$arch} if defined($arch);
>> +    return $cpu_models_by_arch;
>> +}
> 
> I don't like having an overloaded return type here (depending on whether
> $arch is set or not, the returned hash has different structure). All
> callers pass the arch explicitly, so should we just require the argument
> to be set and avoid returning the full hash?

you're probably right, I wasn't so sure of this myself, but thought
why shouldn't it be possible to return the full hash.

requiring $arch here and just returning the per-architecture models 
makes more sense...




  reply	other threads:[~2026-02-10 14:32 UTC|newest]

Thread overview: 12+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-02-05 14:17 [PATCH qemu-server v3 0/3] improve multiarch build support Dominik Csapak
2026-02-05 14:17 ` [PATCH qemu-server v3 1/3] tests: improve multiarch build support by introducing local get_host_arch helper Dominik Csapak
2026-02-10 13:22   ` Fiona Ebner
2026-02-05 14:17 ` [PATCH qemu-server v3 2/3] tests: improve multiarch build support by allowing re-init of cpu models Dominik Csapak
2026-02-10 13:22   ` Fiona Ebner
2026-02-10 14:33     ` Dominik Csapak [this message]
2026-02-05 14:17 ` [PATCH qemu-server v3 3/3] tests: cfg2cmd: add some architecture tests Dominik Csapak
2026-02-10 13:22   ` Fiona Ebner
2026-02-10 14:34     ` Dominik Csapak
2026-02-10 14:37       ` Fiona Ebner
2026-02-10 14:45         ` Dominik Csapak
2026-02-11  9:27 ` superseded: [PATCH qemu-server v3 0/3] improve multiarch build support Dominik Csapak

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=4feb4a83-a9dd-4df8-bd11-9bfd49780a53@proxmox.com \
    --to=d.csapak@proxmox.com \
    --cc=f.ebner@proxmox.com \
    --cc=pve-devel@lists.proxmox.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 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.
Service provided by Proxmox Server Solutions GmbH | Privacy | Legal