All of lore.kernel.org
 help / color / mirror / Atom feed
From: Marc Zyngier <maz@kernel.org>
To: Lucas Stach <l.stach@pengutronix.de>
Cc: Thomas Gleixner <tglx@linutronix.de>,
	Anup Patel <apatel@ventanamicro.com>,
	James Gowans <jgowans@amazon.com>,
	Koichiro Den <den@valinux.co.jp>,
	linux-kernel@vger.kernel.org, kernel@pengutronix.de,
	patchwork-lst@pengutronix.de
Subject: Re: [PATCH] genirq: use relaxed access by default for irq_reg_{readl,writel}
Date: Tue, 30 Jan 2024 11:59:52 +0000	[thread overview]
Message-ID: <87ttmvvxon.wl-maz@kernel.org> (raw)
In-Reply-To: <20240129144502.1828154-1-l.stach@pengutronix.de>

On Mon, 29 Jan 2024 14:45:02 +0000,
Lucas Stach <l.stach@pengutronix.de> wrote:
> 
> irqchip access does not require any memory ordering between other
> memory transactions and the IRQ controller peripheral access.
> As all architectures now implement the relaxed MMIO accessors we
> can switch the irq_reg_{readl,writel} helpers to use them, in
> order to avoid potentially costly barriers in the IRQ handling
> hotpath.
> 
> Signed-off-by: Lucas Stach <l.stach@pengutronix.de>
> ---
>  include/linux/irq.h | 4 ++--
>  1 file changed, 2 insertions(+), 2 deletions(-)
> 
> diff --git a/include/linux/irq.h b/include/linux/irq.h
> index 90081afa10ce..fa1597db7887 100644
> --- a/include/linux/irq.h
> +++ b/include/linux/irq.h
> @@ -1218,7 +1218,7 @@ static inline void irq_reg_writel(struct irq_chip_generic *gc,
>  	if (gc->reg_writel)
>  		gc->reg_writel(val, gc->reg_base + reg_offset);
>  	else
> -		writel(val, gc->reg_base + reg_offset);
> +		writel_relaxed(val, gc->reg_base + reg_offset);
>  }
>  
>  static inline u32 irq_reg_readl(struct irq_chip_generic *gc,
> @@ -1227,7 +1227,7 @@ static inline u32 irq_reg_readl(struct irq_chip_generic *gc,
>  	if (gc->reg_readl)
>  		return gc->reg_readl(gc->reg_base + reg_offset);
>  	else
> -		return readl(gc->reg_base + reg_offset);
> +		return readl_relaxed(gc->reg_base + reg_offset);
>  }
>  

If this relaxation is introduced, it really should be documented and
require a buy-in, because unsuspecting drivers may implicitly depend
on the stronger ordering.

I'm a strong advocate of the relaxed ordering, but changing this
wholesale is potentially dangerous.

	M.

-- 
Without deviation from the norm, progress is not possible.

      reply	other threads:[~2024-01-30 11:59 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2024-01-29 14:45 [PATCH] genirq: use relaxed access by default for irq_reg_{readl,writel} Lucas Stach
2024-01-30 11:59 ` Marc Zyngier [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=87ttmvvxon.wl-maz@kernel.org \
    --to=maz@kernel.org \
    --cc=apatel@ventanamicro.com \
    --cc=den@valinux.co.jp \
    --cc=jgowans@amazon.com \
    --cc=kernel@pengutronix.de \
    --cc=l.stach@pengutronix.de \
    --cc=linux-kernel@vger.kernel.org \
    --cc=patchwork-lst@pengutronix.de \
    --cc=tglx@linutronix.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 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.