Linux PARISC architecture development
 help / color / mirror / Atom feed
From: John David Anglin <dave.anglin@bell.net>
To: Mikulas Patocka <mpatocka@redhat.com>,
	John David Anglin <dave@parisc-linux.org>
Cc: Helge Deller <deller@gmx.de>,
	"James E.J. Bottomley" <James.Bottomley@HansenPartnership.com>,
	linux-parisc@vger.kernel.org
Subject: Re: ARCH_DMA_MINALIGN on PA-RISC
Date: Wed, 24 Jul 2024 14:48:05 -0400	[thread overview]
Message-ID: <bfd612c3-7f63-49f4-8a37-454b8d537558@bell.net> (raw)
In-Reply-To: <93fcf9-f61b-7620-b5f1-d44449d280c9@redhat.com>

On 2024-07-24 2:17 p.m., Mikulas Patocka wrote:
> Hi
>
> Thanks for fixing the cache aliasing issues on PA-RISC in the commit
> 72d95924ee35c8cd16ef52f912483ee938a34d49.
>
> I think there is still one problem left - and that is ARCH_DMA_MINALIGN.
> Currently, it is 16, which is obviously wrong.
>
> Some comments in the kernel say that PA8900 has L2 cache with 128-byte
Yes, that is correct.  The PA8800 and PA8900 processors have 128-byte cache lines.
Previous PA 2.0 processors have 64-byte lines.
> line size, so I think that ARCH_DMA_MINALIGN should be 128 as well.
>
>
> The question is - can the CPU speculatively mark a cache line as dirty and
> write it back? If yes, we have a big problem - Linux assumes that a part
> of the page may be used for DMA transfer and another part of that page may
> be used for normal cacheable structures. If the PA-RISC CPU speculatively
> prefetched and wrote back a cache line,ove-in it could corrupt the DMA transfer.
I don't believe a CPU can mark a cache line as dirty and write it back.  A CPU can
speculatively read a line if the TLB entry for it is installed and it permits move-in.
Only setting setting the T bit or setting access rights to zero inhibits move-in (see
do_alias macro).  The NO_CACHE bit is another option.

Currently, near all cache flushes are done by removing the TLB entry and then
the page is flushed using a tmpalias flush that inhibits movein. This ensures that the
CPU doesn't speculatively bring lines for the page back into the cache.
>
> If the CPU doesn't speculatively mark cache lines as dirty, then
> increasing ARCH_DMA_MINALIGN would be sufficient solution.
Dave

-- 
John David Anglin  dave.anglin@bell.net


  reply	other threads:[~2024-07-24 18:49 UTC|newest]

Thread overview: 15+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2024-07-24 18:17 ARCH_DMA_MINALIGN on PA-RISC Mikulas Patocka
2024-07-24 18:48 ` John David Anglin [this message]
2024-07-24 19:25 ` James Bottomley
2024-07-25 16:45   ` John David Anglin
2024-07-25 17:27     ` Mikulas Patocka
2024-07-25 17:43       ` James Bottomley
2024-07-25 17:46         ` Mikulas Patocka
2024-07-25 19:19           ` James Bottomley
2024-07-25 19:13       ` John David Anglin
2024-07-25 20:05         ` John David Anglin
2024-07-25 20:36           ` Mikulas Patocka
2024-07-25 21:29             ` John David Anglin
2024-07-27 10:24               ` Mikulas Patocka
2024-07-27 15:06                 ` John David Anglin
2024-07-25 17:37   ` Mikulas Patocka

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=bfd612c3-7f63-49f4-8a37-454b8d537558@bell.net \
    --to=dave.anglin@bell.net \
    --cc=James.Bottomley@HansenPartnership.com \
    --cc=dave@parisc-linux.org \
    --cc=deller@gmx.de \
    --cc=linux-parisc@vger.kernel.org \
    --cc=mpatocka@redhat.com \
    /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