All of lore.kernel.org
 help / color / mirror / Atom feed
From: Corey Minyard <minyard@acm.org>
To: Jinhua Cao <caojinhua1@huawei.com>
Cc: qemu-devel@nongnu.org, eric.fangyi@huawei.com
Subject: Re: [PATCH] ipmi/sim: fix watchdog_expired data type error in IPMIBmcSim struct
Date: Fri, 25 Jun 2021 08:56:35 -0500	[thread overview]
Message-ID: <20210625135635.GL2921206@minyard.net> (raw)
In-Reply-To: <20210625021232.73614-1-caojinhua1@huawei.com>

On Fri, Jun 25, 2021 at 10:12:32AM +0800, Jinhua Cao wrote:
> 1) watchdog_expired is set bool which value could only be 0 or 1,
> but watchdog_expired every bit mean different Timer Use.
> 
> 2) Use the command  -ipmitool mc get watchdog-  to query
> ipmi-watchdog status in guest.
> ...
> [root@localhost ~]# ipmitool mc watchdog get
> Watchdog Timer Use:     SMS/OS (0x44)
> Watchdog Timer Is:      Started/Running
> Watchdog Timer Actions: Hard Reset (0x01)
> Pre-timeout interval:   0 seconds
> Timer Expiration Flags: 0x00
> Initial Countdown:      60 sec
> Present Countdown:      57 sec
> ...
> bool for watchdog_expired results -Timer Expiration Flags- always
> be 0x00 or 0x01, but the -Timer Expiration Flags- indicts the Timer Use
> after timeout. So change watchdog_expired data type from bool to uint8_t
> to fix this problem.

Yes, you are right.  This is queued.

I checked, a bool is sent as a byte, just like a uint8_t, so the vmstate
transfer should be ok with this change.

Thanks,

-corey

> 
> Signed-off-by: Jinhua Cao <caojinhua1@huawei.com>
> ---
>  hw/ipmi/ipmi_bmc_sim.c | 4 ++--
>  1 file changed, 2 insertions(+), 2 deletions(-)
> 
> diff --git a/hw/ipmi/ipmi_bmc_sim.c b/hw/ipmi/ipmi_bmc_sim.c
> index 55fb81fa5a..905e091094 100644
> --- a/hw/ipmi/ipmi_bmc_sim.c
> +++ b/hw/ipmi/ipmi_bmc_sim.c
> @@ -189,7 +189,7 @@ struct IPMIBmcSim {
>      uint8_t  watchdog_use;
>      uint8_t  watchdog_action;
>      uint8_t  watchdog_pretimeout; /* In seconds */
> -    bool     watchdog_expired;
> +    uint8_t  watchdog_expired;
>      uint16_t watchdog_timeout; /* in 100's of milliseconds */
>  
>      bool     watchdog_running;
> @@ -2110,7 +2110,7 @@ static const VMStateDescription vmstate_ipmi_sim = {
>          VMSTATE_UINT8(watchdog_use, IPMIBmcSim),
>          VMSTATE_UINT8(watchdog_action, IPMIBmcSim),
>          VMSTATE_UINT8(watchdog_pretimeout, IPMIBmcSim),
> -        VMSTATE_BOOL(watchdog_expired, IPMIBmcSim),
> +        VMSTATE_UINT8(watchdog_expired, IPMIBmcSim),
>          VMSTATE_UINT16(watchdog_timeout, IPMIBmcSim),
>          VMSTATE_BOOL(watchdog_running, IPMIBmcSim),
>          VMSTATE_BOOL(watchdog_preaction_ran, IPMIBmcSim),
> -- 
> 2.27.0
> 


      reply	other threads:[~2021-06-25 13:57 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-06-25  2:12 [PATCH] ipmi/sim: fix watchdog_expired data type error in IPMIBmcSim struct Jinhua Cao
2021-06-25 13:56 ` Corey Minyard [this message]

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=20210625135635.GL2921206@minyard.net \
    --to=minyard@acm.org \
    --cc=caojinhua1@huawei.com \
    --cc=eric.fangyi@huawei.com \
    --cc=qemu-devel@nongnu.org \
    /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.