public inbox for linux-mips@vger.kernel.org
 help / color / mirror / Atom feed
From: Thomas Bogendoerfer <tsbogend@alpha.franken.de>
To: Marco Crivellari <marco.crivellari@suse.com>
Cc: Huacai Chen <chenhuacai@kernel.org>,
	"Maciej W. Rozycki" <macro@orcam.me.uk>,
	linux-mips@vger.kernel.org, linux-kernel@vger.kernel.org,
	Frederic Weisbecker <frederic@kernel.org>,
	Anna-Maria Behnsen <anna-maria@linutronix.de>,
	Thomas Gleixner <tglx@linutronix.de>,
	Peter Zijlstra <peterz@infradead.org>
Subject: Re: [PATCH v6 1/1] MIPS: Fix idle VS timer enqueue
Date: Wed, 26 Mar 2025 12:34:37 +0100	[thread overview]
Message-ID: <Z-PmTcGvmHgww6KP@alpha.franken.de> (raw)
In-Reply-To: <CAAofZF52_yKcpd+GBE9ygggeNTOVQDP7AKau5xZE+N4fHGCgSQ@mail.gmail.com>

On Wed, Mar 26, 2025 at 10:46:08AM +0100, Marco Crivellari wrote:
> I'm mostly thinking about future changes in this part of the code.
> But if it is ok what we have now, and future changes are not a
> problem, let's keep this version.
> 
> Would this be ok with you @Maciej?
> 
> If so, the region is now 40 bytes. This is what I did yesterday:
> 
> @@ -110,6 +110,7 @@ LEAF(__r4k_wait)
>        .set    noreorder
>        /* Start of idle interrupt region. */
>        MFC0    t0, CP0_STATUS
> +       nop
>        /* Enable interrupt. */
>        ori     t0, 0x1f
>        xori    t0, 0x1e
> @@ -128,7 +129,11 @@ LEAF(__r4k_wait)
>         */
>        wait
>        /* End of idle interrupt region. */
> -1:
> +__r4k_wait_exit:
> +       /* Check idle interrupt region size. */
> +       .if ((__r4k_wait_exit - __r4k_wait) != 40)
> +       .error  "Idle interrupt region size mismatch: expected 40 bytes."
> +       .endif
>        jr      ra
>         nop
>        .set    pop
> @@ -139,10 +144,10 @@ LEAF(__r4k_wait)
>        .set    push
>        .set    noat
>        MFC0    k0, CP0_EPC
> -       PTR_LA  k1, 1b
> -       /* 36 byte idle interrupt region. */
> +       PTR_LA  k1, __r4k_wait_exit
> +       /* 40 byte idle interrupt region. */

IMHO, we can't extend this above 36 bytes, because the interrupt could
hit at the instruction before the wait, which is then in the
next 32byte block.

I was thinking about aligning __r4k_wait 16 byte earlier and place
the wait at the end of the 

Something like:

	.align 5
	.align 4
LEAF(__r4k_wait)
	// irq enable sequence
	wait // align to end of the 32byte block
_r4k_wait_exit:

>        ori     k0, 0x1f
> -       PTR_ADDIU       k0, 5
> +       PTR_ADDIU       k0, 9

this needs to
	PTR_ADDIU       k0, 1

then. and __r4k_wait_exit - __r4k_wait is 48

But there might better ways...

Thomas.

-- 
Crap can work. Given enough thrust pigs will fly, but it's not necessarily a
good idea.                                                [ RFC1925, 2.3 ]

  reply	other threads:[~2025-03-26 11:35 UTC|newest]

Thread overview: 34+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2025-03-15 19:40 [PATCH v6 0/1] MIPS: Fix idle VS timer enqueue Marco Crivellari
2025-03-15 19:40 ` [PATCH v6 1/1] " Marco Crivellari
2025-03-19 11:07   ` Thomas Bogendoerfer
2025-03-19 14:06     ` Frederic Weisbecker
2025-03-19 14:42       ` Thomas Bogendoerfer
2025-03-19 15:01         ` Frederic Weisbecker
2025-03-19 14:43     ` Frederic Weisbecker
2025-03-19 15:31       ` Thomas Bogendoerfer
2025-03-20  8:44         ` Marco Crivellari
2025-03-21  9:38           ` Thomas Bogendoerfer
2025-03-21 10:44             ` Marco Crivellari
2025-03-21 11:17               ` Thomas Bogendoerfer
2025-03-21 11:55                 ` Maciej W. Rozycki
2025-03-21 11:53   ` Maciej W. Rozycki
2025-03-21 16:15     ` Marco Crivellari
2025-03-21 20:11       ` Maciej W. Rozycki
2025-03-25 14:08         ` Marco Crivellari
2025-03-26  1:20           ` Huacai Chen
2025-03-26  9:46             ` Marco Crivellari
2025-03-26 11:34               ` Thomas Bogendoerfer [this message]
2025-03-26 16:01               ` Maciej W. Rozycki
2025-03-28 10:42           ` Maciej W. Rozycki
2025-03-28 14:18             ` Maciej W. Rozycki
2025-03-31 10:11               ` Marco Crivellari
2025-03-31 20:09                 ` Maciej W. Rozycki
2025-04-01  9:31                   ` Jiaxun Yang
2025-04-02 11:42                   ` Marco Crivellari
2025-04-03 12:00                     ` Maciej W. Rozycki
2025-04-03 13:01                       ` Marco Crivellari
2025-04-03 20:17                         ` Maciej W. Rozycki
2025-04-04  3:18                           ` Marco Crivellari
2025-03-21 21:09     ` Frederic Weisbecker
2025-03-22 16:08       ` Maciej W. Rozycki
2025-03-25 13:31         ` Frederic Weisbecker

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=Z-PmTcGvmHgww6KP@alpha.franken.de \
    --to=tsbogend@alpha.franken.de \
    --cc=anna-maria@linutronix.de \
    --cc=chenhuacai@kernel.org \
    --cc=frederic@kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-mips@vger.kernel.org \
    --cc=macro@orcam.me.uk \
    --cc=marco.crivellari@suse.com \
    --cc=peterz@infradead.org \
    --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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox