qemu-devel.nongnu.org archive mirror
 help / color / mirror / Atom feed
* [PULL 0/3] ppc-for-5.2 patch queue 2020-11-05
@ 2020-11-05  3:49 David Gibson
  2020-11-05  3:49 ` [PULL 1/3] target/ppc/excp_helper: Add a fallthrough for fix compiler warning David Gibson
                   ` (3 more replies)
  0 siblings, 4 replies; 5+ messages in thread
From: David Gibson @ 2020-11-05  3:49 UTC (permalink / raw)
  To: peter.maydell; +Cc: David Gibson, qemu-ppc, qemu-devel, groug

The following changes since commit 3c8c36c9087da957f580a9bb5ebf7814a753d1c6:

  Merge remote-tracking branch 'remotes/kraxel/tags/ui-20201104-pull-request' into staging (2020-11-04 16:52:17 +0000)

are available in the Git repository at:

  https://gitlab.com/dgibson/qemu.git tags/ppc-for-5.2-20201105

for you to fetch changes up to f29b959dc6871c9d8df781d1bedcfaebc76d5565:

  spapr: Convert hpt_prepare_thread() to use qemu_try_memalign() (2020-11-05 12:18:48 +1100)

----------------------------------------------------------------
ppc patch queue for 2020-11-05

A small PR this time, one bugfix, one removal of minor dead code, one
warning suppression.

----------------------------------------------------------------
Chen Qun (1):
      target/ppc/excp_helper: Add a fallthrough for fix compiler warning

Greg Kurz (2):
      spapr: Drop dead code in spapr_reallocate_hpt()
      spapr: Convert hpt_prepare_thread() to use qemu_try_memalign()

 hw/ppc/spapr.c           | 6 ------
 hw/ppc/spapr_hcall.c     | 2 +-
 target/ppc/excp_helper.c | 1 +
 3 files changed, 2 insertions(+), 7 deletions(-)


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

* [PULL 1/3] target/ppc/excp_helper: Add a fallthrough for fix compiler warning
  2020-11-05  3:49 [PULL 0/3] ppc-for-5.2 patch queue 2020-11-05 David Gibson
@ 2020-11-05  3:49 ` David Gibson
  2020-11-05  3:49 ` [PULL 2/3] spapr: Drop dead code in spapr_reallocate_hpt() David Gibson
                   ` (2 subsequent siblings)
  3 siblings, 0 replies; 5+ messages in thread
From: David Gibson @ 2020-11-05  3:49 UTC (permalink / raw)
  To: peter.maydell
  Cc: qemu-devel, groug, qemu-ppc, Euler Robot, Chen Qun, David Gibson

From: Chen Qun <kuhn.chenqun@huawei.com>

When using -Wimplicit-fallthrough in our CFLAGS, the compiler showed warning:
../target/ppc/excp_helper.c: In function ‘powerpc_excp’:
../target/ppc/excp_helper.c:529:13: warning: this statement may fall through [-Wimplicit-fallthrough=]
  529 |         msr |= env->error_code;
      |         ~~~~^~~~~~~~~~~~~~~~~~
../target/ppc/excp_helper.c:530:5: note: here
  530 |     case POWERPC_EXCP_HDECR:     /* Hypervisor decrementer exception         */
      |     ^~~~

Add the corresponding "fall through" comment to fix it.

Reported-by: Euler Robot <euler.robot@huawei.com>
Signed-off-by: Chen Qun <kuhn.chenqun@huawei.com>
Message-Id: <20201028055107.2170401-1-kuhn.chenqun@huawei.com>
Signed-off-by: David Gibson <david@gibson.dropbear.id.au>
---
 target/ppc/excp_helper.c | 1 +
 1 file changed, 1 insertion(+)

diff --git a/target/ppc/excp_helper.c b/target/ppc/excp_helper.c
index d7411bcc81..ad0612555d 100644
--- a/target/ppc/excp_helper.c
+++ b/target/ppc/excp_helper.c
@@ -527,6 +527,7 @@ static inline void powerpc_excp(PowerPCCPU *cpu, int excp_model, int excp)
         break;
     case POWERPC_EXCP_HISI:      /* Hypervisor instruction storage exception */
         msr |= env->error_code;
+        /* fall through */
     case POWERPC_EXCP_HDECR:     /* Hypervisor decrementer exception         */
     case POWERPC_EXCP_HDSI:      /* Hypervisor data storage exception        */
     case POWERPC_EXCP_HDSEG:     /* Hypervisor data segment exception        */
-- 
2.28.0



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

* [PULL 2/3] spapr: Drop dead code in spapr_reallocate_hpt()
  2020-11-05  3:49 [PULL 0/3] ppc-for-5.2 patch queue 2020-11-05 David Gibson
  2020-11-05  3:49 ` [PULL 1/3] target/ppc/excp_helper: Add a fallthrough for fix compiler warning David Gibson
@ 2020-11-05  3:49 ` David Gibson
  2020-11-05  3:49 ` [PULL 3/3] spapr: Convert hpt_prepare_thread() to use qemu_try_memalign() David Gibson
  2020-11-05 23:46 ` [PULL 0/3] ppc-for-5.2 patch queue 2020-11-05 Peter Maydell
  3 siblings, 0 replies; 5+ messages in thread
From: David Gibson @ 2020-11-05  3:49 UTC (permalink / raw)
  To: peter.maydell; +Cc: David Gibson, qemu-ppc, qemu-devel, groug

From: Greg Kurz <groug@kaod.org>

Sometimes QEMU needs to allocate the HPT in userspace, namely with TCG
or PR KVM. This is performed with qemu_memalign() because of alignment
requirements. Like glib's allocators, its behaviour is to abort on OOM
instead of returning NULL.

This could be changed to qemu_try_memalign(), but in the specific case
of spapr_reallocate_hpt(), the outcome would be to terminate QEMU anyway
since no HPT means no MMU for the guest. Drop the dead code instead.

Signed-off-by: Greg Kurz <groug@kaod.org>
Message-Id: <160398562892.32380.15006707861753544263.stgit@bahia.lan>
Signed-off-by: David Gibson <david@gibson.dropbear.id.au>
---
 hw/ppc/spapr.c | 6 ------
 1 file changed, 6 deletions(-)

diff --git a/hw/ppc/spapr.c b/hw/ppc/spapr.c
index 227075103e..12a012d9dd 100644
--- a/hw/ppc/spapr.c
+++ b/hw/ppc/spapr.c
@@ -1522,12 +1522,6 @@ int spapr_reallocate_hpt(SpaprMachineState *spapr, int shift, Error **errp)
         int i;
 
         spapr->htab = qemu_memalign(size, size);
-        if (!spapr->htab) {
-            error_setg_errno(errp, errno,
-                             "Could not allocate HPT of order %d", shift);
-            return -ENOMEM;
-        }
-
         memset(spapr->htab, 0, size);
         spapr->htab_shift = shift;
 
-- 
2.28.0



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

* [PULL 3/3] spapr: Convert hpt_prepare_thread() to use qemu_try_memalign()
  2020-11-05  3:49 [PULL 0/3] ppc-for-5.2 patch queue 2020-11-05 David Gibson
  2020-11-05  3:49 ` [PULL 1/3] target/ppc/excp_helper: Add a fallthrough for fix compiler warning David Gibson
  2020-11-05  3:49 ` [PULL 2/3] spapr: Drop dead code in spapr_reallocate_hpt() David Gibson
@ 2020-11-05  3:49 ` David Gibson
  2020-11-05 23:46 ` [PULL 0/3] ppc-for-5.2 patch queue 2020-11-05 Peter Maydell
  3 siblings, 0 replies; 5+ messages in thread
From: David Gibson @ 2020-11-05  3:49 UTC (permalink / raw)
  To: peter.maydell; +Cc: David Gibson, qemu-ppc, qemu-devel, groug

From: Greg Kurz <groug@kaod.org>

HPT resizing is asynchronous: the guest first kicks off the creation of a
new HPT, then it waits for that new HPT to be actually created and finally
it asks the current HPT to be replaced by the new one.

In the case of a userland allocated HPT, this currently relies on calling
qemu_memalign() which aborts on OOM and never returns NULL. Since we seem
to have path to report the failure to the guest with an H_NO_MEM return
value, use qemu_try_memalign() instead of qemu_memalign().

Signed-off-by: Greg Kurz <groug@kaod.org>
Message-Id: <160398563636.32380.1747166034877173994.stgit@bahia.lan>
Signed-off-by: David Gibson <david@gibson.dropbear.id.au>
---
 hw/ppc/spapr_hcall.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/hw/ppc/spapr_hcall.c b/hw/ppc/spapr_hcall.c
index 607740150f..1d8e8e6a88 100644
--- a/hw/ppc/spapr_hcall.c
+++ b/hw/ppc/spapr_hcall.c
@@ -360,7 +360,7 @@ static void *hpt_prepare_thread(void *opaque)
     SpaprPendingHpt *pending = opaque;
     size_t size = 1ULL << pending->shift;
 
-    pending->hpt = qemu_memalign(size, size);
+    pending->hpt = qemu_try_memalign(size, size);
     if (pending->hpt) {
         memset(pending->hpt, 0, size);
         pending->ret = H_SUCCESS;
-- 
2.28.0



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

* Re: [PULL 0/3] ppc-for-5.2 patch queue 2020-11-05
  2020-11-05  3:49 [PULL 0/3] ppc-for-5.2 patch queue 2020-11-05 David Gibson
                   ` (2 preceding siblings ...)
  2020-11-05  3:49 ` [PULL 3/3] spapr: Convert hpt_prepare_thread() to use qemu_try_memalign() David Gibson
@ 2020-11-05 23:46 ` Peter Maydell
  3 siblings, 0 replies; 5+ messages in thread
From: Peter Maydell @ 2020-11-05 23:46 UTC (permalink / raw)
  To: David Gibson; +Cc: qemu-ppc, QEMU Developers, Greg Kurz

On Thu, 5 Nov 2020 at 03:49, David Gibson <david@gibson.dropbear.id.au> wrote:
>
> The following changes since commit 3c8c36c9087da957f580a9bb5ebf7814a753d1c6:
>
>   Merge remote-tracking branch 'remotes/kraxel/tags/ui-20201104-pull-request' into staging (2020-11-04 16:52:17 +0000)
>
> are available in the Git repository at:
>
>   https://gitlab.com/dgibson/qemu.git tags/ppc-for-5.2-20201105
>
> for you to fetch changes up to f29b959dc6871c9d8df781d1bedcfaebc76d5565:
>
>   spapr: Convert hpt_prepare_thread() to use qemu_try_memalign() (2020-11-05 12:18:48 +1100)
>
> ----------------------------------------------------------------
> ppc patch queue for 2020-11-05
>
> A small PR this time, one bugfix, one removal of minor dead code, one
> warning suppression.
>
> ----------------------------------------------------------------
> Chen Qun (1):
>       target/ppc/excp_helper: Add a fallthrough for fix compiler warning
>
> Greg Kurz (2):
>       spapr: Drop dead code in spapr_reallocate_hpt()
>       spapr: Convert hpt_prepare_thread() to use qemu_try_memalign()


Applied, thanks.

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

-- PMM


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

end of thread, other threads:[~2020-11-05 23:47 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-11-05  3:49 [PULL 0/3] ppc-for-5.2 patch queue 2020-11-05 David Gibson
2020-11-05  3:49 ` [PULL 1/3] target/ppc/excp_helper: Add a fallthrough for fix compiler warning David Gibson
2020-11-05  3:49 ` [PULL 2/3] spapr: Drop dead code in spapr_reallocate_hpt() David Gibson
2020-11-05  3:49 ` [PULL 3/3] spapr: Convert hpt_prepare_thread() to use qemu_try_memalign() David Gibson
2020-11-05 23:46 ` [PULL 0/3] ppc-for-5.2 patch queue 2020-11-05 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).