qemu-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [PATCH v1 5/8] ssi: cache SSIPeripheralClass to avoid GET_CLASS()


From: Philippe Mathieu-Daudé
Subject: Re: [PATCH v1 5/8] ssi: cache SSIPeripheralClass to avoid GET_CLASS()
Date: Fri, 12 Aug 2022 01:42:36 +0200
User-agent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10.15; rv:91.0) Gecko/20100101 Thunderbird/91.12.0

On 11/8/22 17:14, Alex Bennée wrote:
Investigating why some BMC models are so slow compared to a plain ARM
virt machines I did some profiling of:

   ./qemu-system-arm -M romulus-bmc -nic user \
     -drive
     file=obmc-phosphor-image-romulus.static.mtd,format=raw,if=mtd \
     -nographic -serial mon:stdio

And saw that object_class_dynamic_cast_assert was dominating the
profile times. We have a number of cases in this model of the SSI bus.
As the class is static once the object is created we just cache it and
use it instead of the dynamic case macros.

Profiling against:

   ./tests/venv/bin/avocado run \
     tests/avocado/machine_aspeed.py:test_arm_ast2500_romulus_openbmc_v2_9_0

Before: 35.565 s ±  0.087 s
After: 15.713 s ±  0.287 s

Wow!

Signed-off-by: Alex Bennée <alex.bennee@linaro.org>
Cc: Cédric Le Goater <clg@kaod.org>

---
v2
  - split patches
---
  include/hw/ssi/ssi.h |  3 +++
  hw/ssi/ssi.c         | 18 ++++++++----------
  2 files changed, 11 insertions(+), 10 deletions(-)

@@ -48,11 +47,11 @@ static void ssi_cs_default(void *opaque, int n, int level)
static uint32_t ssi_transfer_raw_default(SSIPeripheral *dev, uint32_t val)
  {
-    SSIPeripheralClass *ssc = SSI_PERIPHERAL_GET_CLASS(dev);
+    SSIPeripheralClass *ssc = dev->spc;
if ((dev->cs && ssc->cs_polarity == SSI_CS_HIGH) ||
-            (!dev->cs && ssc->cs_polarity == SSI_CS_LOW) ||
-            ssc->cs_polarity == SSI_CS_NONE) {
+        (!dev->cs && ssc->cs_polarity == SSI_CS_LOW) ||
+        ssc->cs_polarity == SSI_CS_NONE) {

Spurious de-indent?

Otherwise:
Reviewed-by: Philippe Mathieu-Daudé <f4bug@amsat.org>

          return ssc->transfer(dev, val);
      }



reply via email to

[Prev in Thread] Current Thread [Next in Thread]