- python/aqmp: use absolute import statement - sysemu: Cleanup qemu_run_machine_init_done_notifiers() - vhost-backend: avoid overflow on memslots_limit - hw/i386/vmmouse: Require 'i8042' property to be set - hw/scsi/megasas: Fails command if SGL buffer overflows - target/i386/kvm: Replace use of __u32 type - hw/avr: Realize AVRCPU qdev object using qdev_realize() - qemu-keymap: Add license in generated files - configure: Symlink binaries using .exe suffix with MinGW - ui: remove break after g_assert_not_reached() - io/channel-websock: Replace strlen(const_str) by sizeof(const_str) - 1 - target/ppc: Add HASHKEYR and HASHPKEYR SPRs - tests: Fix error strings - Hexagon (target/hexagon) remove unused encodings - target/i386: introduce insn_get_addr - target/i386: REPZ and REPNZ are mutually exclusive - target/i386: correctly mask SSE4a bit indices in register operands - bios-tables-test: Make oem-fields tests be consistent - tests/vm: update NetBSD to 9.3 - monitor/hmp-cmds: Avoid displaying bogus size in 'info pci' When BAR aren't mapped, we get: - virtio-mem: don't warn about THP sizes on a kernel without THP Support - Subject: [PATCH] kvm: Use 'unsigned long' for request argument in functions wrapping ioctl() Signed-off-by: Jiabo Feng <fengjiabo1@huawei.com> (cherry picked from commit 2430c96ac522f910c11eb98c2d9f74c2c3336a00)
51 lines
1.8 KiB
Diff
51 lines
1.8 KiB
Diff
From 2fc1b97a5acd19c52d8af4bfd8bcf4824db48fb9 Mon Sep 17 00:00:00 2001
|
|
From: dinglimin <dinglimin@cmss.chinamobile.com>
|
|
Date: Mon, 16 Sep 2024 16:53:58 +0800
|
|
Subject: [PATCH] virtio-mem: don't warn about THP sizes on a kernel without
|
|
THP support cheery-pick from 95b717a8154b955de2782305f305b63f357b0576 If the
|
|
config directory in sysfs does not exist at all, we are dealing with a system
|
|
that does not support THPs. Simply use 1 MiB block size then, instead of
|
|
warning "Could not detect THP size, falling back to ..." and falling back to
|
|
the default THP size.
|
|
|
|
Cc: "Michael S. Tsirkin" <mst@redhat.com>
|
|
Cc: Gavin Shan <gshan@redhat.com>
|
|
Cc: Juraj Marcin <jmarcin@redhat.com>
|
|
Signed-off-by: David Hildenbrand <david@redhat.com>
|
|
Message-Id: <20240910163433.2100295-1-david@redhat.com>
|
|
Reviewed-by: Michael S. Tsirkin <mst@redhat.com>
|
|
Signed-off-by: Michael S. Tsirkin <mst@redhat.com>
|
|
Signed-off-by: dinglimin <dinglimin@cmss.chinamobile.com>
|
|
---
|
|
hw/virtio/virtio-mem.c | 7 +++++++
|
|
1 file changed, 7 insertions(+)
|
|
|
|
diff --git a/hw/virtio/virtio-mem.c b/hw/virtio/virtio-mem.c
|
|
index 49749349e0..452f60266a 100644
|
|
--- a/hw/virtio/virtio-mem.c
|
|
+++ b/hw/virtio/virtio-mem.c
|
|
@@ -61,6 +61,7 @@
|
|
static uint32_t thp_size;
|
|
|
|
#define HPAGE_PMD_SIZE_PATH "/sys/kernel/mm/transparent_hugepage/hpage_pmd_size"
|
|
+#define HPAGE_PATH "/sys/kernel/mm/transparent_hugepage/"
|
|
static uint32_t virtio_mem_thp_size(void)
|
|
{
|
|
gchar *content = NULL;
|
|
@@ -71,6 +72,12 @@ static uint32_t virtio_mem_thp_size(void)
|
|
return thp_size;
|
|
}
|
|
|
|
+ /* No THP -> no restrictions. */
|
|
+ if (!g_file_test(HPAGE_PATH, G_FILE_TEST_EXISTS)) {
|
|
+ thp_size = VIRTIO_MEM_MIN_BLOCK_SIZE;
|
|
+ return thp_size;
|
|
+ }
|
|
+
|
|
/*
|
|
* Try to probe the actual THP size, fallback to (sane but eventually
|
|
* incorrect) default sizes.
|
|
--
|
|
2.41.0.windows.1
|
|
|