public inbox for pve-devel@lists.proxmox.com
 help / color / mirror / Atom feed
From: Fiona Ebner <f.ebner@proxmox.com>
To: Dominik Csapak <d.csapak@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 14:22:05 +0100	[thread overview]
Message-ID: <43f313d3-3907-4b0e-acf8-32ef3f8db0b1@proxmox.com> (raw)
In-Reply-To: <20260205141959.3615131-3-d.csapak@proxmox.com>

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?




  reply	other threads:[~2026-02-10 13:21 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 [this message]
2026-02-10 14:33     ` Dominik Csapak
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=43f313d3-3907-4b0e-acf8-32ef3f8db0b1@proxmox.com \
    --to=f.ebner@proxmox.com \
    --cc=d.csapak@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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox
Service provided by Proxmox Server Solutions GmbH | Privacy | Legal