Skip to content
Snippets Groups Projects
  1. Sep 20, 2023
  2. Sep 19, 2023
    • hongmianquan's avatar
      memory: avoid updating ioeventfds for some address_space · 544cff46
      hongmianquan authored
      
      When updating ioeventfds, we need to iterate all address spaces,
      but some address spaces do not register eventfd_add|del call when
      memory_listener_register() and they do nothing when updating ioeventfds.
      So we can skip these AS in address_space_update_ioeventfds().
      
      The overhead of memory_region_transaction_commit() can be significantly
      reduced. For example, a VM with 8 vhost net devices and each one has
      64 vectors, can reduce the time spent on memory_region_transaction_commit by 20%.
      
      Message-ID: <20230830032906.12488-1-hongmianquan@bytedance.com>
      Reviewed-by: default avatarPeter Xu <peterx@redhat.com>
      Signed-off-by: default avatarhongmianquan <hongmianquan@bytedance.com>
      Signed-off-by: default avatarDavid Hildenbrand <david@redhat.com>
      544cff46
    • David Hildenbrand's avatar
      softmmu/physmem: Distinguish between file access mode and mmap protection · 5c52a219
      David Hildenbrand authored
      
      There is a difference between how we open a file and how we mmap it,
      and we want to support writable private mappings of readonly files. Let's
      define RAM_READONLY and RAM_READONLY_FD flags, to replace the single
      "readonly" parameter for file-related functions.
      
      In memory_region_init_ram_from_fd() and memory_region_init_ram_from_file(),
      initialize mr->readonly based on the new RAM_READONLY flag.
      
      While at it, add some RAM_* flags we missed to add to the list of accepted
      flags in the documentation of some functions.
      
      No change in functionality intended. We'll make use of both flags next
      and start setting them independently for memory-backend-file.
      
      Message-ID: <20230906120503.359863-3-david@redhat.com>
      Acked-by: default avatarPeter Xu <peterx@redhat.com>
      Signed-off-by: default avatarDavid Hildenbrand <david@redhat.com>
      5c52a219
    • David Hildenbrand's avatar
      nvdimm: Reject writing label data to ROM instead of crashing QEMU · 3a125839
      David Hildenbrand authored
      
      Currently, when using a true R/O NVDIMM (ROM memory backend) with a label
      area, the VM can easily crash QEMU by trying to write to the label area,
      because the ROM memory is mmap'ed without PROT_WRITE.
      
          [root@vm-0 ~]# ndctl disable-region region0
          disabled 1 region
          [root@vm-0 ~]# ndctl zero-labels nmem0
          -> QEMU segfaults
      
      Let's remember whether we have a ROM memory backend and properly
      reject the write request:
      
          [root@vm-0 ~]# ndctl disable-region region0
          disabled 1 region
          [root@vm-0 ~]# ndctl zero-labels nmem0
          zeroed 0 nmem
      
      In comparison, on a system with a R/W NVDIMM:
      
          [root@vm-0 ~]# ndctl disable-region region0
          disabled 1 region
          [root@vm-0 ~]# ndctl zero-labels nmem0
          zeroed 1 nmem
      
      For ACPI, just return "unsupported", like if no label exists. For spapr,
      return "H_P2", similar to when no label area exists.
      
      Could we rely on the "unarmed" property? Maybe, but it looks cleaner to
      only disallow what certainly cannot work.
      
      After all "unarmed=on" primarily means: cannot accept persistent writes. In
      theory, there might be setups where devices with "unarmed=on" set could
      be used to host non-persistent data (temporary files, system RAM, ...); for
      example, in Linux, admins can overwrite the "readonly" setting and still
      write to the device -- which will work as long as we're not using ROM.
      Allowing writing label data in such configurations can make sense.
      
      Message-ID: <20230906120503.359863-2-david@redhat.com>
      Fixes: dbd730e8 ("nvdimm: check -object memory-backend-file, readonly=on option")
      Reviewed-by: default avatarStefan Hajnoczi <stefanha@redhat.com>
      Signed-off-by: default avatarDavid Hildenbrand <david@redhat.com>
      3a125839
  3. Sep 18, 2023
  4. Sep 16, 2023
  5. Sep 15, 2023
  6. Sep 12, 2023
  7. Sep 11, 2023
  8. Sep 08, 2023
Loading