All of lore.kernel.org
 help / color / mirror / Atom feed
From: Jonathan Cameron via qemu development <qemu-devel@nongnu.org>
To: Mauro Carvalho Chehab <mchehab+huawei@kernel.org>
Cc: "Michael S. Tsirkin" <mst@redhat.com>, <qemu-devel@nongnu.org>,
	"Cleber Rosa" <crosa@redhat.com>, John Snow <jsnow@redhat.com>
Subject: Re: [PATCH v2 06/13] scripts/qmp_helper: add support for a timeout logic
Date: Fri, 23 Jan 2026 16:17:20 +0000	[thread overview]
Message-ID: <20260123161720.000063ea@huawei.com> (raw)
In-Reply-To: <3633cf168519ef0ad02c7e493865b0a20257b695.1769175069.git.mchehab+huawei@kernel.org>

On Fri, 23 Jan 2026 14:35:20 +0100
Mauro Carvalho Chehab <mchehab+huawei@kernel.org> wrote:

> We can't inject a new GHES record to the same source before
> it has been acked. There is an async mechanism to verify when
> the Kernel is ready, which is implemented at QEMU's ghes
> driver.
> 
> If error inject is too fast, QEMU may return an error. When
> such errors occur, implement a retry mechanism, based on a
> maximum timeout.
> 
> Signed-off-by: Mauro Carvalho Chehab <mchehab+huawei@kernel.org>
One comment where I think you intended to make a comment clearer.

Not important though
Reviewed-by: Jonathan Cameron <jonathan.cameron@huawei.com>

> ---
>  scripts/qmp_helper.py | 47 +++++++++++++++++++++++++++++++------------
>  1 file changed, 34 insertions(+), 13 deletions(-)
> 
> diff --git a/scripts/qmp_helper.py b/scripts/qmp_helper.py
> index 1587492807fe..d5ffd51f161e 100755
> --- a/scripts/qmp_helper.py
> +++ b/scripts/qmp_helper.py
> @@ -14,6 +14,7 @@
>  
>  from datetime import datetime
>  from os import path as os_path
> +from time import sleep
>  
>  try:
>      qemu_dir = os_path.abspath(os_path.dirname(os_path.dirname(__file__)))
> @@ -324,7 +325,8 @@ class qmp:
>      Opens a connection and send/receive QMP commands.
>      """
>  
> -    def send_cmd(self, command, args=None, may_open=False, return_error=True):
> +    def send_cmd(self, command, args=None, may_open=False, return_error=True,
> +                 timeout=None):
>          """Send a command to QMP, optinally opening a connection"""
>  
>          if may_open:
> @@ -336,12 +338,31 @@ def send_cmd(self, command, args=None, may_open=False, return_error=True):
>          if args:
>              msg['arguments'] = args
>  
> -        try:
> -            obj = self.qmp_monitor.cmd_obj(msg)
> -        # Can we use some other exception class here?
> -        except Exception as e:                         # pylint: disable=W0718
> -            print(f"Command: {command}")
> -            print(f"Failed to inject error: {e}.")
> +        if timeout and timeout > 0:
> +            attempts = int(timeout * 10)
> +        else:
> +            attempts = 1
> +
> +        # Try up to attempts
From v1 thread:
https://lore.kernel.org/qemu-devel/20260122171357.00000747@huawei.com/T/#m5e70aed9fca30a24106ca39196bcf935da745722

I thought plan was to update this message?

> +        for i in range(0, attempts):
> +            try:
> +                obj = self.qmp_monitor.cmd_obj(msg)




  reply	other threads:[~2026-01-23 16:17 UTC|newest]

Thread overview: 25+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-01-23 13:35 [PATCH v2 00/13] Add more commands to scripts/ghes_inject.py Mauro Carvalho Chehab
2026-01-23 13:35 ` [PATCH v2 01/13] scripts/qmp_helper: add a return code to send_cper Mauro Carvalho Chehab
2026-01-23 13:35 ` [PATCH v2 02/13] scripts/qmp_helper: add missing CXL UEFI GUID Mauro Carvalho Chehab
2026-01-23 14:12   ` Jonathan Cameron via qemu development
2026-01-23 13:35 ` [PATCH v2 03/13] scripts/qmp_helper: add support for FRU Memory Poison Mauro Carvalho Chehab
2026-01-23 13:35 ` [PATCH v2 04/13] scripts/qmp_helper: make send_cper() more generic Mauro Carvalho Chehab
2026-01-23 13:35 ` [PATCH v2 05/13] scripts/qmp_helper: fix raw_data logic Mauro Carvalho Chehab
2026-01-23 13:35 ` [PATCH v2 06/13] scripts/qmp_helper: add support for a timeout logic Mauro Carvalho Chehab
2026-01-23 16:17   ` Jonathan Cameron via qemu development [this message]
2026-01-23 13:35 ` [PATCH v2 07/13] scripts/ghes_inject: add a logic to decode CPER Mauro Carvalho Chehab
2026-01-23 16:31   ` Jonathan Cameron via qemu development
2026-01-23 13:35 ` [PATCH v2 08/13] scripts/ghes_inject: exit 1 if command was not sent Mauro Carvalho Chehab
2026-01-23 13:35 ` [PATCH v2 09/13] scripts/ghes_inject: add a handler for PCI/PCI-X bus error Mauro Carvalho Chehab
2026-02-20 18:01   ` Michael S. Tsirkin
2026-01-23 13:35 ` [PATCH v2 10/13] scripts/ghes_inject: add support for fuzzy logic testing Mauro Carvalho Chehab
2026-01-23 16:32   ` Jonathan Cameron via qemu development
2026-02-20 18:01   ` Michael S. Tsirkin
2026-01-23 13:35 ` [PATCH v2 11/13] scripts/ghes_inject: add a raw error inject command Mauro Carvalho Chehab
2026-02-20 18:02   ` Michael S. Tsirkin
2026-01-23 13:35 ` [PATCH v2 12/13] scripts/ghes_inject: print help if no command specified Mauro Carvalho Chehab
2026-01-23 16:33   ` Jonathan Cameron via qemu development
2026-01-23 13:35 ` [PATCH v2 13/13] scripts/ghes_inject: improve help message Mauro Carvalho Chehab
2026-02-20 18:03 ` [PATCH v2 00/13] Add more commands to scripts/ghes_inject.py Michael S. Tsirkin
2026-02-23 11:39   ` Mauro Carvalho Chehab
2026-02-23 15:06     ` Michael S. Tsirkin

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20260123161720.000063ea@huawei.com \
    --to=qemu-devel@nongnu.org \
    --cc=crosa@redhat.com \
    --cc=jonathan.cameron@huawei.com \
    --cc=jsnow@redhat.com \
    --cc=mchehab+huawei@kernel.org \
    --cc=mst@redhat.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.