qemu-devel.nongnu.org archive mirror
 help / color / mirror / Atom feed
* [PULL 0/5] ppc-for-6.0 queue 20210331
@ 2021-03-31  6:25 David Gibson
  2021-03-31  6:25 ` [PULL 1/5] hw/ppc: e500: Add missing #address-cells and #size-cells in the eTSEC node David Gibson
                   ` (5 more replies)
  0 siblings, 6 replies; 7+ messages in thread
From: David Gibson @ 2021-03-31  6:25 UTC (permalink / raw)
  To: peter.maydell, groug; +Cc: qemu-ppc, qemu-devel, David Gibson

The following changes since commit 6d40ce00c1166c317e298ad82ecf10e650c4f87d:

  Update version for v6.0.0-rc1 release (2021-03-30 18:19:07 +0100)

are available in the Git repository at:

  https://gitlab.com/dgibson/qemu.git tags/ppc-for-6.0-20210331

for you to fetch changes up to 611ac0a60fdcc7422bf42ef9b467abf4fdbea1a2:

  hw/net: fsl_etsec: Tx padding length should exclude CRC (2021-03-31 11:10:50 +1100)

----------------------------------------------------------------
ppc patch queue for 2021-03-31

Here's another set of patches for the ppc target and associated
machine types.  I'd hoped to send this closer to the hard freeze, but
got caught up for some time chasing what looked like a strange
regression, before finally concluding it was due to unrelated failures
on the CI.

This is just a handful of fairly straightforward fixes, plus one
performance improvement that's simple and beneficial enough that I'm
considering it a "performance bug fix".

----------------------------------------------------------------
Alexey Kardashevskiy (1):
      spapr: Fix typo in the patb_entry comment

Bin Meng (2):
      hw/ppc: e500: Add missing #address-cells and #size-cells in the eTSEC node
      hw/net: fsl_etsec: Tx padding length should exclude CRC

Greg Kurz (2):
      target/ppc/kvm: Cache timebase frequency
      spapr: Assert DIMM unplug state in spapr_memory_unplug()

 hw/net/fsl_etsec/rings.c |  2 +-
 hw/ppc/e500.c            |  2 ++
 hw/ppc/spapr.c           |  3 +++
 include/hw/ppc/spapr.h   |  2 +-
 target/ppc/kvm.c         | 25 +++++++++++++++++++------
 5 files changed, 26 insertions(+), 8 deletions(-)


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

* [PULL 1/5] hw/ppc: e500: Add missing #address-cells and #size-cells in the eTSEC node
  2021-03-31  6:25 [PULL 0/5] ppc-for-6.0 queue 20210331 David Gibson
@ 2021-03-31  6:25 ` David Gibson
  2021-03-31  6:25 ` [PULL 2/5] target/ppc/kvm: Cache timebase frequency David Gibson
                   ` (4 subsequent siblings)
  5 siblings, 0 replies; 7+ messages in thread
From: David Gibson @ 2021-03-31  6:25 UTC (permalink / raw)
  To: peter.maydell, groug; +Cc: Bin Meng, qemu-ppc, qemu-devel, David Gibson

From: Bin Meng <bin.meng@windriver.com>

Per devicetree spec v0.3 [1] chapter 2.3.5:

The #address-cells and #size-cells properties are not inherited
from ancestors in the devicetree. They shall be explicitly defined.
If missing, a client program should assume a default value of 2
for #address-cells, and a value of 1 for #size-cells.

These properties are currently missing, causing the <reg> property
of the queue-group subnode to be incorrectly parsed using default
values.

[1] https://github.com/devicetree-org/devicetree-specification/releases/download/v0.3/devicetree-specification-v0.3.pdf

Fixes: fdfb7f2cdb2d ("e500: Add support for eTSEC in device tree")
Signed-off-by: Bin Meng <bin.meng@windriver.com>
Message-Id: <20210311081608.66891-1-bmeng.cn@gmail.com>
Signed-off-by: David Gibson <david@gibson.dropbear.id.au>
---
 hw/ppc/e500.c | 2 ++
 1 file changed, 2 insertions(+)

diff --git a/hw/ppc/e500.c b/hw/ppc/e500.c
index 1d94485ac8..79467ac512 100644
--- a/hw/ppc/e500.c
+++ b/hw/ppc/e500.c
@@ -237,6 +237,8 @@ static int create_devtree_etsec(SysBusDevice *sbdev, PlatformDevtreeData *data)
     qemu_fdt_setprop_string(fdt, node, "model", "eTSEC");
     qemu_fdt_setprop(fdt, node, "local-mac-address", etsec->conf.macaddr.a, 6);
     qemu_fdt_setprop_cells(fdt, node, "fixed-link", 0, 1, 1000, 0, 0);
+    qemu_fdt_setprop_cells(fdt, node, "#size-cells", 1);
+    qemu_fdt_setprop_cells(fdt, node, "#address-cells", 1);
 
     qemu_fdt_add_subnode(fdt, group);
     qemu_fdt_setprop_cells(fdt, group, "reg", mmio0, 0x1000);
-- 
2.30.2



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

* [PULL 2/5] target/ppc/kvm: Cache timebase frequency
  2021-03-31  6:25 [PULL 0/5] ppc-for-6.0 queue 20210331 David Gibson
  2021-03-31  6:25 ` [PULL 1/5] hw/ppc: e500: Add missing #address-cells and #size-cells in the eTSEC node David Gibson
@ 2021-03-31  6:25 ` David Gibson
  2021-03-31  6:25 ` [PULL 3/5] spapr: Assert DIMM unplug state in spapr_memory_unplug() David Gibson
                   ` (3 subsequent siblings)
  5 siblings, 0 replies; 7+ messages in thread
From: David Gibson @ 2021-03-31  6:25 UTC (permalink / raw)
  To: peter.maydell, groug; +Cc: qemu-ppc, qemu-devel, David Gibson

From: Greg Kurz <groug@kaod.org>

Each vCPU core exposes its timebase frequency in the DT. When running
under KVM, this means parsing /proc/cpuinfo in order to get the timebase
frequency of the host CPU.

The parsing appears to slow down the boot quite a bit with higher number
of cores:

# of cores     seconds spent in spapr_dt_cpus()
      8                  0.550122
     16                  1.342375
     32                  2.850316
     64                  5.922505
     96                  9.109224
    128                 12.245504
    256                 24.957236
    384                 37.389113

The timebase frequency of the host CPU is identical for all
cores and it is an invariant for the VM lifetime. Cache it
instead of doing the same expensive parsing again and again.

Rename kvmppc_get_tbfreq() to kvmppc_get_tbfreq_procfs() and
rename the 'retval' variable to make it clear it is used as
fallback only. Come up with a new version of kvmppc_get_tbfreq()
that calls kvmppc_get_tbfreq_procfs() only once and keep the
value in a static.

Zero is certainly not a valid value for the timebase frequency.
Treat atoi() returning zero as another parsing error and return
the fallback value instead. This allows kvmppc_get_tbfreq() to
use zero as an indicator that kvmppc_get_tbfreq_procfs() hasn't
been called yet.

With this patch applied:

    384                 0.518382

Signed-off-by: Greg Kurz <groug@kaod.org>
Message-Id: <161600382766.1780699.6787739229984093959.stgit@bahia.lan>
Signed-off-by: David Gibson <david@gibson.dropbear.id.au>
---
 target/ppc/kvm.c | 25 +++++++++++++++++++------
 1 file changed, 19 insertions(+), 6 deletions(-)

diff --git a/target/ppc/kvm.c b/target/ppc/kvm.c
index 298c1f882c..104a308abb 100644
--- a/target/ppc/kvm.c
+++ b/target/ppc/kvm.c
@@ -1815,24 +1815,37 @@ static int read_cpuinfo(const char *field, char *value, int len)
     return ret;
 }
 
-uint32_t kvmppc_get_tbfreq(void)
+static uint32_t kvmppc_get_tbfreq_procfs(void)
 {
     char line[512];
     char *ns;
-    uint32_t retval = NANOSECONDS_PER_SECOND;
+    uint32_t tbfreq_fallback = NANOSECONDS_PER_SECOND;
+    uint32_t tbfreq_procfs;
 
     if (read_cpuinfo("timebase", line, sizeof(line))) {
-        return retval;
+        return tbfreq_fallback;
     }
 
     ns = strchr(line, ':');
     if (!ns) {
-        return retval;
+        return tbfreq_fallback;
     }
 
-    ns++;
+    tbfreq_procfs = atoi(++ns);
+
+    /* 0 is certainly not acceptable by the guest, return fallback value */
+    return tbfreq_procfs ? tbfreq_procfs : tbfreq_fallback;
+}
+
+uint32_t kvmppc_get_tbfreq(void)
+{
+    static uint32_t cached_tbfreq;
+
+    if (!cached_tbfreq) {
+        cached_tbfreq = kvmppc_get_tbfreq_procfs();
+    }
 
-    return atoi(ns);
+    return cached_tbfreq;
 }
 
 bool kvmppc_get_host_serial(char **value)
-- 
2.30.2



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

* [PULL 3/5] spapr: Assert DIMM unplug state in spapr_memory_unplug()
  2021-03-31  6:25 [PULL 0/5] ppc-for-6.0 queue 20210331 David Gibson
  2021-03-31  6:25 ` [PULL 1/5] hw/ppc: e500: Add missing #address-cells and #size-cells in the eTSEC node David Gibson
  2021-03-31  6:25 ` [PULL 2/5] target/ppc/kvm: Cache timebase frequency David Gibson
@ 2021-03-31  6:25 ` David Gibson
  2021-03-31  6:25 ` [PULL 4/5] spapr: Fix typo in the patb_entry comment David Gibson
                   ` (2 subsequent siblings)
  5 siblings, 0 replies; 7+ messages in thread
From: David Gibson @ 2021-03-31  6:25 UTC (permalink / raw)
  To: peter.maydell, groug
  Cc: Daniel Henrique Barboza, qemu-ppc, qemu-devel, David Gibson

From: Greg Kurz <groug@kaod.org>

spapr_memory_unplug() is the last step of the hot unplug sequence.
It is indirectly called by:

 spapr_lmb_release()
  hotplug_handler_unplug()

and spapr_lmb_release() already buys us that DIMM unplug state is
present : it gets restored with spapr_recover_pending_dimm_state()
if missing.

g_assert() that spapr_pending_dimm_unplugs_find() cannot return NULL
in spapr_memory_unplug() to make this clear and silence Coverity.

Fixes: Coverity CID 1450767
Signed-off-by: Greg Kurz <groug@kaod.org>
Message-Id: <161562021166.948373.15092876234470478331.stgit@bahia.lan>
Reviewed-by: Daniel Henrique Barboza <danielhb413@gmail.com>
Signed-off-by: David Gibson <david@gibson.dropbear.id.au>
---
 hw/ppc/spapr.c | 3 +++
 1 file changed, 3 insertions(+)

diff --git a/hw/ppc/spapr.c b/hw/ppc/spapr.c
index d56418ca29..73a06df3b1 100644
--- a/hw/ppc/spapr.c
+++ b/hw/ppc/spapr.c
@@ -3660,6 +3660,9 @@ static void spapr_memory_unplug(HotplugHandler *hotplug_dev, DeviceState *dev)
     SpaprMachineState *spapr = SPAPR_MACHINE(hotplug_dev);
     SpaprDimmState *ds = spapr_pending_dimm_unplugs_find(spapr, PC_DIMM(dev));
 
+    /* We really shouldn't get this far without anything to unplug */
+    g_assert(ds);
+
     pc_dimm_unplug(PC_DIMM(dev), MACHINE(hotplug_dev));
     qdev_unrealize(dev);
     spapr_pending_dimm_unplugs_remove(spapr, ds);
-- 
2.30.2



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

* [PULL 4/5] spapr: Fix typo in the patb_entry comment
  2021-03-31  6:25 [PULL 0/5] ppc-for-6.0 queue 20210331 David Gibson
                   ` (2 preceding siblings ...)
  2021-03-31  6:25 ` [PULL 3/5] spapr: Assert DIMM unplug state in spapr_memory_unplug() David Gibson
@ 2021-03-31  6:25 ` David Gibson
  2021-03-31  6:25 ` [PULL 5/5] hw/net: fsl_etsec: Tx padding length should exclude CRC David Gibson
  2021-03-31 15:38 ` [PULL 0/5] ppc-for-6.0 queue 20210331 Peter Maydell
  5 siblings, 0 replies; 7+ messages in thread
From: David Gibson @ 2021-03-31  6:25 UTC (permalink / raw)
  To: peter.maydell, groug
  Cc: Alexey Kardashevskiy, Daniel Henrique Barboza, qemu-ppc,
	qemu-devel, David Gibson

From: Alexey Kardashevskiy <aik@ozlabs.ru>

There is no H_REGISTER_PROCESS_TABLE, it is H_REGISTER_PROC_TBL handler
for which is still called h_register_process_table() though.

Signed-off-by: Alexey Kardashevskiy <aik@ozlabs.ru>
Message-Id: <20210225032335.64245-1-aik@ozlabs.ru>
Reviewed-by: Daniel Henrique Barboza <danielhb413@gmail.com>
Signed-off-by: David Gibson <david@gibson.dropbear.id.au>
---
 include/hw/ppc/spapr.h | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/include/hw/ppc/spapr.h b/include/hw/ppc/spapr.h
index 47cebaf3ac..bf7cab7a2c 100644
--- a/include/hw/ppc/spapr.h
+++ b/include/hw/ppc/spapr.h
@@ -168,7 +168,7 @@ struct SpaprMachineState {
     SpaprResizeHpt resize_hpt;
     void *htab;
     uint32_t htab_shift;
-    uint64_t patb_entry; /* Process tbl registed in H_REGISTER_PROCESS_TABLE */
+    uint64_t patb_entry; /* Process tbl registed in H_REGISTER_PROC_TBL */
     SpaprPendingHpt *pending_hpt; /* in-progress resize */
 
     hwaddr rma_size;
-- 
2.30.2



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

* [PULL 5/5] hw/net: fsl_etsec: Tx padding length should exclude CRC
  2021-03-31  6:25 [PULL 0/5] ppc-for-6.0 queue 20210331 David Gibson
                   ` (3 preceding siblings ...)
  2021-03-31  6:25 ` [PULL 4/5] spapr: Fix typo in the patb_entry comment David Gibson
@ 2021-03-31  6:25 ` David Gibson
  2021-03-31 15:38 ` [PULL 0/5] ppc-for-6.0 queue 20210331 Peter Maydell
  5 siblings, 0 replies; 7+ messages in thread
From: David Gibson @ 2021-03-31  6:25 UTC (permalink / raw)
  To: peter.maydell, groug; +Cc: Bin Meng, qemu-ppc, qemu-devel, David Gibson

From: Bin Meng <bmeng.cn@gmail.com>

As the comment of tx_padding_and_crc() says: "Never add CRC in QEMU",
min_frame_len should excluce CRC, so it should be 60 instead of 64.

Signed-off-by: Bin Meng <bmeng.cn@gmail.com>
Message-Id: <20210316081505.72898-1-bmeng.cn@gmail.com>
Signed-off-by: David Gibson <david@gibson.dropbear.id.au>
---
 hw/net/fsl_etsec/rings.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/hw/net/fsl_etsec/rings.c b/hw/net/fsl_etsec/rings.c
index d6be0d7d18..8f08446415 100644
--- a/hw/net/fsl_etsec/rings.c
+++ b/hw/net/fsl_etsec/rings.c
@@ -259,7 +259,7 @@ static void process_tx_bd(eTSEC         *etsec,
                 || etsec->regs[MACCFG2].value & MACCFG2_PADCRC) {
 
                 /* Padding and CRC (Padding implies CRC) */
-                tx_padding_and_crc(etsec, 64);
+                tx_padding_and_crc(etsec, 60);
 
             } else if (etsec->first_bd.flags & BD_TX_TC
                        || etsec->regs[MACCFG2].value & MACCFG2_CRC_EN) {
-- 
2.30.2



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

* Re: [PULL 0/5] ppc-for-6.0 queue 20210331
  2021-03-31  6:25 [PULL 0/5] ppc-for-6.0 queue 20210331 David Gibson
                   ` (4 preceding siblings ...)
  2021-03-31  6:25 ` [PULL 5/5] hw/net: fsl_etsec: Tx padding length should exclude CRC David Gibson
@ 2021-03-31 15:38 ` Peter Maydell
  5 siblings, 0 replies; 7+ messages in thread
From: Peter Maydell @ 2021-03-31 15:38 UTC (permalink / raw)
  To: David Gibson; +Cc: qemu-ppc, Greg Kurz, QEMU Developers

On Wed, 31 Mar 2021 at 07:25, David Gibson <david@gibson.dropbear.id.au> wrote:
>
> The following changes since commit 6d40ce00c1166c317e298ad82ecf10e650c4f87d:
>
>   Update version for v6.0.0-rc1 release (2021-03-30 18:19:07 +0100)
>
> are available in the Git repository at:
>
>   https://gitlab.com/dgibson/qemu.git tags/ppc-for-6.0-20210331
>
> for you to fetch changes up to 611ac0a60fdcc7422bf42ef9b467abf4fdbea1a2:
>
>   hw/net: fsl_etsec: Tx padding length should exclude CRC (2021-03-31 11:10:50 +1100)
>
> ----------------------------------------------------------------
> ppc patch queue for 2021-03-31
>
> Here's another set of patches for the ppc target and associated
> machine types.  I'd hoped to send this closer to the hard freeze, but
> got caught up for some time chasing what looked like a strange
> regression, before finally concluding it was due to unrelated failures
> on the CI.
>
> This is just a handful of fairly straightforward fixes, plus one
> performance improvement that's simple and beneficial enough that I'm
> considering it a "performance bug fix".


Applied, thanks.

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

-- PMM


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

end of thread, other threads:[~2021-03-31 15:42 UTC | newest]

Thread overview: 7+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-03-31  6:25 [PULL 0/5] ppc-for-6.0 queue 20210331 David Gibson
2021-03-31  6:25 ` [PULL 1/5] hw/ppc: e500: Add missing #address-cells and #size-cells in the eTSEC node David Gibson
2021-03-31  6:25 ` [PULL 2/5] target/ppc/kvm: Cache timebase frequency David Gibson
2021-03-31  6:25 ` [PULL 3/5] spapr: Assert DIMM unplug state in spapr_memory_unplug() David Gibson
2021-03-31  6:25 ` [PULL 4/5] spapr: Fix typo in the patb_entry comment David Gibson
2021-03-31  6:25 ` [PULL 5/5] hw/net: fsl_etsec: Tx padding length should exclude CRC David Gibson
2021-03-31 15:38 ` [PULL 0/5] ppc-for-6.0 queue 20210331 Peter Maydell

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).