diff mbox series

[2/4] KVM: Define KVM_MEMSLOTS_NUM_MAX_DEFAULT

Message ID 20240904191635.3045606-3-peterx@redhat.com (mailing list archive)
State New
Headers show
Series KVM: Dynamic sized memslots array | expand

Commit Message

Peter Xu Sept. 4, 2024, 7:16 p.m. UTC
Make the default max nr_slots a macro, it's only used when KVM reports
nothing.  Then we put all the rest macros together later soon.

Signed-off-by: Peter Xu <peterx@redhat.com>
---
 accel/kvm/kvm-all.c | 5 ++++-
 1 file changed, 4 insertions(+), 1 deletion(-)

Comments

David Hildenbrand Sept. 4, 2024, 8:39 p.m. UTC | #1
On 04.09.24 21:16, Peter Xu wrote:
> Make the default max nr_slots a macro, it's only used when KVM reports
> nothing.  Then we put all the rest macros together later soon.
> 
> Signed-off-by: Peter Xu <peterx@redhat.com>
> ---
>   accel/kvm/kvm-all.c | 5 ++++-
>   1 file changed, 4 insertions(+), 1 deletion(-)
> 
> diff --git a/accel/kvm/kvm-all.c b/accel/kvm/kvm-all.c
> index 991c389adc..e408dbb753 100644
> --- a/accel/kvm/kvm-all.c
> +++ b/accel/kvm/kvm-all.c
> @@ -69,6 +69,9 @@
>   #define KVM_GUESTDBG_BLOCKIRQ 0
>   #endif
>   
> +/* Default max allowed memslots if kernel reported nothing */
> +#define  KVM_MEMSLOTS_NUM_MAX_DEFAULT                       32
> +

Any reason for the "NUM" vs. "NR" in there?

Something that resembles KVM_CAP_NR_MEMSLOTS would be a bit ore 
consistent, because the 32 is essentially the fallback if the capability 
is not supported.

Apart from that makes sense

Reviewed-by: David Hildenbrand <david@redhat.com>
Peter Xu Sept. 4, 2024, 8:56 p.m. UTC | #2
On Wed, Sep 04, 2024 at 10:39:19PM +0200, David Hildenbrand wrote:
> On 04.09.24 21:16, Peter Xu wrote:
> > Make the default max nr_slots a macro, it's only used when KVM reports
> > nothing.  Then we put all the rest macros together later soon.
> > 
> > Signed-off-by: Peter Xu <peterx@redhat.com>
> > ---
> >   accel/kvm/kvm-all.c | 5 ++++-
> >   1 file changed, 4 insertions(+), 1 deletion(-)
> > 
> > diff --git a/accel/kvm/kvm-all.c b/accel/kvm/kvm-all.c
> > index 991c389adc..e408dbb753 100644
> > --- a/accel/kvm/kvm-all.c
> > +++ b/accel/kvm/kvm-all.c
> > @@ -69,6 +69,9 @@
> >   #define KVM_GUESTDBG_BLOCKIRQ 0
> >   #endif
> > +/* Default max allowed memslots if kernel reported nothing */
> > +#define  KVM_MEMSLOTS_NUM_MAX_DEFAULT                       32
> > +
> 
> Any reason for the "NUM" vs. "NR" in there?

Sure, let me do s/NUM/NR/ all over.

> 
> Something that resembles KVM_CAP_NR_MEMSLOTS would be a bit ore consistent,
> because the 32 is essentially the fallback if the capability is not
> supported.
> 
> Apart from that makes sense
> 
> Reviewed-by: David Hildenbrand <david@redhat.com>

Thanks,
diff mbox series

Patch

diff --git a/accel/kvm/kvm-all.c b/accel/kvm/kvm-all.c
index 991c389adc..e408dbb753 100644
--- a/accel/kvm/kvm-all.c
+++ b/accel/kvm/kvm-all.c
@@ -69,6 +69,9 @@ 
 #define KVM_GUESTDBG_BLOCKIRQ 0
 #endif
 
+/* Default max allowed memslots if kernel reported nothing */
+#define  KVM_MEMSLOTS_NUM_MAX_DEFAULT                       32
+
 struct KVMParkedVcpu {
     unsigned long vcpu_id;
     int kvm_fd;
@@ -2458,7 +2461,7 @@  static int kvm_init(MachineState *ms)
 
     /* If unspecified, use the default value */
     if (!s->nr_slots_max) {
-        s->nr_slots_max = 32;
+        s->nr_slots_max = KVM_MEMSLOTS_NUM_MAX_DEFAULT;
     }
 
     s->nr_as = kvm_check_extension(s, KVM_CAP_MULTI_ADDRESS_SPACE);