public inbox for pve-devel@lists.proxmox.com
 help / color / mirror / Atom feed
From: "DERUMIER, Alexandre" <Alexandre.DERUMIER@groupe-cyllene.com>
To: "pve-devel@lists.proxmox.com" <pve-devel@lists.proxmox.com>,
	"aderumier@odiso.com" <aderumier@odiso.com>,
	"f.ebner@proxmox.com" <f.ebner@proxmox.com>
Subject: Re: [pve-devel] [PATCH v2 qemu-server 8/9] memory: add virtio-mem support
Date: Wed, 25 Jan 2023 09:00:58 +0000	[thread overview]
Message-ID: <b68f0f56607950351ee5f291b24fc6ad84ee5bf7.camel@groupe-cyllene.com> (raw)
In-Reply-To: <3a360312-42c0-6e97-c0e3-6cc70285f3eb@proxmox.com>

Le mardi 24 janvier 2023 à 14:06 +0100, Fiona Ebner a écrit :
> Am 04.01.23 um 07:43 schrieb Alexandre Derumier:
> > a 4GB static memory is needed for DMA+boot memory, as this memory
> > is almost always un-unpluggeable.
> > 
> > 1 virtio-mem pci device is setup for each numa node on pci.4 bridge
> > 
> > virtio-mem use a fixed blocksize with 32000 blocks
> > Blocksize is computed from the maxmemory-4096/32000 with a minimum
> > of
> > 2MB to map THP.
> > (lower blocksize = more chance to unplug memory).
> > 
> > Note: Currently, linux only support 4MB virtio blocksize, 2MB
> > support
> > is currently is progress.
> > 
> 
> For the above paragraphs:
> s/GB/GiB/
> s/MB/MiB/
> ?

yes, I'll fix it in all patches

(...)

> >  
> > +sub get_virtiomem_block_size {
> > +    my ($conf) = @_;
> > +
> > +    my $MAX_MEM = get_max_mem($conf);
> > +    my $static_memory = get_static_mem($conf);
> > +    my $memory = get_current_memory($conf->{memory});
> > +
> > +    #virtiomem can map 32000 block size.
> > +    #try to use lowest blocksize, lower = more chance to unplug
> > memory.
> > +    my $blocksize = ($MAX_MEM - $static_memory) / 32000;
> > +    #2MB is the minimum to be aligned with THP
> > +    $blocksize = 2**(ceil(log($blocksize)/log(2)));
> > +    $blocksize = 4 if $blocksize < 4;
> 
> Why suddenly 4?

I have added a note in the commit :

> Note: Currently, linux only support 4MB virtio blocksize, 2MB support
> is currently is progress.
> 

So 2MB is valid from qemu side, but linux guest kernel don't support it
actually. At least , you need to use multiple of 4MB. you can
remove/add 2 blocks of 2MB at the same time, but it don't seem to be
atomic, so I think it's better to use the minimum currently supported
bloc.
Maybe later, we could extend the virtio=X option, to tell the virtio
supported version.  (virtio=1.1  , virtio=1.2), and enable supported
features ?
 
 

> > +my sub balance_virtiomem {
> 
> This function is rather difficult to read. The "record errors and
> filter" logic really should be its own patch after the initial
> support.
> FWIW, I tried my best and it does seems fine :)
> 
> But it's not clear to me that we even want that logic? Is it really
> that
> common for qom-set to take so long to be worth introducing all this
> additional handling/complexity? Or should it just be a hard error if
> qom-set still didn't have an effect on a device after 5 seconds.
> 
from my test,It can take 2-3second on unplug on bigger setup. I'm doing
it in // to be faster, to avoid to wait nbdimm * 2-3seconds.

> Would it actually be better to just fill up the first, then the
> second
> etc. as needed, rather than balancing? My gut feeling is that having
> fewer "active" devices is better. But this would have to be tested
> with
> some benchmarks of course.

Well, from numa perspective, you really want to balance as much as
possible. (That's why, with classic hotplug, we add/remove dimm on each
socket alternatively).

That's the whole point of numa, read the nearest memory attached to the
processor where the process are running.

That's a main advantage of virtio-mem  vs balloning (which doesn't
handle numa, and remove pages randomly on any socket)






  reply	other threads:[~2023-01-25  9:01 UTC|newest]

Thread overview: 30+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-01-04  6:42 [pve-devel] [PATCH v2 qemu-server 0/9] rework memory hotplug + virtiomem Alexandre Derumier
2023-01-04  6:42 ` [pve-devel] [PATCH v2 qemu-server 1/9] test: add memory tests Alexandre Derumier
2023-01-24 13:04   ` Fiona Ebner
2023-01-04  6:42 ` [pve-devel] [PATCH v2 qemu-server 2/9] add memory parser Alexandre Derumier
2023-01-24 13:04   ` Fiona Ebner
2023-01-04  6:42 ` [pve-devel] [PATCH v2 qemu-server 3/9] memory: add get_static_mem Alexandre Derumier
2023-01-24 13:04   ` Fiona Ebner
2023-01-04  6:42 ` [pve-devel] [PATCH v2 qemu-server 4/9] config: memory: add 'max' option Alexandre Derumier
2023-01-24 13:05   ` Fiona Ebner
2023-01-27 15:03     ` DERUMIER, Alexandre
2023-01-30  8:03       ` Fiona Ebner
2023-01-30  8:45         ` DERUMIER, Alexandre
2023-01-04  6:42 ` [pve-devel] [PATCH v2 qemu-server 5/9] memory: get_max_mem: use config memory max Alexandre Derumier
2023-01-24 13:05   ` Fiona Ebner
2023-01-27 15:15     ` DERUMIER, Alexandre
2023-01-30  8:04       ` Fiona Ebner
2023-01-04  6:43 ` [pve-devel] [PATCH v2 qemu-server 6/9] memory: use 64 slots && static dimm size when max is defined Alexandre Derumier
2023-01-24 13:06   ` Fiona Ebner
2023-01-27 15:52     ` DERUMIER, Alexandre
2023-01-04  6:43 ` [pve-devel] [PATCH v2 qemu-server 7/9] test: add memory-max tests Alexandre Derumier
2023-01-24 13:06   ` Fiona Ebner
2023-01-04  6:43 ` [pve-devel] [PATCH v2 qemu-server 8/9] memory: add virtio-mem support Alexandre Derumier
2023-01-24 13:06   ` Fiona Ebner
2023-01-25  9:00     ` DERUMIER, Alexandre [this message]
2023-01-25  9:54       ` Fiona Ebner
2023-01-25 10:28         ` DERUMIER, Alexandre
2023-01-25 10:52           ` Fiona Ebner
2023-01-04  6:43 ` [pve-devel] [PATCH v2 qemu-server 9/9] tests: add virtio-mem tests Alexandre Derumier
2023-01-24 13:08   ` Fiona Ebner
2023-01-24 13:08 ` [pve-devel] [PATCH v2 qemu-server 0/9] rework memory hotplug + virtiomem Fiona Ebner

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=b68f0f56607950351ee5f291b24fc6ad84ee5bf7.camel@groupe-cyllene.com \
    --to=alexandre.derumier@groupe-cyllene.com \
    --cc=aderumier@odiso.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 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