[PULL 21/86] bios-tables-test: add test for number of cores > 255

Michael S. Tsirkin posted 86 patches 3 years, 3 months ago
Maintainers: "Gonglei (Arei)" <arei.gonglei@huawei.com>, "Daniel P. Berrangé" <berrange@redhat.com>, Ani Sinha <ani@anisinha.ca>, "Michael S. Tsirkin" <mst@redhat.com>, Igor Mammedov <imammedo@redhat.com>, Peter Maydell <peter.maydell@linaro.org>, Shannon Zhao <shannon.zhaosl@gmail.com>, Raphael Norwitz <raphael.norwitz@nutanix.com>, Kevin Wolf <kwolf@redhat.com>, Hanna Reitz <hreitz@redhat.com>, Eduardo Habkost <eduardo@habkost.net>, Marcel Apfelbaum <marcel.apfelbaum@gmail.com>, "Philippe Mathieu-Daudé" <philmd@linaro.org>, Yanan Wang <wangyanan55@huawei.com>, Ben Widawsky <ben.widawsky@intel.com>, Jonathan Cameron <jonathan.cameron@huawei.com>, Gerd Hoffmann <kraxel@redhat.com>, Paolo Bonzini <pbonzini@redhat.com>, Richard Henderson <richard.henderson@linaro.org>, Peter Xu <peterx@redhat.com>, Jason Wang <jasowang@redhat.com>, Sergio Lopez <slp@redhat.com>, John Snow <jsnow@redhat.com>, Dmitry Fleytman <dmitry.fleytman@gmail.com>, Jiri Pirko <jiri@resnulli.us>, Keith Busch <kbusch@kernel.org>, Klaus Jensen <its@irrelevant.dk>, Huai-Cheng Kuo <hchkuo@avery-design.com.tw>, Chris Browy <cbrowy@avery-design.com>, Yuval Shaia <yuval.shaia.ml@gmail.com>, Elena Ufimtseva <elena.ufimtseva@oracle.com>, Jagannathan Raman <jag.raman@oracle.com>, John G Johnson <john.g.johnson@oracle.com>, Alex Williamson <alex.williamson@redhat.com>, Eric Auger <eric.auger@redhat.com>, David Hildenbrand <david@redhat.com>, Eric Blake <eblake@redhat.com>, Markus Armbruster <armbru@redhat.com>, Cleber Rosa <crosa@redhat.com>, Wainer dos Santos Moschetta <wainersm@redhat.com>, Beraldo Leal <bleal@redhat.com>, Thomas Huth <thuth@redhat.com>, Laurent Vivier <lvivier@redhat.com>
There is a newer version of this series
[PULL 21/86] bios-tables-test: add test for number of cores > 255
Posted by Michael S. Tsirkin 3 years, 3 months ago
From: Julia Suvorova <jusual@redhat.com>

The new test is run with a large number of cpus and checks if the
core_count field in smbios_cpu_test (structure type 4) is correct.

Choose q35 as it allows to run with -smp > 255.

Signed-off-by: Julia Suvorova <jusual@redhat.com>
Message-Id: <20220731162141.178443-5-jusual@redhat.com>
Message-Id: <20221011111731.101412-5-jusual@redhat.com>
Reviewed-by: Michael S. Tsirkin <mst@redhat.com>
Signed-off-by: Michael S. Tsirkin <mst@redhat.com>
Reviewed-by: Igor Mammedov <imammedo@redhat.com>
---
 tests/qtest/bios-tables-test.c | 58 ++++++++++++++++++++++++++--------
 1 file changed, 45 insertions(+), 13 deletions(-)

diff --git a/tests/qtest/bios-tables-test.c b/tests/qtest/bios-tables-test.c
index d4fbe6791d..e402b57d46 100644
--- a/tests/qtest/bios-tables-test.c
+++ b/tests/qtest/bios-tables-test.c
@@ -92,6 +92,8 @@ typedef struct {
     SmbiosEntryPoint smbios_ep_table;
     uint16_t smbios_cpu_max_speed;
     uint16_t smbios_cpu_curr_speed;
+    uint8_t smbios_core_count;
+    uint16_t smbios_core_count2;
     uint8_t *required_struct_types;
     int required_struct_types_len;
     QTestState *qts;
@@ -631,29 +633,42 @@ static inline bool smbios_single_instance(uint8_t type)
     }
 }
 
-static bool smbios_cpu_test(test_data *data, uint32_t addr)
+static void smbios_cpu_test(test_data *data, uint32_t addr,
+                            SmbiosEntryPointType ep_type)
 {
-    uint16_t expect_speed[2];
-    uint16_t real;
+    uint8_t core_count, expected_core_count = data->smbios_core_count;
+    uint16_t speed, expected_speed[2];
+    uint16_t core_count2, expected_core_count2 = data->smbios_core_count2;
     int offset[2];
     int i;
 
     /* Check CPU speed for backward compatibility */
     offset[0] = offsetof(struct smbios_type_4, max_speed);
     offset[1] = offsetof(struct smbios_type_4, current_speed);
-    expect_speed[0] = data->smbios_cpu_max_speed ? : 2000;
-    expect_speed[1] = data->smbios_cpu_curr_speed ? : 2000;
+    expected_speed[0] = data->smbios_cpu_max_speed ? : 2000;
+    expected_speed[1] = data->smbios_cpu_curr_speed ? : 2000;
 
     for (i = 0; i < 2; i++) {
-        real = qtest_readw(data->qts, addr + offset[i]);
-        if (real != expect_speed[i]) {
-            fprintf(stderr, "Unexpected SMBIOS CPU speed: real %u expect %u\n",
-                    real, expect_speed[i]);
-            return false;
-        }
+        speed = qtest_readw(data->qts, addr + offset[i]);
+        g_assert_cmpuint(speed, ==, expected_speed[i]);
     }
 
-    return true;
+    core_count = qtest_readb(data->qts,
+                    addr + offsetof(struct smbios_type_4, core_count));
+
+    if (expected_core_count) {
+        g_assert_cmpuint(core_count, ==, expected_core_count);
+    }
+
+    if (ep_type == SMBIOS_ENTRY_POINT_TYPE_64) {
+        core_count2 = qtest_readw(data->qts,
+                          addr + offsetof(struct smbios_type_4, core_count2));
+
+        /* Core Count has reached its limit, checking Core Count 2 */
+        if (expected_core_count == 0xFF && expected_core_count2) {
+            g_assert_cmpuint(core_count2, ==, expected_core_count2);
+        }
+    }
 }
 
 static void test_smbios_structs(test_data *data, SmbiosEntryPointType ep_type)
@@ -686,7 +701,7 @@ static void test_smbios_structs(test_data *data, SmbiosEntryPointType ep_type)
         set_bit(type, struct_bitmap);
 
         if (type == 4) {
-            g_assert(smbios_cpu_test(data, addr));
+            smbios_cpu_test(data, addr, ep_type);
         }
 
         /* seek to end of unformatted string area of this struct ("\0\0") */
@@ -908,6 +923,21 @@ static void test_acpi_q35_tcg(void)
     free_test_data(&data);
 }
 
+static void test_acpi_q35_tcg_core_count2(void)
+{
+    test_data data = {
+        .machine = MACHINE_Q35,
+        .variant = ".core-count2",
+        .required_struct_types = base_required_struct_types,
+        .required_struct_types_len = ARRAY_SIZE(base_required_struct_types),
+        .smbios_core_count = 0xFF,
+        .smbios_core_count2 = 275,
+    };
+
+    test_acpi_one("-machine smbios-entry-point-type=64 -smp 275", &data);
+    free_test_data(&data);
+}
+
 static void test_acpi_q35_tcg_bridge(void)
 {
     test_data data;
@@ -1859,6 +1889,8 @@ int main(int argc, char *argv[])
                 qtest_add_func("acpi/q35/tpm12-tis",
                                test_acpi_q35_tcg_tpm12_tis);
             }
+            qtest_add_func("acpi/q35/core-count2",
+                           test_acpi_q35_tcg_core_count2);
             qtest_add_func("acpi/q35/bridge", test_acpi_q35_tcg_bridge);
             qtest_add_func("acpi/q35/multif-bridge",
                            test_acpi_q35_multif_bridge);
-- 
MST
Re: [PULL 21/86] bios-tables-test: add test for number of cores > 255
Posted by Jonathan Cameron via 3 years, 3 months ago
On Mon, 31 Oct 2022 08:51:44 -0400
"Michael S. Tsirkin" <mst@redhat.com> wrote:

> From: Julia Suvorova <jusual@redhat.com>
> 
> The new test is run with a large number of cpus and checks if the
> core_count field in smbios_cpu_test (structure type 4) is correct.
> 
> Choose q35 as it allows to run with -smp > 255.

Getting a failure on this on i386.

qemu-system-i386: current -smp configuration requires kernel irqchip and X2APIC API support.

Note that was on bisection of this pull request applied to current mainline
(also in the CI report for the HMAT set - though there is another issue there.)

My guess is fix is don't run it unless 64 bit?

Jonathan


> 
> Signed-off-by: Julia Suvorova <jusual@redhat.com>
> Message-Id: <20220731162141.178443-5-jusual@redhat.com>
> Message-Id: <20221011111731.101412-5-jusual@redhat.com>
> Reviewed-by: Michael S. Tsirkin <mst@redhat.com>
> Signed-off-by: Michael S. Tsirkin <mst@redhat.com>
> Reviewed-by: Igor Mammedov <imammedo@redhat.com>
> ---
>  tests/qtest/bios-tables-test.c | 58 ++++++++++++++++++++++++++--------
>  1 file changed, 45 insertions(+), 13 deletions(-)
> 
> diff --git a/tests/qtest/bios-tables-test.c b/tests/qtest/bios-tables-test.c
> index d4fbe6791d..e402b57d46 100644
> --- a/tests/qtest/bios-tables-test.c
> +++ b/tests/qtest/bios-tables-test.c
> @@ -92,6 +92,8 @@ typedef struct {
>      SmbiosEntryPoint smbios_ep_table;
>      uint16_t smbios_cpu_max_speed;
>      uint16_t smbios_cpu_curr_speed;
> +    uint8_t smbios_core_count;
> +    uint16_t smbios_core_count2;
>      uint8_t *required_struct_types;
>      int required_struct_types_len;
>      QTestState *qts;
> @@ -631,29 +633,42 @@ static inline bool smbios_single_instance(uint8_t type)
>      }
>  }
>  
> -static bool smbios_cpu_test(test_data *data, uint32_t addr)
> +static void smbios_cpu_test(test_data *data, uint32_t addr,
> +                            SmbiosEntryPointType ep_type)
>  {
> -    uint16_t expect_speed[2];
> -    uint16_t real;
> +    uint8_t core_count, expected_core_count = data->smbios_core_count;
> +    uint16_t speed, expected_speed[2];
> +    uint16_t core_count2, expected_core_count2 = data->smbios_core_count2;
>      int offset[2];
>      int i;
>  
>      /* Check CPU speed for backward compatibility */
>      offset[0] = offsetof(struct smbios_type_4, max_speed);
>      offset[1] = offsetof(struct smbios_type_4, current_speed);
> -    expect_speed[0] = data->smbios_cpu_max_speed ? : 2000;
> -    expect_speed[1] = data->smbios_cpu_curr_speed ? : 2000;
> +    expected_speed[0] = data->smbios_cpu_max_speed ? : 2000;
> +    expected_speed[1] = data->smbios_cpu_curr_speed ? : 2000;
>  
>      for (i = 0; i < 2; i++) {
> -        real = qtest_readw(data->qts, addr + offset[i]);
> -        if (real != expect_speed[i]) {
> -            fprintf(stderr, "Unexpected SMBIOS CPU speed: real %u expect %u\n",
> -                    real, expect_speed[i]);
> -            return false;
> -        }
> +        speed = qtest_readw(data->qts, addr + offset[i]);
> +        g_assert_cmpuint(speed, ==, expected_speed[i]);
>      }
>  
> -    return true;
> +    core_count = qtest_readb(data->qts,
> +                    addr + offsetof(struct smbios_type_4, core_count));
> +
> +    if (expected_core_count) {
> +        g_assert_cmpuint(core_count, ==, expected_core_count);
> +    }
> +
> +    if (ep_type == SMBIOS_ENTRY_POINT_TYPE_64) {
> +        core_count2 = qtest_readw(data->qts,
> +                          addr + offsetof(struct smbios_type_4, core_count2));
> +
> +        /* Core Count has reached its limit, checking Core Count 2 */
> +        if (expected_core_count == 0xFF && expected_core_count2) {
> +            g_assert_cmpuint(core_count2, ==, expected_core_count2);
> +        }
> +    }
>  }
>  
>  static void test_smbios_structs(test_data *data, SmbiosEntryPointType ep_type)
> @@ -686,7 +701,7 @@ static void test_smbios_structs(test_data *data, SmbiosEntryPointType ep_type)
>          set_bit(type, struct_bitmap);
>  
>          if (type == 4) {
> -            g_assert(smbios_cpu_test(data, addr));
> +            smbios_cpu_test(data, addr, ep_type);
>          }
>  
>          /* seek to end of unformatted string area of this struct ("\0\0") */
> @@ -908,6 +923,21 @@ static void test_acpi_q35_tcg(void)
>      free_test_data(&data);
>  }
>  
> +static void test_acpi_q35_tcg_core_count2(void)
> +{
> +    test_data data = {
> +        .machine = MACHINE_Q35,
> +        .variant = ".core-count2",
> +        .required_struct_types = base_required_struct_types,
> +        .required_struct_types_len = ARRAY_SIZE(base_required_struct_types),
> +        .smbios_core_count = 0xFF,
> +        .smbios_core_count2 = 275,
> +    };
> +
> +    test_acpi_one("-machine smbios-entry-point-type=64 -smp 275", &data);
> +    free_test_data(&data);
> +}
> +
>  static void test_acpi_q35_tcg_bridge(void)
>  {
>      test_data data;
> @@ -1859,6 +1889,8 @@ int main(int argc, char *argv[])
>                  qtest_add_func("acpi/q35/tpm12-tis",
>                                 test_acpi_q35_tcg_tpm12_tis);
>              }
> +            qtest_add_func("acpi/q35/core-count2",
> +                           test_acpi_q35_tcg_core_count2);
>              qtest_add_func("acpi/q35/bridge", test_acpi_q35_tcg_bridge);
>              qtest_add_func("acpi/q35/multif-bridge",
>                             test_acpi_q35_multif_bridge);
Re: [PULL 21/86] bios-tables-test: add test for number of cores > 255
Posted by Igor Mammedov 3 years, 3 months ago
On Tue, 1 Nov 2022 13:52:21 +0000
Jonathan Cameron <Jonathan.Cameron@huawei.com> wrote:

> On Mon, 31 Oct 2022 08:51:44 -0400
> "Michael S. Tsirkin" <mst@redhat.com> wrote:
> 
> > From: Julia Suvorova <jusual@redhat.com>
> > 
> > The new test is run with a large number of cpus and checks if the
> > core_count field in smbios_cpu_test (structure type 4) is correct.
> > 
> > Choose q35 as it allows to run with -smp > 255.  
> 
> Getting a failure on this on i386.
> 
> qemu-system-i386: current -smp configuration requires kernel irqchip and X2APIC API support.

just posted a fixup, see my other reply to Stefan in this pull req.

> 
> Note that was on bisection of this pull request applied to current mainline
> (also in the CI report for the HMAT set - though there is another issue there.)
> 
> My guess is fix is don't run it unless 64 bit?
> 
> Jonathan
> 
> 
> > 
> > Signed-off-by: Julia Suvorova <jusual@redhat.com>
> > Message-Id: <20220731162141.178443-5-jusual@redhat.com>
> > Message-Id: <20221011111731.101412-5-jusual@redhat.com>
> > Reviewed-by: Michael S. Tsirkin <mst@redhat.com>
> > Signed-off-by: Michael S. Tsirkin <mst@redhat.com>
> > Reviewed-by: Igor Mammedov <imammedo@redhat.com>
> > ---
> >  tests/qtest/bios-tables-test.c | 58 ++++++++++++++++++++++++++--------
> >  1 file changed, 45 insertions(+), 13 deletions(-)
> > 
> > diff --git a/tests/qtest/bios-tables-test.c b/tests/qtest/bios-tables-test.c
> > index d4fbe6791d..e402b57d46 100644
> > --- a/tests/qtest/bios-tables-test.c
> > +++ b/tests/qtest/bios-tables-test.c
> > @@ -92,6 +92,8 @@ typedef struct {
> >      SmbiosEntryPoint smbios_ep_table;
> >      uint16_t smbios_cpu_max_speed;
> >      uint16_t smbios_cpu_curr_speed;
> > +    uint8_t smbios_core_count;
> > +    uint16_t smbios_core_count2;
> >      uint8_t *required_struct_types;
> >      int required_struct_types_len;
> >      QTestState *qts;
> > @@ -631,29 +633,42 @@ static inline bool smbios_single_instance(uint8_t type)
> >      }
> >  }
> >  
> > -static bool smbios_cpu_test(test_data *data, uint32_t addr)
> > +static void smbios_cpu_test(test_data *data, uint32_t addr,
> > +                            SmbiosEntryPointType ep_type)
> >  {
> > -    uint16_t expect_speed[2];
> > -    uint16_t real;
> > +    uint8_t core_count, expected_core_count = data->smbios_core_count;
> > +    uint16_t speed, expected_speed[2];
> > +    uint16_t core_count2, expected_core_count2 = data->smbios_core_count2;
> >      int offset[2];
> >      int i;
> >  
> >      /* Check CPU speed for backward compatibility */
> >      offset[0] = offsetof(struct smbios_type_4, max_speed);
> >      offset[1] = offsetof(struct smbios_type_4, current_speed);
> > -    expect_speed[0] = data->smbios_cpu_max_speed ? : 2000;
> > -    expect_speed[1] = data->smbios_cpu_curr_speed ? : 2000;
> > +    expected_speed[0] = data->smbios_cpu_max_speed ? : 2000;
> > +    expected_speed[1] = data->smbios_cpu_curr_speed ? : 2000;
> >  
> >      for (i = 0; i < 2; i++) {
> > -        real = qtest_readw(data->qts, addr + offset[i]);
> > -        if (real != expect_speed[i]) {
> > -            fprintf(stderr, "Unexpected SMBIOS CPU speed: real %u expect %u\n",
> > -                    real, expect_speed[i]);
> > -            return false;
> > -        }
> > +        speed = qtest_readw(data->qts, addr + offset[i]);
> > +        g_assert_cmpuint(speed, ==, expected_speed[i]);
> >      }
> >  
> > -    return true;
> > +    core_count = qtest_readb(data->qts,
> > +                    addr + offsetof(struct smbios_type_4, core_count));
> > +
> > +    if (expected_core_count) {
> > +        g_assert_cmpuint(core_count, ==, expected_core_count);
> > +    }
> > +
> > +    if (ep_type == SMBIOS_ENTRY_POINT_TYPE_64) {
> > +        core_count2 = qtest_readw(data->qts,
> > +                          addr + offsetof(struct smbios_type_4, core_count2));
> > +
> > +        /* Core Count has reached its limit, checking Core Count 2 */
> > +        if (expected_core_count == 0xFF && expected_core_count2) {
> > +            g_assert_cmpuint(core_count2, ==, expected_core_count2);
> > +        }
> > +    }
> >  }
> >  
> >  static void test_smbios_structs(test_data *data, SmbiosEntryPointType ep_type)
> > @@ -686,7 +701,7 @@ static void test_smbios_structs(test_data *data, SmbiosEntryPointType ep_type)
> >          set_bit(type, struct_bitmap);
> >  
> >          if (type == 4) {
> > -            g_assert(smbios_cpu_test(data, addr));
> > +            smbios_cpu_test(data, addr, ep_type);
> >          }
> >  
> >          /* seek to end of unformatted string area of this struct ("\0\0") */
> > @@ -908,6 +923,21 @@ static void test_acpi_q35_tcg(void)
> >      free_test_data(&data);
> >  }
> >  
> > +static void test_acpi_q35_tcg_core_count2(void)
> > +{
> > +    test_data data = {
> > +        .machine = MACHINE_Q35,
> > +        .variant = ".core-count2",
> > +        .required_struct_types = base_required_struct_types,
> > +        .required_struct_types_len = ARRAY_SIZE(base_required_struct_types),
> > +        .smbios_core_count = 0xFF,
> > +        .smbios_core_count2 = 275,
> > +    };
> > +
> > +    test_acpi_one("-machine smbios-entry-point-type=64 -smp 275", &data);
> > +    free_test_data(&data);
> > +}
> > +
> >  static void test_acpi_q35_tcg_bridge(void)
> >  {
> >      test_data data;
> > @@ -1859,6 +1889,8 @@ int main(int argc, char *argv[])
> >                  qtest_add_func("acpi/q35/tpm12-tis",
> >                                 test_acpi_q35_tcg_tpm12_tis);
> >              }
> > +            qtest_add_func("acpi/q35/core-count2",
> > +                           test_acpi_q35_tcg_core_count2);
> >              qtest_add_func("acpi/q35/bridge", test_acpi_q35_tcg_bridge);
> >              qtest_add_func("acpi/q35/multif-bridge",
> >                             test_acpi_q35_multif_bridge);  
>
Re: [PULL 21/86] bios-tables-test: add test for number of cores > 255
Posted by Ani Sinha 3 years, 3 months ago
On Tue, Nov 1, 2022 at 19:22 Jonathan Cameron <Jonathan.Cameron@huawei.com>
wrote:

> On Mon, 31 Oct 2022 08:51:44 -0400
> "Michael S. Tsirkin" <mst@redhat.com> wrote:
>
> > From: Julia Suvorova <jusual@redhat.com>
> >
> > The new test is run with a large number of cpus and checks if the
> > core_count field in smbios_cpu_test (structure type 4) is correct.
> >
> > Choose q35 as it allows to run with -smp > 255.
>
> Getting a failure on this on i386.
>
> qemu-system-i386: current -smp configuration requires kernel irqchip and
> X2APIC API support.
>
> Note that was on bisection of this pull request applied to current mainline
> (also in the CI report for the HMAT set - though there is another issue
> there.)


Can you point me to the CI report?


>
> My guess is fix is don't run it unless 64 bit?
>
> Jonathan
>
>
> >
> > Signed-off-by: Julia Suvorova <jusual@redhat.com>
> > Message-Id: <20220731162141.178443-5-jusual@redhat.com>
> > Message-Id: <20221011111731.101412-5-jusual@redhat.com>
> > Reviewed-by: Michael S. Tsirkin <mst@redhat.com>
> > Signed-off-by: Michael S. Tsirkin <mst@redhat.com>
> > Reviewed-by: Igor Mammedov <imammedo@redhat.com>
> > ---
> >  tests/qtest/bios-tables-test.c | 58 ++++++++++++++++++++++++++--------
> >  1 file changed, 45 insertions(+), 13 deletions(-)
> >
> > diff --git a/tests/qtest/bios-tables-test.c
> b/tests/qtest/bios-tables-test.c
> > index d4fbe6791d..e402b57d46 100644
> > --- a/tests/qtest/bios-tables-test.c
> > +++ b/tests/qtest/bios-tables-test.c
> > @@ -92,6 +92,8 @@ typedef struct {
> >      SmbiosEntryPoint smbios_ep_table;
> >      uint16_t smbios_cpu_max_speed;
> >      uint16_t smbios_cpu_curr_speed;
> > +    uint8_t smbios_core_count;
> > +    uint16_t smbios_core_count2;
> >      uint8_t *required_struct_types;
> >      int required_struct_types_len;
> >      QTestState *qts;
> > @@ -631,29 +633,42 @@ static inline bool smbios_single_instance(uint8_t
> type)
> >      }
> >  }
> >
> > -static bool smbios_cpu_test(test_data *data, uint32_t addr)
> > +static void smbios_cpu_test(test_data *data, uint32_t addr,
> > +                            SmbiosEntryPointType ep_type)
> >  {
> > -    uint16_t expect_speed[2];
> > -    uint16_t real;
> > +    uint8_t core_count, expected_core_count = data->smbios_core_count;
> > +    uint16_t speed, expected_speed[2];
> > +    uint16_t core_count2, expected_core_count2 =
> data->smbios_core_count2;
> >      int offset[2];
> >      int i;
> >
> >      /* Check CPU speed for backward compatibility */
> >      offset[0] = offsetof(struct smbios_type_4, max_speed);
> >      offset[1] = offsetof(struct smbios_type_4, current_speed);
> > -    expect_speed[0] = data->smbios_cpu_max_speed ? : 2000;
> > -    expect_speed[1] = data->smbios_cpu_curr_speed ? : 2000;
> > +    expected_speed[0] = data->smbios_cpu_max_speed ? : 2000;
> > +    expected_speed[1] = data->smbios_cpu_curr_speed ? : 2000;
> >
> >      for (i = 0; i < 2; i++) {
> > -        real = qtest_readw(data->qts, addr + offset[i]);
> > -        if (real != expect_speed[i]) {
> > -            fprintf(stderr, "Unexpected SMBIOS CPU speed: real %u
> expect %u\n",
> > -                    real, expect_speed[i]);
> > -            return false;
> > -        }
> > +        speed = qtest_readw(data->qts, addr + offset[i]);
> > +        g_assert_cmpuint(speed, ==, expected_speed[i]);
> >      }
> >
> > -    return true;
> > +    core_count = qtest_readb(data->qts,
> > +                    addr + offsetof(struct smbios_type_4, core_count));
> > +
> > +    if (expected_core_count) {
> > +        g_assert_cmpuint(core_count, ==, expected_core_count);
> > +    }
> > +
> > +    if (ep_type == SMBIOS_ENTRY_POINT_TYPE_64) {
> > +        core_count2 = qtest_readw(data->qts,
> > +                          addr + offsetof(struct smbios_type_4,
> core_count2));
> > +
> > +        /* Core Count has reached its limit, checking Core Count 2 */
> > +        if (expected_core_count == 0xFF && expected_core_count2) {
> > +            g_assert_cmpuint(core_count2, ==, expected_core_count2);
> > +        }
> > +    }
> >  }
> >
> >  static void test_smbios_structs(test_data *data, SmbiosEntryPointType
> ep_type)
> > @@ -686,7 +701,7 @@ static void test_smbios_structs(test_data *data,
> SmbiosEntryPointType ep_type)
> >          set_bit(type, struct_bitmap);
> >
> >          if (type == 4) {
> > -            g_assert(smbios_cpu_test(data, addr));
> > +            smbios_cpu_test(data, addr, ep_type);
> >          }
> >
> >          /* seek to end of unformatted string area of this struct
> ("\0\0") */
> > @@ -908,6 +923,21 @@ static void test_acpi_q35_tcg(void)
> >      free_test_data(&data);
> >  }
> >
> > +static void test_acpi_q35_tcg_core_count2(void)
> > +{
> > +    test_data data = {
> > +        .machine = MACHINE_Q35,
> > +        .variant = ".core-count2",
> > +        .required_struct_types = base_required_struct_types,
> > +        .required_struct_types_len =
> ARRAY_SIZE(base_required_struct_types),
> > +        .smbios_core_count = 0xFF,
> > +        .smbios_core_count2 = 275,
> > +    };
> > +
> > +    test_acpi_one("-machine smbios-entry-point-type=64 -smp 275",
> &data);
> > +    free_test_data(&data);
> > +}
> > +
> >  static void test_acpi_q35_tcg_bridge(void)
> >  {
> >      test_data data;
> > @@ -1859,6 +1889,8 @@ int main(int argc, char *argv[])
> >                  qtest_add_func("acpi/q35/tpm12-tis",
> >                                 test_acpi_q35_tcg_tpm12_tis);
> >              }
> > +            qtest_add_func("acpi/q35/core-count2",
> > +                           test_acpi_q35_tcg_core_count2);
> >              qtest_add_func("acpi/q35/bridge", test_acpi_q35_tcg_bridge);
> >              qtest_add_func("acpi/q35/multif-bridge",
> >                             test_acpi_q35_multif_bridge);
>
>
Re: [PULL 21/86] bios-tables-test: add test for number of cores > 255
Posted by Ani Sinha 3 years, 3 months ago
On Tue, Nov 1, 2022 at 7:25 PM Ani Sinha <ani@anisinha.ca> wrote:
>
>
>
> On Tue, Nov 1, 2022 at 19:22 Jonathan Cameron <Jonathan.Cameron@huawei.com> wrote:
>>
>> On Mon, 31 Oct 2022 08:51:44 -0400
>> "Michael S. Tsirkin" <mst@redhat.com> wrote:
>>
>> > From: Julia Suvorova <jusual@redhat.com>
>> >
>> > The new test is run with a large number of cpus and checks if the
>> > core_count field in smbios_cpu_test (structure type 4) is correct.
>> >
>> > Choose q35 as it allows to run with -smp > 255.
>>
>> Getting a failure on this on i386.
>>
>> qemu-system-i386: current -smp configuration requires kernel irqchip and X2APIC API support.
>>
>> Note that was on bisection of this pull request applied to current mainline
>> (also in the CI report for the HMAT set - though there is another issue there.)
>
>
> Can you point me to the CI report?

To answer my own question:
https://gitlab.com/qemu-project/qemu/-/jobs/3253817453 Also
interesting to see all kinds of cross build and test configs :-)