diff mbox series

[v1,2/2] Fix nvmm_ram_block_added() function arguments

Message ID 20210718134650.1191-3-reinoud@NetBSD.org (mailing list archive)
State New, archived
Headers show
Series Update NVMM support to recent changes | expand

Commit Message

Reinoud Zandijk July 18, 2021, 1:46 p.m. UTC
A parameter max_size was added to the RAMBlockNotifier
ram_block_added function. Use the max_size for pre allocation
of hva space.

Signed-off-by: Reinoud Zandijk <Reinoud@NetBSD.org>
---
 target/i386/nvmm/nvmm-all.c | 5 +++--
 1 file changed, 3 insertions(+), 2 deletions(-)

Comments

Peter Maydell July 18, 2021, 4:38 p.m. UTC | #1
On Sun, 18 Jul 2021 at 14:54, Reinoud Zandijk <reinoud@netbsd.org> wrote:
>
> A parameter max_size was added to the RAMBlockNotifier
> ram_block_added function. Use the max_size for pre allocation
> of hva space.
>
> Signed-off-by: Reinoud Zandijk <Reinoud@NetBSD.org>
> ---
>  target/i386/nvmm/nvmm-all.c | 5 +++--
>  1 file changed, 3 insertions(+), 2 deletions(-)
>
> diff --git a/target/i386/nvmm/nvmm-all.c b/target/i386/nvmm/nvmm-all.c
> index dfa690d65d..fdcd37ed3e 100644
> --- a/target/i386/nvmm/nvmm-all.c
> +++ b/target/i386/nvmm/nvmm-all.c
> @@ -1134,13 +1134,14 @@ static MemoryListener nvmm_memory_listener = {
>  };
>
>  static void
> -nvmm_ram_block_added(RAMBlockNotifier *n, void *host, size_t size)
> +nvmm_ram_block_added(RAMBlockNotifier *n, void *host, size_t size,
> +                     size_t max_size)
>  {
>      struct nvmm_machine *mach = get_nvmm_mach();
>      uintptr_t hva = (uintptr_t)host;
>      int ret;
>
> -    ret = nvmm_hva_map(mach, hva, size);
> +    ret = nvmm_hva_map(mach, hva, max_size);
>
>      if (ret == -1) {
>          error_report("NVMM: Failed to map HVA, HostVA:%p "

This suggests that this code isn't being covered by our CI. Is
there something we can do to get it tested?

-- PMM
Reinoud Zandijk July 19, 2021, 2:54 p.m. UTC | #2
Hi,

On Sun, Jul 18, 2021 at 05:38:58PM +0100, Peter Maydell wrote:
> On Sun, 18 Jul 2021 at 14:54, Reinoud Zandijk <reinoud@netbsd.org> wrote:
> > A parameter max_size was added to the RAMBlockNotifier
> > ram_block_added function. Use the max_size for pre allocation
> > of hva space.
> >
> > Signed-off-by: Reinoud Zandijk <Reinoud@NetBSD.org>
> > ---
> >  target/i386/nvmm/nvmm-all.c | 5 +++--
> >  1 file changed, 3 insertions(+), 2 deletions(-)
> >
> > diff --git a/target/i386/nvmm/nvmm-all.c b/target/i386/nvmm/nvmm-all.c
> > index dfa690d65d..fdcd37ed3e 100644
> > --- a/target/i386/nvmm/nvmm-all.c
> > +++ b/target/i386/nvmm/nvmm-all.c
> > @@ -1134,13 +1134,14 @@ static MemoryListener nvmm_memory_listener = {
> >  };
> >
> >  static void
> > -nvmm_ram_block_added(RAMBlockNotifier *n, void *host, size_t size)
> > +nvmm_ram_block_added(RAMBlockNotifier *n, void *host, size_t size,
> > +                     size_t max_size)
> >  {
> >      struct nvmm_machine *mach = get_nvmm_mach();
> >      uintptr_t hva = (uintptr_t)host;
> >      int ret;
> >
> > -    ret = nvmm_hva_map(mach, hva, size);
> > +    ret = nvmm_hva_map(mach, hva, max_size);
> >
> >      if (ret == -1) {
> >          error_report("NVMM: Failed to map HVA, HostVA:%p "
> 
> This suggests that this code isn't being covered by our CI. Is
> there something we can do to get it tested?

NVMM acceleration is currently NetBSD host only so can only be tested on
NetBSD hosts. Unless Qemu is smart enough to allow a guest NetBSD to run
NetBSD to test NVMM in a nested Qemu I don't think its possible to otherwise
automatically test on Linux.

Is there a README or documentation on how to modify and run the tests?

With regard,
Reinoud
diff mbox series

Patch

diff --git a/target/i386/nvmm/nvmm-all.c b/target/i386/nvmm/nvmm-all.c
index dfa690d65d..fdcd37ed3e 100644
--- a/target/i386/nvmm/nvmm-all.c
+++ b/target/i386/nvmm/nvmm-all.c
@@ -1134,13 +1134,14 @@  static MemoryListener nvmm_memory_listener = {
 };
 
 static void
-nvmm_ram_block_added(RAMBlockNotifier *n, void *host, size_t size)
+nvmm_ram_block_added(RAMBlockNotifier *n, void *host, size_t size,
+                     size_t max_size)
 {
     struct nvmm_machine *mach = get_nvmm_mach();
     uintptr_t hva = (uintptr_t)host;
     int ret;
 
-    ret = nvmm_hva_map(mach, hva, size);
+    ret = nvmm_hva_map(mach, hva, max_size);
 
     if (ret == -1) {
         error_report("NVMM: Failed to map HVA, HostVA:%p "