All of lore.kernel.org
 help / color / mirror / Atom feed
From: David Daney <ddaney.cavm@gmail.com>
To: "Maciej W. Rozycki" <macro@linux-mips.org>
Cc: Leonid Yegoshin <Leonid.Yegoshin@imgtec.com>,
	Zenon Fortuna <zenon.fortuna@imgtec.com>,
	"Steven J. Hill" <Steven.Hill@imgtec.com>,
	IMG - MIPS Linux Kernel developers 
	<IMG-MIPSLinuxKerneldevelopers@imgtec.com>,
	Linux MIPS Mailing List <linux-mips@linux-mips.org>
Subject: Re: [PATCH V2 1/3] MIPS: Fix cache flushing for swap pages with non-DMA I/O.
Date: Tue, 24 Feb 2015 16:38:38 -0800	[thread overview]
Message-ID: <54ED198E.4060906@gmail.com> (raw)
In-Reply-To: <alpine.LFD.2.11.1502242358170.17311@eddie.linux-mips.org>

On 02/24/2015 04:07 PM, Maciej W. Rozycki wrote:
> On Tue, 24 Feb 2015, Leonid Yegoshin wrote:
>
>>> SYNCI is only useful in non-SMP kernels.
>> Yes, until MIPS R6. I pressed hard on Arch team to change vague words in SYNCI
>> description and now (MIPS R6) it has words requiring execution on all cores:
>>
>>> "SYNCI globalization:
>>> Release 6: SYNCI globalization (as described below) is required: compliant
>>> implementations must globalize SYNCI.
>>> Portable software can rely on this behavior, and use SYNCI rather than
>>> expensive “instruction cache shootdown”
>>> using inter-processor interrupts."
>
>   Good, thanks for enforcing sanity!
>
>>> If a thread is migrated to a different CPU between the SYNCI, and the
>>> attempt to execute the freshly generated code, the new CPU can still have a
>>> dirty ICACHE.  So for Linux userspace, cacheflush(2) is your only option.
>
>   Is it not a kernel bug then?

I don't think so. cacheflush(2) is the only way for the kernel to know 
that it needs to do extra work.  The alternative is to not use ASIDs in 
the TLB and caches, and just invalidate all caches whenever we change 
contexts.

We carry a lot complexity in the kernel to avoid unnecessary TLB and 
cache invalidations.  All that goes out the window (with the performance 
improvements that it brings) if you want to magically make cacheflush(2) 
unnecessary.

> Shouldn't migration code enforce cache
> coherency manually if hardware does not?  User software is supposed to
> have a consistent view of the system and such details as being run on a
> multiprocessor should be completely hidden.

Traditionally on MIPS, the ICache is not coherent, going from non-SMP to 
SMP doesn't magically make it coherent.  Part of the ABI is that if you 
have self modifying code, you must call cacheflush(2)  If you violate 
the ABI, it won't work.

David Daney

  reply	other threads:[~2015-02-25  0:38 UTC|newest]

Thread overview: 24+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2015-02-19 16:17 [PATCH V2 0/3] HIGHMEM and cache flush fixes Steven J. Hill
2015-02-19 16:17 ` Steven J. Hill
2015-02-19 16:17 ` [PATCH V2 1/3] MIPS: Fix cache flushing for swap pages with non-DMA I/O Steven J. Hill
2015-02-19 16:17   ` Steven J. Hill
2015-02-20 19:17   ` Kevin Cernekee
2015-02-24  0:56     ` Leonid Yegoshin
2015-02-24  1:13       ` Zenon Fortuna
2015-02-24  2:33         ` Maciej W. Rozycki
2015-02-24 21:06           ` Leonid Yegoshin
2015-02-24 21:51             ` Maciej W. Rozycki
2015-02-24 21:57               ` Leonid Yegoshin
2015-02-24 22:50                 ` Maciej W. Rozycki
2015-02-24 22:57                   ` David Daney
2015-02-24 23:19                     ` Leonid Yegoshin
2015-02-24 23:58                       ` David Daney
2015-02-25  0:07                       ` Maciej W. Rozycki
2015-02-25  0:38                         ` David Daney [this message]
2015-02-24 23:15                   ` Leonid Yegoshin
2015-02-24  2:24       ` Maciej W. Rozycki
2015-02-24 16:20         ` Steven J. Hill
2015-02-19 16:17 ` [PATCH V2 2/3] MIPS: Highmem: Fixes for cache aliasing and color Steven J. Hill
2015-02-19 16:17   ` Steven J. Hill
2015-02-19 16:17 ` [PATCH V2 3/3] MIPS: Fix I-cache flushing for kmap'd pages Steven J. Hill
2015-02-19 16:17   ` Steven J. Hill

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=54ED198E.4060906@gmail.com \
    --to=ddaney.cavm@gmail.com \
    --cc=IMG-MIPSLinuxKerneldevelopers@imgtec.com \
    --cc=Leonid.Yegoshin@imgtec.com \
    --cc=Steven.Hill@imgtec.com \
    --cc=linux-mips@linux-mips.org \
    --cc=macro@linux-mips.org \
    --cc=zenon.fortuna@imgtec.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 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.