mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Stian Halseth <stian@itx.no>
To: Imre Kaloz <kaloz@kernel.org>,
	"David S. Miller" <davem@davemloft.net>,
	 Andreas Larsson <andreas@gaisler.com>
Cc: "Matthew Wilcox (Oracle)" <willy@infradead.org>,
	"Mike Rapoport (IBM)" <rppt@kernel.org>,
	Andrew Morton <akpm@linux-foundation.org>,
	 sparclinux@vger.kernel.org, linux-kernel@vger.kernel.org,
	nsafran1217 <54966414+nsafran1217@users.noreply.github.com>,
	stable@vger.kernel.org
Subject: Re: [PATCH 2/2] sparc64: flush vmalloc ranges from the D-cache on map and unmap
Date: Mon, 28 Sep 2026 12:33:41 +0200	[thread overview]
Message-ID: <1330dc280f59571c1f624ccada069b73cd8624a3.camel@itx.no> (raw)
In-Reply-To: <20260927105539.8742-3-kaloz@kernel.org>

[-- Attachment #1: Type: text/plain, Size: 1637 bytes --]

Hi Imre,

On Sun, 2026-09-27 at 12:55 +0200, Imre Kaloz wrote:
> +void flush_cache_vmap(unsigned long start, unsigned long end)
> +{
> +#ifdef DCACHE_ALIASING_POSSIBLE
> +	if (tlb_type == hypervisor)
> +		return;

I found that this also runs early in boot, on the vmemmap.
__populate_section_memmap() calls it from sparse_init(). That is before
init_IRQ() has set up the cross-call mondo blocks, so xcall_deliver()
writes its three mondo words through __va(0), to physical address 0.

On SMP, cpu_data() is not filled in yet either, so dcache_size is 0 and
the flush itself does nothing useful.

Physical address 0 is ordinary RAM on the Sun Fire V240. In a test it
held zeros before the first of these cross-calls, and the three mondo
words after. The kernel uses that page later in boot. This happens
once per memory section, four times here.

Since the vmemmap has no aliases to flush, I suggest we skip anything
outside vmalloc and module space, like this:

        if (tlb_type == hypervisor ||
            !is_vmalloc_or_module_addr((void *)start))
                return;

With that, the V240 makes no cross-calls before init_IRQ().

Tested on a Sun Fire V240 with a module that reads a page through a
vmalloc address, rewrites it through the linear map on the same CPU and
maps it again at the same address: stale data in nearly every iteration
before, none after. Our V240s never showed #29 (no bpf() syscall
there), so that is a synthetic test. No change on a T4-1 with the
series as posted.

With the vmemmap check:
Tested-by: Stian Halseth <stian@itx.no> # Sun Fire V240, SPARC T4-1


[-- Attachment #2: This is a digitally signed message part --]
[-- Type: application/pgp-signature, Size: 228 bytes --]

  reply	other threads:[~2026-09-28 10:33 UTC|newest]

Thread overview: 9+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-09-27 10:55 [PATCH 0/2] sparc64: D-cache alias flushing fixes Imre Kaloz
2026-09-27 10:55 ` [PATCH 1/2] sparc64: flush only the aliased page, not its whole folio Imre Kaloz
2026-09-28  9:19   ` Stian Halseth
2026-09-27 10:55 ` [PATCH 2/2] sparc64: flush vmalloc ranges from the D-cache on map and unmap Imre Kaloz
2026-09-28 10:33   ` Stian Halseth [this message]
2026-09-28 13:18     ` Imre Kaloz
2026-09-28 14:04       ` Stian Halseth
2026-09-27 21:22 ` [PATCH 0/2] sparc64: D-cache alias flushing fixes John Paul Adrian Glaubitz
2026-09-28  8:49   ` Imre Kaloz

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=1330dc280f59571c1f624ccada069b73cd8624a3.camel@itx.no \
    --to=stian@itx.no \
    --cc=54966414+nsafran1217@users.noreply.github.com \
    --cc=akpm@linux-foundation.org \
    --cc=andreas@gaisler.com \
    --cc=davem@davemloft.net \
    --cc=kaloz@kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=rppt@kernel.org \
    --cc=sparclinux@vger.kernel.org \
    --cc=stable@vger.kernel.org \
    --cc=willy@infradead.org \
    /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®