mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Sudeep Holla <sudeep.holla@arm.com>
To: "lihuisong (C)" <lihuisong@huawei.com>
Cc: linux-acpi@vger.kernel.org, linux-kernel@vger.kernel.org,
	Jassi Brar <jassisinghbrar@gmail.com>,
	Adam Young <admiyo@os.amperecomputing.com>,
	Robbie King <robbiek@xsightlabs.com>
Subject: Re: [PATCH 02/14] mailbox: pcc: Always clear the platform ack interrupt first
Date: Wed, 5 Mar 2025 14:29:45 +0000	[thread overview]
Message-ID: <20250305142945.kzs4hfljbktkndbe@bogus> (raw)
In-Reply-To: <397910e0-38eb-553a-2bd2-c338d8c3a49c@huawei.com>

On Wed, Mar 05, 2025 at 11:45:35AM +0800, lihuisong (C) wrote:
> 
> 在 2025/3/3 18:51, Sudeep Holla 写道:
> > The PCC mailbox interrupt handler (pcc_mbox_irq()) currently checks
> > for command completion flags and any error status before clearing the
> > interrupt.
> > 
> > The below sequence highlights an issue in the handling of PCC mailbox
> > interrupts, specifically when dealing with doorbell notifications and
> > acknowledgment between the OSPM and the platform where type3 and type4
> > channels are sharing the interrupt.
> > 
> >          Platform Firmware              OSPM/Linux PCC driver
> > ------------------------------------------------------------------------
> >                                       build message in shmem
> >                                       ring type3 channel doorbell
> > receives the doorbell interrupt
> >    process the message from OSPM
> >    build response for the message
> > ring the platform ack interrupt to OSPM
> > 				--->
> > build notification in type4 channel
> >                                       start processing in pcc_mbox_irq()
> >                                        enter pcc handler for type4 chan
> >                                           command complete cleared
> > 			        	 read the notification
> >                                  <---     clear platform ack irq
> >    		* no effect from above as platform ack irq *
> > 		* not yet triggered on this channel *
> > ring the platform ack irq on type4 channel
> > 				--->
> >                                        leave pcc handler for type4 chan
> >                                        enter pcc handler for type3 chan
> >                                           command complete set
> > 					 read the response
> >                                  <---     clear platform ack irq
> >                                        leave pcc handler for type3 chan
> >                                       leave pcc_mbox_irq() handler
> >                                       start processing in pcc_mbox_irq()
> >                                        enter pcc handler for type4 chan
> >                                        leave pcc handler for type4 chan
> >                                        enter pcc handler for type3 chan
> >                                        leave pcc handler for type3 chan
> >                                       leave pcc_mbox_irq() handler
> This is not easy to understand to me.
> The issue as below described is already very clear to me.
> So suggest remove above flow graph.

I understood it with the graph similar to the one above, though I simplified
it in terms of PCC rather than specific IP reference.

> > The key issue occurs when OSPM tries to acknowledge platform ack
> > interrupt for a notification which is ready to be read and processed
> > but the interrupt itself is not yet triggered by the platform.
> >
> > This ineffective acknowledgment leads to an issue later in time where
> > the interrupt remains pending as we exit the interrupt handler without
> > clearing the platform ack interrupt as there is no pending response or
> > notification. The interrupt acknowledgment order is incorrect.
> >

> Has this issue been confired? It's more better if has the log.😁
> But it seems a valid issue.

Yes Robbie reported this. He is away and can't test or respond until next
week. The log just says there was loads of spurious interrupts and nobody
cared log as you got in the first patch of yours fixing similar race.

> >
> > To resolve this issue, the platform acknowledgment interrupt should
> > always be cleared before processing the interrupt for any notifications
> > or response.
> >
> AFAIC,always clearing the platform ack interrupt first which is also the
> communication flow as ACPI spec described.

Indeed, not sure how we missed it so far.

> I am not sure if it is ok when triggering interrupt and clearing interrupt
> occur concurrently.

Should be OK as we start clearing all the channels that share, if the
handler doesn't clear any source, the interrupt must remain asserted.

> But this scenario is always possible. I think It doesn't matter with this
> patch. It's just my confusion.

Indeed, it can happen any time as you mentioned. No worries better to ask
and clarify than assume. Thanks for your time and review.

--
Regards,
Sudeep

  reply	other threads:[~2025-03-05 14:29 UTC|newest]

Thread overview: 37+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2025-03-03 10:51 [PATCH 00/14] mailbox: pcc: Fixes and cleanup/refactoring Sudeep Holla
2025-03-03 10:51 ` [PATCH 01/14] mailbox: pcc: Fix the possible race in updation of chan_in_use flag Sudeep Holla
2025-03-03 10:51 ` [PATCH 02/14] mailbox: pcc: Always clear the platform ack interrupt first Sudeep Holla
2025-03-05  3:45   ` lihuisong (C)
2025-03-05 14:29     ` Sudeep Holla [this message]
2025-03-06  3:44       ` lihuisong (C)
2025-03-03 10:51 ` [PATCH 03/14] mailbox: pcc: Drop unnecessary endianness conversion of pcc_hdr.flags Sudeep Holla
2025-03-05  4:02   ` lihuisong (C)
2025-03-05 10:34     ` Sudeep Holla
2025-03-05 10:36     ` Sudeep Holla
2025-03-06  3:50       ` lihuisong (C)
2025-03-03 10:51 ` [PATCH 04/14] mailbox: pcc: Return early if no GAS register from pcc_mbox_cmd_complete_check Sudeep Holla
2025-03-05  5:57   ` lihuisong (C)
2025-03-03 10:51 ` [PATCH 05/14] mailbox: pcc: Use acpi_os_ioremap() instead of ioremap() Sudeep Holla
2025-03-03 10:51 ` [PATCH 06/14] mailbox: pcc: Refactor error handling in irq handler into separate function Sudeep Holla
2025-03-05  6:09   ` lihuisong (C)
2025-03-05 10:42     ` Sudeep Holla
2025-03-03 10:51 ` [PATCH 07/14] mailbox: pcc: Move pcc_mbox_ioremap() before pcc_mbox_request_channel() Sudeep Holla
2025-03-05  6:48   ` lihuisong (C)
2025-03-05 10:56     ` Sudeep Holla
2025-03-05 13:37       ` Sudeep Holla
2025-03-03 10:51 ` [PATCH 08/14] mailbox: pcc: Always map the shared memory communication address Sudeep Holla
2025-03-05  6:54   ` lihuisong (C)
2025-03-05 11:31     ` Sudeep Holla
2025-03-03 10:51 ` [PATCH 09/14] mailbox: pcc: Refactor and simplify check_and_ack() Sudeep Holla
2025-03-03 10:51 ` [PATCH 10/14] soc: hisilicon: kunpeng_hccs: Simplify PCC shared memory region handling Sudeep Holla
2025-03-05  7:14   ` lihuisong (C)
2025-03-05 11:34     ` Sudeep Holla
2025-03-06  3:55       ` lihuisong (C)
2025-03-06  9:31         ` Sudeep Holla
2025-03-03 10:51 ` [PATCH 11/14] i2c: xgene-slimpro: " Sudeep Holla
2025-03-03 10:51 ` [PATCH 12/14] hwmon: (xgene-hwmon) " Sudeep Holla
2025-03-03 13:55   ` Guenter Roeck
2025-03-03 15:05     ` Sudeep Holla
2025-03-03 10:51 ` [PATCH 13/14] ACPI: PCC: " Sudeep Holla
2025-03-03 10:51 ` [PATCH 14/14] ACPI: CPPC: " Sudeep Holla
2025-03-03 12:06   ` Rafael J. Wysocki

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=20250305142945.kzs4hfljbktkndbe@bogus \
    --to=sudeep.holla@arm.com \
    --cc=admiyo@os.amperecomputing.com \
    --cc=jassisinghbrar@gmail.com \
    --cc=lihuisong@huawei.com \
    --cc=linux-acpi@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=robbiek@xsightlabs.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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox

all inboxes | Powered by JetHome®