From: Thomas Gleixner <tglx@linutronix.de>
To: Christophe JAILLET <christophe.jaillet@wanadoo.fr>,
Tianyang Zhang <zhangtianyang@loongson.cn>,
chenhuacai@kernel.org, jiaxun.yang@flygoat.com
Cc: linux-mips@vger.kernel.org, linux-kernel@vger.kernel.org,
Baoqi Zhang <zhangbaoqi@loongson.cn>,
Biao Dong <dongbiao@loongson.cn>
Subject: Re: [PATCH V2] irqchip/loongson-pch-pic: Update interrupt registration policy
Date: Mon, 18 Mar 2024 12:18:25 +0100 [thread overview]
Message-ID: <87wmpziy9q.ffs@tglx> (raw)
In-Reply-To: <0fda46c7-87e1-41f1-b3f0-ee3d1a4ac601@wanadoo.fr>
On Sat, Mar 16 2024 at 15:03, Christophe JAILLET wrote:
> Le 16/03/2024 à 09:21, Tianyang Zhang a écrit :
>> @@ -171,6 +183,27 @@ static int pch_pic_domain_translate(struct irq_domain *d,
>> return -EINVAL;
>>
>> *hwirq = fwspec->param[0] - priv->gsi_base;
>> +
>> + raw_spin_lock_irqsave(&priv->pic_lock, flags);
>> + /* Check pic-table to confirm if the hwirq has been assigned */
>> + for (i = 0; i < priv->inuse; i++) {
>> + if (priv->table[i] == *hwirq) {
>> + *hwirq = i;
>> + break;
>> + }
>> + }
>> + if (i == priv->inuse) {
>> + /* Assign a new hwirq in pic-table */
>> + if (priv->inuse >= PIC_COUNT) {
>> + pr_err("pch-pic domain has no free vectors\n");
>> + raw_spin_unlock_irqrestore(&priv->pic_lock, flags);
>> + return -EINVAL;
>> + }
>> + priv->table[priv->inuse] = *hwirq;
>> + *hwirq = priv->inuse++;
>> + }
>> + raw_spin_unlock_irqrestore(&priv->pic_lock, flags);
>
> Hi,
>
> not sure if it helps or if this is a hot path, but, IIUC, taking the
> lock could be avoided with some code reordering and 'inuse' being an
> atomic_t.
It's the translate and setup path, so nothing to optimize here.
next prev parent reply other threads:[~2024-03-18 11:18 UTC|newest]
Thread overview: 8+ messages / expand[flat|nested] mbox.gz Atom feed top
2024-03-16 8:21 [PATCH V2] irqchip/loongson-pch-pic: Update interrupt registration policy Tianyang Zhang
2024-03-16 14:03 ` Christophe JAILLET
2024-03-18 11:18 ` Thomas Gleixner [this message]
2024-03-19 11:26 ` Tianyang Zhang
2024-03-18 14:35 ` Huacai Chen
2024-03-19 11:18 ` Tianyang Zhang
2024-03-21 6:10 ` [PATCH v2] " Binbin Zhou
2024-03-22 10:16 ` Tianyang Zhang
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=87wmpziy9q.ffs@tglx \
--to=tglx@linutronix.de \
--cc=chenhuacai@kernel.org \
--cc=christophe.jaillet@wanadoo.fr \
--cc=dongbiao@loongson.cn \
--cc=jiaxun.yang@flygoat.com \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-mips@vger.kernel.org \
--cc=zhangbaoqi@loongson.cn \
--cc=zhangtianyang@loongson.cn \
/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.