From: "Nicholas Piggin" <npiggin@gmail.com>
To: <corey@minyard.net>
Cc: "Corey Minyard" <minyard@acm.org>, <qemu-devel@nongnu.org>
Subject: Re: [PATCH v2 4/5] ipmi/bmc-sim: implement watchdog dont log flag
Date: Tue, 01 Apr 2025 23:28:08 +1000 [thread overview]
Message-ID: <D8VC5UV38OGF.2WYX1ZFTAS3RV@gmail.com> (raw)
In-Reply-To: <Z-vkh-c-TwvLQM0O@mail.minyard.net>
On Tue Apr 1, 2025 at 11:05 PM AEST, Corey Minyard wrote:
> On Tue, Apr 01, 2025 at 09:44:11PM +1000, Nicholas Piggin wrote:
>> If the dont-log flag is set in the 'timer use' field for the
>> 'set watchdog' command, a watchdog timeout will not get logged as
>> a timer use expiration.
>>
>> Signed-off-by: Nicholas Piggin <npiggin@gmail.com>
>> ---
>> hw/ipmi/ipmi_bmc_sim.c | 32 ++++++++++++++++++++++----------
>> 1 file changed, 22 insertions(+), 10 deletions(-)
>>
>> diff --git a/hw/ipmi/ipmi_bmc_sim.c b/hw/ipmi/ipmi_bmc_sim.c
>> index 216bf8ff7f0..3cefc69f8a8 100644
>> --- a/hw/ipmi/ipmi_bmc_sim.c
>> +++ b/hw/ipmi/ipmi_bmc_sim.c
>> @@ -514,7 +514,8 @@ static void gen_event(IPMIBmcSim *ibs, unsigned int sens_num, uint8_t deassert,
>>
>> static void sensor_set_discrete_bit(IPMIBmcSim *ibs, unsigned int sensor,
>> unsigned int bit, unsigned int val,
>> - uint8_t evd1, uint8_t evd2, uint8_t evd3)
>> + uint8_t evd1, uint8_t evd2, uint8_t evd3,
>> + bool do_log)
>> {
>> IPMISensor *sens;
>> uint16_t mask;
>> @@ -534,7 +535,7 @@ static void sensor_set_discrete_bit(IPMIBmcSim *ibs, unsigned int sensor,
>> return; /* Already asserted */
>> }
>> sens->assert_states |= mask & sens->assert_suppt;
>> - if (sens->assert_enable & mask & sens->assert_states) {
>> + if (do_log && (sens->assert_enable & mask & sens->assert_states)) {
>> /* Send an event on assert */
>> gen_event(ibs, sensor, 0, evd1, evd2, evd3);
>> }
>> @@ -544,7 +545,7 @@ static void sensor_set_discrete_bit(IPMIBmcSim *ibs, unsigned int sensor,
>> return; /* Already deasserted */
>> }
>> sens->deassert_states |= mask & sens->deassert_suppt;
>> - if (sens->deassert_enable & mask & sens->deassert_states) {
>> + if (do_log && (sens->deassert_enable & mask & sens->deassert_states)) {
>> /* Send an event on deassert */
>> gen_event(ibs, sensor, 1, evd1, evd2, evd3);
>> }
>> @@ -700,6 +701,7 @@ static void ipmi_sim_handle_timeout(IPMIBmcSim *ibs)
>> {
>> IPMIInterface *s = ibs->parent.intf;
>> IPMIInterfaceClass *k = IPMI_INTERFACE_GET_CLASS(s);
>> + bool do_log = !IPMI_BMC_WATCHDOG_GET_DONT_LOG(ibs);
>>
>> if (!ibs->watchdog_running) {
>> goto out;
>> @@ -711,14 +713,16 @@ static void ipmi_sim_handle_timeout(IPMIBmcSim *ibs)
>> ibs->msg_flags |= IPMI_BMC_MSG_FLAG_WATCHDOG_TIMEOUT_MASK;
>> k->do_hw_op(s, IPMI_SEND_NMI, 0);
>> sensor_set_discrete_bit(ibs, IPMI_WATCHDOG_SENSOR, 8, 1,
>> - 0xc8, (2 << 4) | 0xf, 0xff);
>> + 0xc8, (2 << 4) | 0xf, 0xff,
>> + do_log);
>> break;
>>
>> case IPMI_BMC_WATCHDOG_PRE_MSG_INT:
>> ibs->msg_flags |= IPMI_BMC_MSG_FLAG_WATCHDOG_TIMEOUT_MASK;
>> k->set_atn(s, 1, attn_irq_enabled(ibs));
>> sensor_set_discrete_bit(ibs, IPMI_WATCHDOG_SENSOR, 8, 1,
>> - 0xc8, (3 << 4) | 0xf, 0xff);
>> + 0xc8, (3 << 4) | 0xf, 0xff,
>> + do_log);
>> break;
>>
>> default:
>> @@ -734,28 +738,36 @@ static void ipmi_sim_handle_timeout(IPMIBmcSim *ibs)
>>
>> do_full_expiry:
>> ibs->watchdog_running = 0; /* Stop the watchdog on a timeout */
>> - ibs->watchdog_expired |= (1 << IPMI_BMC_WATCHDOG_GET_USE(ibs));
>> +
>> + if (do_log) {
>> + ibs->watchdog_expired |= (1 << IPMI_BMC_WATCHDOG_GET_USE(ibs));
>> + }
>> +
>
> This change needs to be removed. watchdog_expired has nothing to do
> with logs, it's a field reporting in another message.
Okay you're right, I read through the spec again and yes I was
mistaken on this field.
Thanks,
Nick
next prev parent reply other threads:[~2025-04-01 13:28 UTC|newest]
Thread overview: 14+ messages / expand[flat|nested] mbox.gz Atom feed top
2025-04-01 11:44 [PATCH v2 0/5] ipmi: bmc-sim improvements Nicholas Piggin
2025-04-01 11:44 ` [PATCH v2 1/5] ipmi/pci-ipmi-bt: Rename copy-paste variables Nicholas Piggin
2025-04-01 11:49 ` Philippe Mathieu-Daudé
2025-04-01 11:44 ` [PATCH v2 2/5] ipmi: add fwinfo to pci ipmi devices Nicholas Piggin
2025-04-01 11:57 ` Philippe Mathieu-Daudé
2025-04-01 13:27 ` Nicholas Piggin
2025-04-01 14:55 ` Philippe Mathieu-Daudé
2025-04-01 13:09 ` Corey Minyard
2025-04-01 13:29 ` Nicholas Piggin
2025-04-01 11:44 ` [PATCH v2 3/5] ipmi/bmc-sim: Add 'Get Channel Info' command Nicholas Piggin
2025-04-01 11:44 ` [PATCH v2 4/5] ipmi/bmc-sim: implement watchdog dont log flag Nicholas Piggin
2025-04-01 13:05 ` Corey Minyard
2025-04-01 13:28 ` Nicholas Piggin [this message]
2025-04-01 11:44 ` [PATCH v2 5/5] ipmi/bmc-sim: add error handling for 'Set BMC Global Enables' command Nicholas Piggin
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=D8VC5UV38OGF.2WYX1ZFTAS3RV@gmail.com \
--to=npiggin@gmail.com \
--cc=corey@minyard.net \
--cc=minyard@acm.org \
--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 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).