From: Sean Anderson <seanga2@gmail.com>
To: u-boot@lists.denx.de
Subject: [PATCH v6 13/19] riscv: Fix race conditions when initializing IPI
Date: Tue, 17 Mar 2020 15:27:48 -0400 [thread overview]
Message-ID: <ce63c2ad-26b3-cdad-d031-1b3b087774e9@gmail.com> (raw)
In-Reply-To: <CAN5B=eJnWCfBxr4i9hT5-hejYuiw8QS_DHgHRySbcdxq+4N43w@mail.gmail.com>
On 3/10/20 9:33 PM, Rick Chen wrote:
> Hi Sean
>
>> On 3/10/20 4:20 AM, Rick Chen wrote:
>>> Hi Sean
>>>
>>>> The IPI code could have race conditions in several places.
>>>> * Several harts could race on the value of gd->arch->clint/plic
>>>> * Non-boot harts could race with the main hart on the DM subsystem In
>>>> addition, if an IPI was pending when U-Boot started, it would cause the
>>>> IPI handler to jump to address 0.
>>>>
>>>> To address these problems, a new function riscv_init_ipi is introduced. It
>>>> is called once during arch_cpu_init_dm. Before this point, no riscv_*_ipi
>>>> functions may be called. Access is synchronized by gd->arch->ipi_ready.
>>>>
>>>> Signed-off-by: Sean Anderson <seanga2@gmail.com>
>>>> ---
>>>>
>>>
>>>> Can you try to clear mip/sip in startup flow before secondary_hart_loop:
>>>> Maybe it can help to overcome the problem of calling riscv_clear_ipi()
>>>> before riscv_init_ipi() that you added.
>>>
>>> How is the verified result about trying to clear mip/sip in startup flow ?
>>> I have asked you twice in v5, but you still have no response about it.
>>>
>>> [PATCH v5 27/33] riscv: Fix race conditions when initializing IPI
>>> https://patchwork.ozlabs.org/patch/1246864/#2377119
>>>
>>> Thanks
>>> Rick
>>
>> I managed to get it working, and this patch incorporates that change.
>> However, I forgot to update the commit message. The original issue I had
>> was related to an accidental change to my config, and not to the
>> clearing of MIP.
>
> So it is not a race condition issue, right ?
It is sort of a race condition? If the IP CSR is not cleared, then we
can have a race condition.
>
> Maybe you shall split this into two patchs as below
>
> patch 1
> riscv: Clear pending ipi in start code
> Describe that it can how and what it help to fix the problem you
> encounter more detail
> e.g.
> (Perhaps the prior stage sends an IPI but does not clear it) ...
>
> patch 2
> riscv: refine ipi initialize code flow
> Describe that your motivation and intention more detail
> e.g.
> I think the macro approach is a bit confusing,
> since it's unclear at first glance what function
> will be initializing the clint/plic.
> Given U-Boot's otherwise completely SMP-unsafe design,
> I think it's better to be explicit and conservative in these areas.
>
> It can help us to roll back and debug in the future.
>
> Thanks,
> Rick
This will be split in the next revision.
>>
>> --Sean
next prev parent reply other threads:[~2020-03-17 19:27 UTC|newest]
Thread overview: 37+ messages / expand[flat|nested] mbox.gz Atom feed top
2020-03-05 18:12 [PATCH v6 00/19] riscv: Add Sipeed Maix support Sean Anderson
2020-03-05 18:12 ` [PATCH v6 01/19] clk: Always use the supplied struct clk Sean Anderson
2020-03-05 18:12 ` [PATCH v6 02/19] clk: Check that ops of composite clock components exist before calling Sean Anderson
2020-03-05 18:12 ` [PATCH v6 03/19] clk: Unconditionally recursively en-/dis-able clocks Sean Anderson
2020-03-10 6:29 ` Rick Chen
2020-03-10 6:51 ` Rick Chen
2020-03-10 13:14 ` Sean Anderson
2020-03-11 2:09 ` Rick Chen
2020-03-12 18:27 ` Sean Anderson
2020-03-05 18:12 ` [PATCH v6 04/19] clk: Add functions to register CCF clock structs Sean Anderson
2020-03-10 7:08 ` Rick Chen
2020-03-17 19:00 ` Sean Anderson
2020-03-05 18:12 ` [PATCH v6 05/19] clk: Add K210 pll support Sean Anderson
2020-03-05 18:12 ` [PATCH v6 06/19] clk: Add a bypass clock for K210 Sean Anderson
2020-03-05 18:12 ` [PATCH v6 07/19] clk: Add K210 clock support Sean Anderson
2020-03-05 18:12 ` [PATCH v6 08/19] dm: Add support for simple-pm-bus Sean Anderson
2020-03-05 18:12 ` [PATCH v6 09/19] dm: Fix error handling for dev_read_addr_ptr Sean Anderson
2020-03-05 18:12 ` [PATCH v6 10/19] reset: Add generic reset driver Sean Anderson
2020-03-05 18:12 ` [PATCH v6 11/19] lib: Always set errno in hcreate_r Sean Anderson
2020-03-05 18:13 ` [PATCH v6 12/19] riscv: Add headers for asm/global_data.h Sean Anderson
2020-03-05 18:13 ` [PATCH v6 13/19] riscv: Fix race conditions when initializing IPI Sean Anderson
2020-03-10 8:20 ` Rick Chen
2020-03-10 13:16 ` Sean Anderson
2020-03-11 1:33 ` Rick Chen
2020-03-17 19:27 ` Sean Anderson [this message]
2020-03-05 18:13 ` [PATCH v6 14/19] riscv: Add option to support RISC-V privileged spec 1.9 Sean Anderson
2020-03-05 18:13 ` [PATCH v6 15/19] riscv: Allow use of reset drivers Sean Anderson
2020-03-05 18:13 ` [PATCH v6 16/19] riscv: Try to get cpu frequency from a "clocks" node if it exists Sean Anderson
2020-03-05 18:13 ` [PATCH v6 17/19] riscv: Enable cpu clock if it is present Sean Anderson
2020-03-05 18:13 ` [PATCH v6 18/19] riscv: Add device tree for K210 and Sipeed Maix BitM Sean Anderson
2020-03-10 9:08 ` Rick Chen
2020-03-10 13:17 ` Sean Anderson
2020-03-11 1:51 ` Rick Chen
2020-03-05 18:13 ` [PATCH v6 19/19] riscv: Add Sipeed Maix support Sean Anderson
2020-03-10 9:04 ` Rick Chen
2020-03-10 13:19 ` Sean Anderson
2020-03-11 2:05 ` Rick Chen
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=ce63c2ad-26b3-cdad-d031-1b3b087774e9@gmail.com \
--to=seanga2@gmail.com \
--cc=u-boot@lists.denx.de \
/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