qemu-devel.nongnu.org archive mirror
 help / color / mirror / Atom feed
* [PULL 0/6] First s390x updates for QEMU 7.2
@ 2022-08-30 17:19 Thomas Huth
  2022-08-30 17:19 ` [PULL 1/6] hw: Add compat machines for 7.2 Thomas Huth
                   ` (6 more replies)
  0 siblings, 7 replies; 8+ messages in thread
From: Thomas Huth @ 2022-08-30 17:19 UTC (permalink / raw)
  To: qemu-devel, Richard Henderson, Peter Maydell; +Cc: qemu-s390x

 Hi Richard, hi Peter!

The following changes since commit 9a99f964b152f8095949bbddca7841744ad418da:

  Update version for v7.1.0-rc4 release (2022-08-24 19:27:56 -0700)

are available in the Git repository at:

  https://gitlab.com/thuth/qemu.git tags/s390x-pull-request-2022-08-30

for you to fetch changes up to 90d994619383c2665cf4f4712872c43ad2728bec:

  util/mmap-alloc: Remove qemu_mempath_getpagesize() (2022-08-26 13:34:21 +0200)

----------------------------------------------------------------
* Compat machine types for QEMU 7.2
* Add feature bit for the "processor-activity-instrumentation extension"
* Fix emulation of CLFIT and CLGIT instructions
* Fix hugepages support on s390x with the memfd memory-backend

----------------------------------------------------------------
Christian Borntraeger (1):
      s390x/cpumodel: add stfl197 processor-activity-instrumentation extension 1

Cornelia Huck (1):
      hw: Add compat machines for 7.2

Ilya Leoshkevich (1):
      target/s390x: Fix CLFIT and CLGIT immediate size

Thomas Huth (3):
      backends/hostmem: Fix support of memory-backend-memfd in qemu_maxrampagesize()
      softmmu/physmem: Remove the ifdef __linux__ around the pagesize functions
      util/mmap-alloc: Remove qemu_mempath_getpagesize()

 include/hw/boards.h                 |  3 +++
 include/hw/i386/pc.h                |  3 +++
 include/qemu/mmap-alloc.h           |  2 --
 target/s390x/cpu_features_def.h.inc |  1 +
 backends/hostmem.c                  | 14 ++------------
 hw/arm/virt.c                       |  9 ++++++++-
 hw/core/machine.c                   |  3 +++
 hw/i386/pc.c                        |  3 +++
 hw/i386/pc_piix.c                   | 14 +++++++++++++-
 hw/i386/pc_q35.c                    | 13 ++++++++++++-
 hw/m68k/virt.c                      |  9 ++++++++-
 hw/ppc/spapr.c                      | 15 +++++++++++++--
 hw/s390x/s390-virtio-ccw.c          | 15 ++++++++++++++-
 softmmu/physmem.c                   | 17 -----------------
 target/s390x/gen-features.c         |  2 ++
 util/mmap-alloc.c                   | 31 -------------------------------
 target/s390x/tcg/insn-data.def      |  4 ++--
 17 files changed, 87 insertions(+), 71 deletions(-)



^ permalink raw reply	[flat|nested] 8+ messages in thread

* [PULL 1/6] hw: Add compat machines for 7.2
  2022-08-30 17:19 [PULL 0/6] First s390x updates for QEMU 7.2 Thomas Huth
@ 2022-08-30 17:19 ` Thomas Huth
  2022-08-30 17:19 ` [PULL 2/6] s390x/cpumodel: add stfl197 processor-activity-instrumentation extension 1 Thomas Huth
                   ` (5 subsequent siblings)
  6 siblings, 0 replies; 8+ messages in thread
From: Thomas Huth @ 2022-08-30 17:19 UTC (permalink / raw)
  To: qemu-devel, Richard Henderson, Peter Maydell; +Cc: qemu-s390x

From: Cornelia Huck <cohuck@redhat.com>

Add 7.2 machine types for arm/i440fx/m68k/q35/s390x/spapr.

Signed-off-by: Cornelia Huck <cohuck@redhat.com>
Reviewed-by: Daniel Henrique Barboza <danielhb413@gmail.com>
Reviewed-by: Michael S. Tsirkin <mst@redhat.com>
Message-Id: <20220727121755.395894-1-cohuck@redhat.com>
[thuth: fixed conflict with pcmc->legacy_no_rng_seed]
Signed-off-by: Thomas Huth <thuth@redhat.com>
---
 include/hw/boards.h        |  3 +++
 include/hw/i386/pc.h       |  3 +++
 hw/arm/virt.c              |  9 ++++++++-
 hw/core/machine.c          |  3 +++
 hw/i386/pc.c               |  3 +++
 hw/i386/pc_piix.c          | 14 +++++++++++++-
 hw/i386/pc_q35.c           | 13 ++++++++++++-
 hw/m68k/virt.c             |  9 ++++++++-
 hw/ppc/spapr.c             | 15 +++++++++++++--
 hw/s390x/s390-virtio-ccw.c | 14 +++++++++++++-
 10 files changed, 79 insertions(+), 7 deletions(-)

diff --git a/include/hw/boards.h b/include/hw/boards.h
index 7b416c9787..311ed17e18 100644
--- a/include/hw/boards.h
+++ b/include/hw/boards.h
@@ -379,6 +379,9 @@ struct MachineState {
     } \
     type_init(machine_initfn##_register_types)
 
+extern GlobalProperty hw_compat_7_1[];
+extern const size_t hw_compat_7_1_len;
+
 extern GlobalProperty hw_compat_7_0[];
 extern const size_t hw_compat_7_0_len;
 
diff --git a/include/hw/i386/pc.h b/include/hw/i386/pc.h
index 8435733bd6..c95333514e 100644
--- a/include/hw/i386/pc.h
+++ b/include/hw/i386/pc.h
@@ -200,6 +200,9 @@ void pc_madt_cpu_entry(AcpiDeviceIf *adev, int uid,
 /* sgx.c */
 void pc_machine_init_sgx_epc(PCMachineState *pcms);
 
+extern GlobalProperty pc_compat_7_1[];
+extern const size_t pc_compat_7_1_len;
+
 extern GlobalProperty pc_compat_7_0[];
 extern const size_t pc_compat_7_0_len;
 
diff --git a/hw/arm/virt.c b/hw/arm/virt.c
index 9633f822f3..1a6480fd2a 100644
--- a/hw/arm/virt.c
+++ b/hw/arm/virt.c
@@ -3094,10 +3094,17 @@ static void machvirt_machine_init(void)
 }
 type_init(machvirt_machine_init);
 
+static void virt_machine_7_2_options(MachineClass *mc)
+{
+}
+DEFINE_VIRT_MACHINE_AS_LATEST(7, 2)
+
 static void virt_machine_7_1_options(MachineClass *mc)
 {
+    virt_machine_7_2_options(mc);
+    compat_props_add(mc->compat_props, hw_compat_7_1, hw_compat_7_1_len);
 }
-DEFINE_VIRT_MACHINE_AS_LATEST(7, 1)
+DEFINE_VIRT_MACHINE(7, 1)
 
 static void virt_machine_7_0_options(MachineClass *mc)
 {
diff --git a/hw/core/machine.c b/hw/core/machine.c
index a673302cce..aa520e74a8 100644
--- a/hw/core/machine.c
+++ b/hw/core/machine.c
@@ -40,6 +40,9 @@
 #include "hw/virtio/virtio-pci.h"
 #include "qom/object_interfaces.h"
 
+GlobalProperty hw_compat_7_1[] = {};
+const size_t hw_compat_7_1_len = G_N_ELEMENTS(hw_compat_7_1);
+
 GlobalProperty hw_compat_7_0[] = {
     { "arm-gicv3-common", "force-8-bit-prio", "on" },
     { "nvme-ns", "eui64-default", "on"},
diff --git a/hw/i386/pc.c b/hw/i386/pc.c
index 7280c02ce3..566accf7e6 100644
--- a/hw/i386/pc.c
+++ b/hw/i386/pc.c
@@ -107,6 +107,9 @@
     { "qemu64-" TYPE_X86_CPU, "model-id", "QEMU Virtual CPU version " v, },\
     { "athlon-" TYPE_X86_CPU, "model-id", "QEMU Virtual CPU version " v, },
 
+GlobalProperty pc_compat_7_1[] = {};
+const size_t pc_compat_7_1_len = G_N_ELEMENTS(pc_compat_7_1);
+
 GlobalProperty pc_compat_7_0[] = {};
 const size_t pc_compat_7_0_len = G_N_ELEMENTS(pc_compat_7_0);
 
diff --git a/hw/i386/pc_piix.c b/hw/i386/pc_piix.c
index 20962c34e7..8043a250ad 100644
--- a/hw/i386/pc_piix.c
+++ b/hw/i386/pc_piix.c
@@ -432,7 +432,7 @@ static void pc_i440fx_machine_options(MachineClass *m)
     machine_class_allow_dynamic_sysbus_dev(m, TYPE_VMBUS_BRIDGE);
 }
 
-static void pc_i440fx_7_1_machine_options(MachineClass *m)
+static void pc_i440fx_7_2_machine_options(MachineClass *m)
 {
     PCMachineClass *pcmc = PC_MACHINE_CLASS(m);
     pc_i440fx_machine_options(m);
@@ -442,6 +442,18 @@ static void pc_i440fx_7_1_machine_options(MachineClass *m)
     pcmc->legacy_no_rng_seed = true;
 }
 
+DEFINE_I440FX_MACHINE(v7_2, "pc-i440fx-7.2", NULL,
+                      pc_i440fx_7_2_machine_options);
+
+static void pc_i440fx_7_1_machine_options(MachineClass *m)
+{
+    pc_i440fx_7_2_machine_options(m);
+    m->alias = NULL;
+    m->is_default = false;
+    compat_props_add(m->compat_props, hw_compat_7_1, hw_compat_7_1_len);
+    compat_props_add(m->compat_props, pc_compat_7_1, pc_compat_7_1_len);
+}
+
 DEFINE_I440FX_MACHINE(v7_1, "pc-i440fx-7.1", NULL,
                       pc_i440fx_7_1_machine_options);
 
diff --git a/hw/i386/pc_q35.c b/hw/i386/pc_q35.c
index 2e5dae9a89..53eda50e81 100644
--- a/hw/i386/pc_q35.c
+++ b/hw/i386/pc_q35.c
@@ -370,7 +370,7 @@ static void pc_q35_machine_options(MachineClass *m)
     m->max_cpus = 288;
 }
 
-static void pc_q35_7_1_machine_options(MachineClass *m)
+static void pc_q35_7_2_machine_options(MachineClass *m)
 {
     PCMachineClass *pcmc = PC_MACHINE_CLASS(m);
     pc_q35_machine_options(m);
@@ -379,6 +379,17 @@ static void pc_q35_7_1_machine_options(MachineClass *m)
     pcmc->legacy_no_rng_seed = true;
 }
 
+DEFINE_Q35_MACHINE(v7_2, "pc-q35-7.2", NULL,
+                   pc_q35_7_2_machine_options);
+
+static void pc_q35_7_1_machine_options(MachineClass *m)
+{
+    pc_q35_7_2_machine_options(m);
+    m->alias = NULL;
+    compat_props_add(m->compat_props, hw_compat_7_1, hw_compat_7_1_len);
+    compat_props_add(m->compat_props, pc_compat_7_1, pc_compat_7_1_len);
+}
+
 DEFINE_Q35_MACHINE(v7_1, "pc-q35-7.1", NULL,
                    pc_q35_7_1_machine_options);
 
diff --git a/hw/m68k/virt.c b/hw/m68k/virt.c
index 0aa383fa6b..3122c8ef2c 100644
--- a/hw/m68k/virt.c
+++ b/hw/m68k/virt.c
@@ -322,10 +322,17 @@ type_init(virt_machine_register_types)
     } \
     type_init(machvirt_machine_##major##_##minor##_init);
 
+static void virt_machine_7_2_options(MachineClass *mc)
+{
+}
+DEFINE_VIRT_MACHINE(7, 2, true)
+
 static void virt_machine_7_1_options(MachineClass *mc)
 {
+    virt_machine_7_2_options(mc);
+    compat_props_add(mc->compat_props, hw_compat_7_1, hw_compat_7_1_len);
 }
-DEFINE_VIRT_MACHINE(7, 1, true)
+DEFINE_VIRT_MACHINE(7, 1, false)
 
 static void virt_machine_7_0_options(MachineClass *mc)
 {
diff --git a/hw/ppc/spapr.c b/hw/ppc/spapr.c
index bc9ba6e6dc..fb790b61e4 100644
--- a/hw/ppc/spapr.c
+++ b/hw/ppc/spapr.c
@@ -4730,15 +4730,26 @@ static void spapr_machine_latest_class_options(MachineClass *mc)
     }                                                                \
     type_init(spapr_machine_register_##suffix)
 
+/*
+ * pseries-7.2
+ */
+static void spapr_machine_7_2_class_options(MachineClass *mc)
+{
+    /* Defaults for the latest behaviour inherited from the base class */
+}
+
+DEFINE_SPAPR_MACHINE(7_2, "7.2", true);
+
 /*
  * pseries-7.1
  */
 static void spapr_machine_7_1_class_options(MachineClass *mc)
 {
-    /* Defaults for the latest behaviour inherited from the base class */
+    spapr_machine_7_2_class_options(mc);
+    compat_props_add(mc->compat_props, hw_compat_7_1, hw_compat_7_1_len);
 }
 
-DEFINE_SPAPR_MACHINE(7_1, "7.1", true);
+DEFINE_SPAPR_MACHINE(7_1, "7.1", false);
 
 /*
  * pseries-7.0
diff --git a/hw/s390x/s390-virtio-ccw.c b/hw/s390x/s390-virtio-ccw.c
index cc3097bfee..bf1b36d824 100644
--- a/hw/s390x/s390-virtio-ccw.c
+++ b/hw/s390x/s390-virtio-ccw.c
@@ -792,14 +792,26 @@ bool css_migration_enabled(void)
     }                                                                         \
     type_init(ccw_machine_register_##suffix)
 
+static void ccw_machine_7_2_instance_options(MachineState *machine)
+{
+}
+
+static void ccw_machine_7_2_class_options(MachineClass *mc)
+{
+}
+DEFINE_CCW_MACHINE(7_2, "7.2", true);
+
 static void ccw_machine_7_1_instance_options(MachineState *machine)
 {
+    ccw_machine_7_2_instance_options(machine);
 }
 
 static void ccw_machine_7_1_class_options(MachineClass *mc)
 {
+    ccw_machine_7_2_class_options(mc);
+    compat_props_add(mc->compat_props, hw_compat_7_1, hw_compat_7_1_len);
 }
-DEFINE_CCW_MACHINE(7_1, "7.1", true);
+DEFINE_CCW_MACHINE(7_1, "7.1", false);
 
 static void ccw_machine_7_0_instance_options(MachineState *machine)
 {
-- 
2.31.1



^ permalink raw reply related	[flat|nested] 8+ messages in thread

* [PULL 2/6] s390x/cpumodel: add stfl197 processor-activity-instrumentation extension 1
  2022-08-30 17:19 [PULL 0/6] First s390x updates for QEMU 7.2 Thomas Huth
  2022-08-30 17:19 ` [PULL 1/6] hw: Add compat machines for 7.2 Thomas Huth
@ 2022-08-30 17:19 ` Thomas Huth
  2022-08-30 17:19 ` [PULL 3/6] target/s390x: Fix CLFIT and CLGIT immediate size Thomas Huth
                   ` (4 subsequent siblings)
  6 siblings, 0 replies; 8+ messages in thread
From: Thomas Huth @ 2022-08-30 17:19 UTC (permalink / raw)
  To: qemu-devel, Richard Henderson, Peter Maydell; +Cc: qemu-s390x

From: Christian Borntraeger <borntraeger@linux.ibm.com>

Add stfle 197 (processor-activity-instrumentation extension 1) to the
gen16 default model and fence it off for 7.1 and older.

Signed-off-by: Christian Borntraeger <borntraeger@linux.ibm.com>
Reviewed-by: David Hildenbrand <david@redhat.com>
Message-Id: <20220727135120.12784-1-borntraeger@linux.ibm.com>
Acked-by: Cornelia Huck <cohuck@redhat.com>
Signed-off-by: Thomas Huth <thuth@redhat.com>
---
 target/s390x/cpu_features_def.h.inc | 1 +
 hw/s390x/s390-virtio-ccw.c          | 1 +
 target/s390x/gen-features.c         | 2 ++
 3 files changed, 4 insertions(+)

diff --git a/target/s390x/cpu_features_def.h.inc b/target/s390x/cpu_features_def.h.inc
index 3603e5fb12..e3cfe63735 100644
--- a/target/s390x/cpu_features_def.h.inc
+++ b/target/s390x/cpu_features_def.h.inc
@@ -114,6 +114,7 @@ DEF_FEAT(VECTOR_PACKED_DECIMAL_ENH2, "vxpdeh2", STFL, 192, "Vector-Packed-Decima
 DEF_FEAT(BEAR_ENH, "beareh", STFL, 193, "BEAR-enhancement facility")
 DEF_FEAT(RDP, "rdp", STFL, 194, "Reset-DAT-protection facility")
 DEF_FEAT(PAI, "pai", STFL, 196, "Processor-Activity-Instrumentation facility")
+DEF_FEAT(PAIE, "paie", STFL, 197, "Processor-Activity-Instrumentation extension-1")
 
 /* Features exposed via SCLP SCCB Byte 80 - 98  (bit numbers relative to byte-80) */
 DEF_FEAT(SIE_GSLS, "gsls", SCLP_CONF_CHAR, 40, "SIE: Guest-storage-limit-suppression facility")
diff --git a/hw/s390x/s390-virtio-ccw.c b/hw/s390x/s390-virtio-ccw.c
index bf1b36d824..9a2467c889 100644
--- a/hw/s390x/s390-virtio-ccw.c
+++ b/hw/s390x/s390-virtio-ccw.c
@@ -804,6 +804,7 @@ DEFINE_CCW_MACHINE(7_2, "7.2", true);
 static void ccw_machine_7_1_instance_options(MachineState *machine)
 {
     ccw_machine_7_2_instance_options(machine);
+    s390_cpudef_featoff_greater(16, 1, S390_FEAT_PAIE);
 }
 
 static void ccw_machine_7_1_class_options(MachineClass *mc)
diff --git a/target/s390x/gen-features.c b/target/s390x/gen-features.c
index ad140184b9..1558c52626 100644
--- a/target/s390x/gen-features.c
+++ b/target/s390x/gen-features.c
@@ -575,6 +575,7 @@ static uint16_t full_GEN16_GA1[] = {
     S390_FEAT_BEAR_ENH,
     S390_FEAT_RDP,
     S390_FEAT_PAI,
+    S390_FEAT_PAIE,
 };
 
 
@@ -669,6 +670,7 @@ static uint16_t default_GEN16_GA1[] = {
     S390_FEAT_BEAR_ENH,
     S390_FEAT_RDP,
     S390_FEAT_PAI,
+    S390_FEAT_PAIE,
 };
 
 /* QEMU (CPU model) features */
-- 
2.31.1



^ permalink raw reply related	[flat|nested] 8+ messages in thread

* [PULL 3/6] target/s390x: Fix CLFIT and CLGIT immediate size
  2022-08-30 17:19 [PULL 0/6] First s390x updates for QEMU 7.2 Thomas Huth
  2022-08-30 17:19 ` [PULL 1/6] hw: Add compat machines for 7.2 Thomas Huth
  2022-08-30 17:19 ` [PULL 2/6] s390x/cpumodel: add stfl197 processor-activity-instrumentation extension 1 Thomas Huth
@ 2022-08-30 17:19 ` Thomas Huth
  2022-08-30 17:19 ` [PULL 4/6] backends/hostmem: Fix support of memory-backend-memfd in qemu_maxrampagesize() Thomas Huth
                   ` (3 subsequent siblings)
  6 siblings, 0 replies; 8+ messages in thread
From: Thomas Huth @ 2022-08-30 17:19 UTC (permalink / raw)
  To: qemu-devel, Richard Henderson, Peter Maydell; +Cc: qemu-s390x

From: Ilya Leoshkevich <iii@linux.ibm.com>

I2 is 16 bits, not 32.

Found by running valgrind's none/tests/s390x/traps.

Fixes: 1c2687518235 ("target-s390: Implement COMPARE AND TRAP")
Signed-off-by: Ilya Leoshkevich <iii@linux.ibm.com>
Message-Id: <20220817161529.597414-1-iii@linux.ibm.com>
Reviewed-by: David Hildenbrand <david@redhat.com>
Signed-off-by: Thomas Huth <thuth@redhat.com>
---
 target/s390x/tcg/insn-data.def | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/target/s390x/tcg/insn-data.def b/target/s390x/tcg/insn-data.def
index 5e448bb2c4..6d2cfe5fa2 100644
--- a/target/s390x/tcg/insn-data.def
+++ b/target/s390x/tcg/insn-data.def
@@ -290,8 +290,8 @@
     D(0xb961, CLGRT,   RRF_c, GIE, r1_o, r2_o, 0, 0, ct, 0, 1)
     D(0xeb23, CLT,     RSY_b, MIE, r1_32u, m2_32u, 0, 0, ct, 0, 1)
     D(0xeb2b, CLGT,    RSY_b, MIE, r1_o, m2_64, 0, 0, ct, 0, 1)
-    D(0xec73, CLFIT,   RIE_a, GIE, r1_32u, i2_32u, 0, 0, ct, 0, 1)
-    D(0xec71, CLGIT,   RIE_a, GIE, r1_o, i2_32u, 0, 0, ct, 0, 1)
+    D(0xec73, CLFIT,   RIE_a, GIE, r1_32u, i2_16u, 0, 0, ct, 0, 1)
+    D(0xec71, CLGIT,   RIE_a, GIE, r1_o, i2_16u, 0, 0, ct, 0, 1)
 
 /* CONVERT TO DECIMAL */
     C(0x4e00, CVD,     RX_a,  Z,   r1_o, a2, 0, 0, cvd, 0)
-- 
2.31.1



^ permalink raw reply related	[flat|nested] 8+ messages in thread

* [PULL 4/6] backends/hostmem: Fix support of memory-backend-memfd in qemu_maxrampagesize()
  2022-08-30 17:19 [PULL 0/6] First s390x updates for QEMU 7.2 Thomas Huth
                   ` (2 preceding siblings ...)
  2022-08-30 17:19 ` [PULL 3/6] target/s390x: Fix CLFIT and CLGIT immediate size Thomas Huth
@ 2022-08-30 17:19 ` Thomas Huth
  2022-08-30 17:19 ` [PULL 5/6] softmmu/physmem: Remove the ifdef __linux__ around the pagesize functions Thomas Huth
                   ` (2 subsequent siblings)
  6 siblings, 0 replies; 8+ messages in thread
From: Thomas Huth @ 2022-08-30 17:19 UTC (permalink / raw)
  To: qemu-devel, Richard Henderson, Peter Maydell; +Cc: qemu-s390x

It is currently not possible yet to use "memory-backend-memfd" on s390x
with hugepages enabled. This problem is caused by qemu_maxrampagesize()
not taking memory-backend-memfd objects into account yet, so the code
in s390_memory_init() fails to enable the huge page support there via
s390_set_max_pagesize(). Fix it by generalizing the code, so that it
looks at qemu_ram_pagesize(memdev->mr.ram_block) instead of re-trying
to get the information from the filesystem.

Suggested-by: David Hildenbrand <david@redhat.com>
Buglink: https://bugzilla.redhat.com/show_bug.cgi?id=2116496
Message-Id: <20220810125720.3849835-2-thuth@redhat.com>
Reviewed-by: David Hildenbrand <david@redhat.com>
Reviewed-by: Claudio Imbrenda <imbrenda@linux.ibm.com>
Signed-off-by: Thomas Huth <thuth@redhat.com>
---
 backends/hostmem.c | 14 ++------------
 1 file changed, 2 insertions(+), 12 deletions(-)

diff --git a/backends/hostmem.c b/backends/hostmem.c
index 624bb7ecd3..4428e06738 100644
--- a/backends/hostmem.c
+++ b/backends/hostmem.c
@@ -306,22 +306,12 @@ bool host_memory_backend_is_mapped(HostMemoryBackend *backend)
     return backend->is_mapped;
 }
 
-#ifdef __linux__
 size_t host_memory_backend_pagesize(HostMemoryBackend *memdev)
 {
-    Object *obj = OBJECT(memdev);
-    char *path = object_property_get_str(obj, "mem-path", NULL);
-    size_t pagesize = qemu_mempath_getpagesize(path);
-
-    g_free(path);
+    size_t pagesize = qemu_ram_pagesize(memdev->mr.ram_block);
+    g_assert(pagesize >= qemu_real_host_page_size());
     return pagesize;
 }
-#else
-size_t host_memory_backend_pagesize(HostMemoryBackend *memdev)
-{
-    return qemu_real_host_page_size();
-}
-#endif
 
 static void
 host_memory_backend_memory_complete(UserCreatable *uc, Error **errp)
-- 
2.31.1



^ permalink raw reply related	[flat|nested] 8+ messages in thread

* [PULL 5/6] softmmu/physmem: Remove the ifdef __linux__ around the pagesize functions
  2022-08-30 17:19 [PULL 0/6] First s390x updates for QEMU 7.2 Thomas Huth
                   ` (3 preceding siblings ...)
  2022-08-30 17:19 ` [PULL 4/6] backends/hostmem: Fix support of memory-backend-memfd in qemu_maxrampagesize() Thomas Huth
@ 2022-08-30 17:19 ` Thomas Huth
  2022-08-30 17:19 ` [PULL 6/6] util/mmap-alloc: Remove qemu_mempath_getpagesize() Thomas Huth
  2022-08-31 22:16 ` [PULL 0/6] First s390x updates for QEMU 7.2 Stefan Hajnoczi
  6 siblings, 0 replies; 8+ messages in thread
From: Thomas Huth @ 2022-08-30 17:19 UTC (permalink / raw)
  To: qemu-devel, Richard Henderson, Peter Maydell; +Cc: qemu-s390x

Now that host_memory_backend_pagesize() is not depending on the hugetlb
memory path handling anymore, we can also remove the #ifdef and the
TOCTTOU comment from the calling functions - the code should now work
equally well on all host architectures.

Message-Id: <20220810125720.3849835-3-thuth@redhat.com>
Reviewed-by: Claudio Imbrenda <imbrenda@linux.ibm.com>
Acked-by: David Hildenbrand <david@redhat.com>
Signed-off-by: Thomas Huth <thuth@redhat.com>
---
 softmmu/physmem.c | 17 -----------------
 1 file changed, 17 deletions(-)

diff --git a/softmmu/physmem.c b/softmmu/physmem.c
index dc3c3e5f2e..50231bab30 100644
--- a/softmmu/physmem.c
+++ b/softmmu/physmem.c
@@ -1331,13 +1331,6 @@ GString *ram_block_format(void)
     return buf;
 }
 
-#ifdef __linux__
-/*
- * FIXME TOCTTOU: this iterates over memory backends' mem-path, which
- * may or may not name the same files / on the same filesystem now as
- * when we actually open and map them.  Iterate over the file
- * descriptors instead, and use qemu_fd_getpagesize().
- */
 static int find_min_backend_pagesize(Object *obj, void *opaque)
 {
     long *hpsize_min = opaque;
@@ -1391,16 +1384,6 @@ long qemu_maxrampagesize(void)
     object_child_foreach(memdev_root, find_max_backend_pagesize, &pagesize);
     return pagesize;
 }
-#else
-long qemu_minrampagesize(void)
-{
-    return qemu_real_host_page_size();
-}
-long qemu_maxrampagesize(void)
-{
-    return qemu_real_host_page_size();
-}
-#endif
 
 #ifdef CONFIG_POSIX
 static int64_t get_file_size(int fd)
-- 
2.31.1



^ permalink raw reply related	[flat|nested] 8+ messages in thread

* [PULL 6/6] util/mmap-alloc: Remove qemu_mempath_getpagesize()
  2022-08-30 17:19 [PULL 0/6] First s390x updates for QEMU 7.2 Thomas Huth
                   ` (4 preceding siblings ...)
  2022-08-30 17:19 ` [PULL 5/6] softmmu/physmem: Remove the ifdef __linux__ around the pagesize functions Thomas Huth
@ 2022-08-30 17:19 ` Thomas Huth
  2022-08-31 22:16 ` [PULL 0/6] First s390x updates for QEMU 7.2 Stefan Hajnoczi
  6 siblings, 0 replies; 8+ messages in thread
From: Thomas Huth @ 2022-08-30 17:19 UTC (permalink / raw)
  To: qemu-devel, Richard Henderson, Peter Maydell; +Cc: qemu-s390x

The last user of this function has just been removed, so we can
drop this function now, too.

Message-Id: <20220810125720.3849835-4-thuth@redhat.com>
Reviewed-by: David Hildenbrand <david@redhat.com>
Reviewed-by: Claudio Imbrenda <imbrenda@linux.ibm.com>
Signed-off-by: Thomas Huth <thuth@redhat.com>
---
 include/qemu/mmap-alloc.h |  2 --
 util/mmap-alloc.c         | 31 -------------------------------
 2 files changed, 33 deletions(-)

diff --git a/include/qemu/mmap-alloc.h b/include/qemu/mmap-alloc.h
index 5076695cc8..2825e231a7 100644
--- a/include/qemu/mmap-alloc.h
+++ b/include/qemu/mmap-alloc.h
@@ -4,8 +4,6 @@
 
 size_t qemu_fd_getpagesize(int fd);
 
-size_t qemu_mempath_getpagesize(const char *mem_path);
-
 /**
  * qemu_ram_mmap: mmap anonymous memory, the specified file or device.
  *
diff --git a/util/mmap-alloc.c b/util/mmap-alloc.c
index 5b90cb68ea..5ed7d29183 100644
--- a/util/mmap-alloc.c
+++ b/util/mmap-alloc.c
@@ -53,37 +53,6 @@ size_t qemu_fd_getpagesize(int fd)
     return qemu_real_host_page_size();
 }
 
-size_t qemu_mempath_getpagesize(const char *mem_path)
-{
-#ifdef CONFIG_LINUX
-    struct statfs fs;
-    int ret;
-
-    if (mem_path) {
-        do {
-            ret = statfs(mem_path, &fs);
-        } while (ret != 0 && errno == EINTR);
-
-        if (ret != 0) {
-            fprintf(stderr, "Couldn't statfs() memory path: %s\n",
-                    strerror(errno));
-            exit(1);
-        }
-
-        if (fs.f_type == HUGETLBFS_MAGIC) {
-            /* It's hugepage, return the huge page size */
-            return fs.f_bsize;
-        }
-    }
-#ifdef __sparc__
-    /* SPARC Linux needs greater alignment than the pagesize */
-    return QEMU_VMALLOC_ALIGN;
-#endif
-#endif
-
-    return qemu_real_host_page_size();
-}
-
 #define OVERCOMMIT_MEMORY_PATH "/proc/sys/vm/overcommit_memory"
 static bool map_noreserve_effective(int fd, uint32_t qemu_map_flags)
 {
-- 
2.31.1



^ permalink raw reply related	[flat|nested] 8+ messages in thread

* Re: [PULL 0/6] First s390x updates for QEMU 7.2
  2022-08-30 17:19 [PULL 0/6] First s390x updates for QEMU 7.2 Thomas Huth
                   ` (5 preceding siblings ...)
  2022-08-30 17:19 ` [PULL 6/6] util/mmap-alloc: Remove qemu_mempath_getpagesize() Thomas Huth
@ 2022-08-31 22:16 ` Stefan Hajnoczi
  6 siblings, 0 replies; 8+ messages in thread
From: Stefan Hajnoczi @ 2022-08-31 22:16 UTC (permalink / raw)
  To: Thomas Huth; +Cc: qemu-devel, Richard Henderson, Peter Maydell, qemu-s390x

[-- Attachment #1: Type: text/plain, Size: 115 bytes --]

Applied, thanks.

Please update the changelog at https://wiki.qemu.org/ChangeLog/7.2 for any user-visible changes.

[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 488 bytes --]

^ permalink raw reply	[flat|nested] 8+ messages in thread

end of thread, other threads:[~2022-08-31 22:18 UTC | newest]

Thread overview: 8+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2022-08-30 17:19 [PULL 0/6] First s390x updates for QEMU 7.2 Thomas Huth
2022-08-30 17:19 ` [PULL 1/6] hw: Add compat machines for 7.2 Thomas Huth
2022-08-30 17:19 ` [PULL 2/6] s390x/cpumodel: add stfl197 processor-activity-instrumentation extension 1 Thomas Huth
2022-08-30 17:19 ` [PULL 3/6] target/s390x: Fix CLFIT and CLGIT immediate size Thomas Huth
2022-08-30 17:19 ` [PULL 4/6] backends/hostmem: Fix support of memory-backend-memfd in qemu_maxrampagesize() Thomas Huth
2022-08-30 17:19 ` [PULL 5/6] softmmu/physmem: Remove the ifdef __linux__ around the pagesize functions Thomas Huth
2022-08-30 17:19 ` [PULL 6/6] util/mmap-alloc: Remove qemu_mempath_getpagesize() Thomas Huth
2022-08-31 22:16 ` [PULL 0/6] First s390x updates for QEMU 7.2 Stefan Hajnoczi

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).