2009-04-03 01:49:22 +00:00
/*
2005-04-16 15:20:36 -07:00
* This file is subject to the terms and conditions of the GNU General Public
* License . See the file " COPYING " in the main directory of this archive
* for more details .
*
2006-03-27 19:52:14 +00:00
* Copyright ( C ) 1999 - 2006 Helge Deller < deller @ gmx . de > ( 07 - 13 - 1999 )
2005-04-16 15:20:36 -07:00
* Copyright ( C ) 1999 SuSE GmbH Nuernberg
* Copyright ( C ) 2000 Philipp Rumpf ( prumpf @ tux . org )
*
* Cache and TLB management
*
*/
# include <linux/init.h>
# include <linux/kernel.h>
# include <linux/mm.h>
# include <linux/module.h>
# include <linux/seq_file.h>
# include <linux/pagemap.h>
Detach sched.h from mm.h
First thing mm.h does is including sched.h solely for can_do_mlock() inline
function which has "current" dereference inside. By dealing with can_do_mlock()
mm.h can be detached from sched.h which is good. See below, why.
This patch
a) removes unconditional inclusion of sched.h from mm.h
b) makes can_do_mlock() normal function in mm/mlock.c
c) exports can_do_mlock() to not break compilation
d) adds sched.h inclusions back to files that were getting it indirectly.
e) adds less bloated headers to some files (asm/signal.h, jiffies.h) that were
getting them indirectly
Net result is:
a) mm.h users would get less code to open, read, preprocess, parse, ... if
they don't need sched.h
b) sched.h stops being dependency for significant number of files:
on x86_64 allmodconfig touching sched.h results in recompile of 4083 files,
after patch it's only 3744 (-8.3%).
Cross-compile tested on
all arm defconfigs, all mips defconfigs, all powerpc defconfigs,
alpha alpha-up
arm
i386 i386-up i386-defconfig i386-allnoconfig
ia64 ia64-up
m68k
mips
parisc parisc-up
powerpc powerpc-up
s390 s390-up
sparc sparc-up
sparc64 sparc64-up
um-x86_64
x86_64 x86_64-up x86_64-defconfig x86_64-allnoconfig
as well as my two usual configs.
Signed-off-by: Alexey Dobriyan <adobriyan@gmail.com>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
2007-05-21 01:22:52 +04:00
# include <linux/sched.h>
2017-02-08 18:51:31 +01:00
# include <linux/sched/mm.h>
2005-04-16 15:20:36 -07:00
# include <asm/pdc.h>
# include <asm/cache.h>
# include <asm/cacheflush.h>
# include <asm/tlbflush.h>
# include <asm/page.h>
# include <asm/processor.h>
2005-10-21 22:44:14 -04:00
# include <asm/sections.h>
2010-12-22 10:22:11 -06:00
# include <asm/shmparam.h>
parisc: Rewrite cache flush code for PA8800/PA8900
Originally, I was convinced that we needed to use tmpalias flushes
everwhere, for both user and kernel flushes. However, when I modified
flush_kernel_dcache_page_addr, to use a tmpalias flush, my c8000
would crash quite early when booting.
The PDC returns alias values of 0 for the icache and dcache. This
indicates that either the alias boundary is greater than 16MB or
equivalent aliasing doesn't work. I modified the tmpalias code to
make it easy to try alternate boundaries. I tried boundaries up to
128MB but still kernel tmpalias flushes didn't work on c8000.
This led me to conclude that tmpalias flushes don't work on PA8800
and PA8900 machines, and that we needed to flush directly using the
virtual address of user and kernel pages. This is likely the major
cause of instability on the c8000 and rp34xx machines.
Flushing user pages requires doing a temporary context switch as we
have to flush pages that don't belong to the current context. Further,
we have to deal with pages that aren't present. If a page isn't
present, the flush instructions fault on every line.
Other code has been rearranged and simplified based on testing. For
example, I introduced a flush_cache_dup_mm routine. flush_cache_mm
and flush_cache_dup_mm differ in that flush_cache_mm calls
purge_cache_pages and flush_cache_dup_mm calls flush_cache_pages.
In some implementations, pdc is more efficient than fdc. Based on
my testing, I don't believe there's any performance benefit on the
c8000.
Signed-off-by: John David Anglin <dave.anglin@bell.net>
Signed-off-by: Helge Deller <deller@gmx.de>
2022-05-16 15:14:47 +00:00
# include <asm/mmu_context.h>
2005-04-16 15:20:36 -07:00
2019-05-10 20:47:11 +02:00
int split_tlb __ro_after_init ;
int dcache_stride __ro_after_init ;
int icache_stride __ro_after_init ;
2005-04-16 15:20:36 -07:00
EXPORT_SYMBOL ( dcache_stride ) ;
2010-12-22 10:22:11 -06:00
void flush_dcache_page_asm ( unsigned long phys_addr , unsigned long vaddr ) ;
EXPORT_SYMBOL ( flush_dcache_page_asm ) ;
2018-10-19 20:48:12 -04:00
void purge_dcache_page_asm ( unsigned long phys_addr , unsigned long vaddr ) ;
2010-12-22 10:22:11 -06:00
void flush_icache_page_asm ( unsigned long phys_addr , unsigned long vaddr ) ;
2022-03-12 21:03:33 +01:00
/* Internal implementation in arch/parisc/kernel/pacache.S */
void flush_data_cache_local ( void * ) ; /* flushes local data-cache only */
void flush_instruction_cache_local ( void ) ; /* flushes local code-cache only */
2005-04-16 15:20:36 -07:00
2019-04-28 00:09:53 +02:00
/* On some machines (i.e., ones with the Merced bus), there can be
2005-04-16 15:20:36 -07:00
* only a single PxTLB broadcast at a time ; this must be guaranteed
2019-04-28 00:09:53 +02:00
* by software . We need a spinlock around all TLB flushes to ensure
* this .
2005-04-16 15:20:36 -07:00
*/
2019-04-28 00:09:53 +02:00
DEFINE_SPINLOCK ( pa_tlb_flush_lock ) ;
# if defined(CONFIG_64BIT) && defined(CONFIG_SMP)
2019-05-10 20:47:11 +02:00
int pa_serialize_tlb_flushes __ro_after_init ;
2019-04-28 00:09:53 +02:00
# endif
2005-04-16 15:20:36 -07:00
2019-05-10 20:47:11 +02:00
struct pdc_cache_info cache_info __ro_after_init ;
2005-04-16 15:20:36 -07:00
# ifndef CONFIG_PA20
2019-05-10 20:47:11 +02:00
static struct pdc_btlb_info btlb_info __ro_after_init ;
2005-04-16 15:20:36 -07:00
# endif
2022-03-12 21:03:33 +01:00
DEFINE_STATIC_KEY_TRUE ( parisc_has_cache ) ;
DEFINE_STATIC_KEY_TRUE ( parisc_has_dcache ) ;
DEFINE_STATIC_KEY_TRUE ( parisc_has_icache ) ;
static void cache_flush_local_cpu ( void * dummy )
2005-04-16 15:20:36 -07:00
{
2022-03-12 21:03:33 +01:00
if ( static_branch_likely ( & parisc_has_icache ) )
flush_instruction_cache_local ( ) ;
if ( static_branch_likely ( & parisc_has_dcache ) )
flush_data_cache_local ( NULL ) ;
2005-04-16 15:20:36 -07:00
}
2022-03-12 21:03:33 +01:00
void flush_cache_all_local ( void )
2005-04-16 15:20:36 -07:00
{
2022-03-12 21:03:33 +01:00
cache_flush_local_cpu ( NULL ) ;
2005-04-16 15:20:36 -07:00
}
2022-03-12 21:03:33 +01:00
void flush_cache_all ( void )
{
if ( static_branch_likely ( & parisc_has_cache ) )
on_each_cpu ( cache_flush_local_cpu , NULL , 1 ) ;
}
static inline void flush_data_cache ( void )
2005-04-16 15:20:36 -07:00
{
2022-03-12 21:03:33 +01:00
if ( static_branch_likely ( & parisc_has_dcache ) )
on_each_cpu ( flush_data_cache_local , NULL , 1 ) ;
2005-04-16 15:20:36 -07:00
}
2022-03-12 21:03:33 +01:00
2005-04-16 15:20:36 -07:00
parisc: Rewrite cache flush code for PA8800/PA8900
Originally, I was convinced that we needed to use tmpalias flushes
everwhere, for both user and kernel flushes. However, when I modified
flush_kernel_dcache_page_addr, to use a tmpalias flush, my c8000
would crash quite early when booting.
The PDC returns alias values of 0 for the icache and dcache. This
indicates that either the alias boundary is greater than 16MB or
equivalent aliasing doesn't work. I modified the tmpalias code to
make it easy to try alternate boundaries. I tried boundaries up to
128MB but still kernel tmpalias flushes didn't work on c8000.
This led me to conclude that tmpalias flushes don't work on PA8800
and PA8900 machines, and that we needed to flush directly using the
virtual address of user and kernel pages. This is likely the major
cause of instability on the c8000 and rp34xx machines.
Flushing user pages requires doing a temporary context switch as we
have to flush pages that don't belong to the current context. Further,
we have to deal with pages that aren't present. If a page isn't
present, the flush instructions fault on every line.
Other code has been rearranged and simplified based on testing. For
example, I introduced a flush_cache_dup_mm routine. flush_cache_mm
and flush_cache_dup_mm differ in that flush_cache_mm calls
purge_cache_pages and flush_cache_dup_mm calls flush_cache_pages.
In some implementations, pdc is more efficient than fdc. Based on
my testing, I don't believe there's any performance benefit on the
c8000.
Signed-off-by: John David Anglin <dave.anglin@bell.net>
Signed-off-by: Helge Deller <deller@gmx.de>
2022-05-16 15:14:47 +00:00
/* Kernel virtual address of pfn. */
2013-07-23 12:27:52 -04:00
# define pfn_va(pfn) __va(PFN_PHYS(pfn))
2005-04-16 15:20:36 -07:00
void
2021-11-08 16:48:16 -05:00
__update_cache ( pte_t pte )
2005-04-16 15:20:36 -07:00
{
2021-11-08 16:48:16 -05:00
unsigned long pfn = pte_pfn ( pte ) ;
2013-07-23 12:27:52 -04:00
struct page * page ;
2005-04-16 15:20:36 -07:00
2013-07-23 12:27:52 -04:00
/* We don't have pte special. As a result, we can be called with
an invalid pfn and we don ' t need to flush the kernel dcache page .
This occurs with FireGL card in C8000 . */
if ( ! pfn_valid ( pfn ) )
return ;
2005-04-16 15:20:36 -07:00
2013-07-23 12:27:52 -04:00
page = pfn_to_page ( pfn ) ;
mm: fix races between swapoff and flush dcache
Thanks to commit 4b3ef9daa4fc ("mm/swap: split swap cache into 64MB
trunks"), after swapoff the address_space associated with the swap
device will be freed. So page_mapping() users which may touch the
address_space need some kind of mechanism to prevent the address_space
from being freed during accessing.
The dcache flushing functions (flush_dcache_page(), etc) in architecture
specific code may access the address_space of swap device for anonymous
pages in swap cache via page_mapping() function. But in some cases
there are no mechanisms to prevent the swap device from being swapoff,
for example,
CPU1 CPU2
__get_user_pages() swapoff()
flush_dcache_page()
mapping = page_mapping()
... exit_swap_address_space()
... kvfree(spaces)
mapping_mapped(mapping)
The address space may be accessed after being freed.
But from cachetlb.txt and Russell King, flush_dcache_page() only care
about file cache pages, for anonymous pages, flush_anon_page() should be
used. The implementation of flush_dcache_page() in all architectures
follows this too. They will check whether page_mapping() is NULL and
whether mapping_mapped() is true to determine whether to flush the
dcache immediately. And they will use interval tree (mapping->i_mmap)
to find all user space mappings. While mapping_mapped() and
mapping->i_mmap isn't used by anonymous pages in swap cache at all.
So, to fix the race between swapoff and flush dcache, __page_mapping()
is add to return the address_space for file cache pages and NULL
otherwise. All page_mapping() invoking in flush dcache functions are
replaced with page_mapping_file().
[akpm@linux-foundation.org: simplify page_mapping_file(), per Mike]
Link: http://lkml.kernel.org/r/20180305083634.15174-1-ying.huang@intel.com
Signed-off-by: "Huang, Ying" <ying.huang@intel.com>
Reviewed-by: Andrew Morton <akpm@linux-foundation.org>
Cc: Minchan Kim <minchan@kernel.org>
Cc: Michal Hocko <mhocko@suse.com>
Cc: Johannes Weiner <hannes@cmpxchg.org>
Cc: Mel Gorman <mgorman@techsingularity.net>
Cc: Dave Hansen <dave.hansen@intel.com>
Cc: Chen Liqin <liqin.linux@gmail.com>
Cc: Russell King <linux@armlinux.org.uk>
Cc: Yoshinori Sato <ysato@users.sourceforge.jp>
Cc: "James E.J. Bottomley" <jejb@parisc-linux.org>
Cc: Guan Xuetao <gxt@mprc.pku.edu.cn>
Cc: "David S. Miller" <davem@davemloft.net>
Cc: Chris Zankel <chris@zankel.net>
Cc: Vineet Gupta <vgupta@synopsys.com>
Cc: Ley Foon Tan <lftan@altera.com>
Cc: Ralf Baechle <ralf@linux-mips.org>
Cc: Andi Kleen <ak@linux.intel.com>
Cc: Mike Rapoport <rppt@linux.vnet.ibm.com>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
2018-04-05 16:24:39 -07:00
if ( page_mapping_file ( page ) & &
test_bit ( PG_dcache_dirty , & page - > flags ) ) {
2013-07-23 12:27:52 -04:00
flush_kernel_dcache_page_addr ( pfn_va ( pfn ) ) ;
2005-04-16 15:20:36 -07:00
clear_bit ( PG_dcache_dirty , & page - > flags ) ;
2006-08-23 09:00:04 -07:00
} else if ( parisc_requires_coherency ( ) )
2013-07-23 12:27:52 -04:00
flush_kernel_dcache_page_addr ( pfn_va ( pfn ) ) ;
2005-04-16 15:20:36 -07:00
}
void
show_cache_info ( struct seq_file * m )
{
2006-06-14 20:26:25 +00:00
char buf [ 32 ] ;
2005-04-16 15:20:36 -07:00
seq_printf ( m , " I-cache \t \t : %ld KB \n " ,
cache_info . ic_size / 1024 ) ;
2007-01-23 21:24:20 +01:00
if ( cache_info . dc_loop ! = 1 )
2006-06-14 20:26:25 +00:00
snprintf ( buf , 32 , " %lu-way associative " , cache_info . dc_loop ) ;
parisc: Rewrite cache flush code for PA8800/PA8900
Originally, I was convinced that we needed to use tmpalias flushes
everwhere, for both user and kernel flushes. However, when I modified
flush_kernel_dcache_page_addr, to use a tmpalias flush, my c8000
would crash quite early when booting.
The PDC returns alias values of 0 for the icache and dcache. This
indicates that either the alias boundary is greater than 16MB or
equivalent aliasing doesn't work. I modified the tmpalias code to
make it easy to try alternate boundaries. I tried boundaries up to
128MB but still kernel tmpalias flushes didn't work on c8000.
This led me to conclude that tmpalias flushes don't work on PA8800
and PA8900 machines, and that we needed to flush directly using the
virtual address of user and kernel pages. This is likely the major
cause of instability on the c8000 and rp34xx machines.
Flushing user pages requires doing a temporary context switch as we
have to flush pages that don't belong to the current context. Further,
we have to deal with pages that aren't present. If a page isn't
present, the flush instructions fault on every line.
Other code has been rearranged and simplified based on testing. For
example, I introduced a flush_cache_dup_mm routine. flush_cache_mm
and flush_cache_dup_mm differ in that flush_cache_mm calls
purge_cache_pages and flush_cache_dup_mm calls flush_cache_pages.
In some implementations, pdc is more efficient than fdc. Based on
my testing, I don't believe there's any performance benefit on the
c8000.
Signed-off-by: John David Anglin <dave.anglin@bell.net>
Signed-off-by: Helge Deller <deller@gmx.de>
2022-05-16 15:14:47 +00:00
seq_printf ( m , " D-cache \t \t : %ld KB (%s%s, %s, alias=%d) \n " ,
2005-04-16 15:20:36 -07:00
cache_info . dc_size / 1024 ,
( cache_info . dc_conf . cc_wt ? " WT " : " WB " ) ,
( cache_info . dc_conf . cc_sh ? " , shared I/D " : " " ) ,
parisc: Rewrite cache flush code for PA8800/PA8900
Originally, I was convinced that we needed to use tmpalias flushes
everwhere, for both user and kernel flushes. However, when I modified
flush_kernel_dcache_page_addr, to use a tmpalias flush, my c8000
would crash quite early when booting.
The PDC returns alias values of 0 for the icache and dcache. This
indicates that either the alias boundary is greater than 16MB or
equivalent aliasing doesn't work. I modified the tmpalias code to
make it easy to try alternate boundaries. I tried boundaries up to
128MB but still kernel tmpalias flushes didn't work on c8000.
This led me to conclude that tmpalias flushes don't work on PA8800
and PA8900 machines, and that we needed to flush directly using the
virtual address of user and kernel pages. This is likely the major
cause of instability on the c8000 and rp34xx machines.
Flushing user pages requires doing a temporary context switch as we
have to flush pages that don't belong to the current context. Further,
we have to deal with pages that aren't present. If a page isn't
present, the flush instructions fault on every line.
Other code has been rearranged and simplified based on testing. For
example, I introduced a flush_cache_dup_mm routine. flush_cache_mm
and flush_cache_dup_mm differ in that flush_cache_mm calls
purge_cache_pages and flush_cache_dup_mm calls flush_cache_pages.
In some implementations, pdc is more efficient than fdc. Based on
my testing, I don't believe there's any performance benefit on the
c8000.
Signed-off-by: John David Anglin <dave.anglin@bell.net>
Signed-off-by: Helge Deller <deller@gmx.de>
2022-05-16 15:14:47 +00:00
( ( cache_info . dc_loop = = 1 ) ? " direct mapped " : buf ) ,
cache_info . dc_conf . cc_alias
) ;
2005-04-16 15:20:36 -07:00
seq_printf ( m , " ITLB entries \t : %ld \n " " DTLB entries \t : %ld%s \n " ,
cache_info . it_size ,
cache_info . dt_size ,
cache_info . dt_conf . tc_sh ? " - shared with ITLB " : " "
) ;
# ifndef CONFIG_PA20
/* BTLB - Block TLB */
if ( btlb_info . max_size = = 0 ) {
seq_printf ( m , " BTLB \t \t : not supported \n " ) ;
} else {
seq_printf ( m ,
" BTLB fixed \t : max. %d pages, pagesize=%d (%dMB) \n "
" BTLB fix-entr. \t : %d instruction, %d data (%d combined) \n "
" BTLB var-entr. \t : %d instruction, %d data (%d combined) \n " ,
btlb_info . max_size , ( int ) 4096 ,
btlb_info . max_size > > 8 ,
btlb_info . fixed_range_info . num_i ,
btlb_info . fixed_range_info . num_d ,
btlb_info . fixed_range_info . num_comb ,
btlb_info . variable_range_info . num_i ,
btlb_info . variable_range_info . num_d ,
btlb_info . variable_range_info . num_comb
) ;
}
# endif
}
void __init
parisc_cache_init ( void )
{
if ( pdc_cache_info ( & cache_info ) < 0 )
panic ( " parisc_cache_init: pdc_cache_info failed " ) ;
#if 0
printk ( " ic_size %lx dc_size %lx it_size %lx \n " ,
cache_info . ic_size ,
cache_info . dc_size ,
cache_info . it_size ) ;
printk ( " DC base 0x%lx stride 0x%lx count 0x%lx loop 0x%lx \n " ,
cache_info . dc_base ,
cache_info . dc_stride ,
cache_info . dc_count ,
cache_info . dc_loop ) ;
printk ( " dc_conf = 0x%lx alias %d blk %d line %d shift %d \n " ,
* ( unsigned long * ) ( & cache_info . dc_conf ) ,
cache_info . dc_conf . cc_alias ,
cache_info . dc_conf . cc_block ,
cache_info . dc_conf . cc_line ,
cache_info . dc_conf . cc_shift ) ;
2006-06-14 20:26:25 +00:00
printk ( " wt %d sh %d cst %d hv %d \n " ,
2005-04-16 15:20:36 -07:00
cache_info . dc_conf . cc_wt ,
cache_info . dc_conf . cc_sh ,
cache_info . dc_conf . cc_cst ,
2006-06-14 20:26:25 +00:00
cache_info . dc_conf . cc_hv ) ;
2005-04-16 15:20:36 -07:00
printk ( " IC base 0x%lx stride 0x%lx count 0x%lx loop 0x%lx \n " ,
cache_info . ic_base ,
cache_info . ic_stride ,
cache_info . ic_count ,
cache_info . ic_loop ) ;
2015-11-25 22:43:45 +01:00
printk ( " IT base 0x%lx stride 0x%lx count 0x%lx loop 0x%lx off_base 0x%lx off_stride 0x%lx off_count 0x%lx \n " ,
cache_info . it_sp_base ,
cache_info . it_sp_stride ,
cache_info . it_sp_count ,
cache_info . it_loop ,
cache_info . it_off_base ,
cache_info . it_off_stride ,
cache_info . it_off_count ) ;
printk ( " DT base 0x%lx stride 0x%lx count 0x%lx loop 0x%lx off_base 0x%lx off_stride 0x%lx off_count 0x%lx \n " ,
cache_info . dt_sp_base ,
cache_info . dt_sp_stride ,
cache_info . dt_sp_count ,
cache_info . dt_loop ,
cache_info . dt_off_base ,
cache_info . dt_off_stride ,
cache_info . dt_off_count ) ;
2005-04-16 15:20:36 -07:00
printk ( " ic_conf = 0x%lx alias %d blk %d line %d shift %d \n " ,
* ( unsigned long * ) ( & cache_info . ic_conf ) ,
cache_info . ic_conf . cc_alias ,
cache_info . ic_conf . cc_block ,
cache_info . ic_conf . cc_line ,
cache_info . ic_conf . cc_shift ) ;
2006-06-14 20:26:25 +00:00
printk ( " wt %d sh %d cst %d hv %d \n " ,
2005-04-16 15:20:36 -07:00
cache_info . ic_conf . cc_wt ,
cache_info . ic_conf . cc_sh ,
cache_info . ic_conf . cc_cst ,
2006-06-14 20:26:25 +00:00
cache_info . ic_conf . cc_hv ) ;
2005-04-16 15:20:36 -07:00
2015-11-25 22:43:45 +01:00
printk ( " D-TLB conf: sh %d page %d cst %d aid %d sr %d \n " ,
2005-04-16 15:20:36 -07:00
cache_info . dt_conf . tc_sh ,
cache_info . dt_conf . tc_page ,
cache_info . dt_conf . tc_cst ,
cache_info . dt_conf . tc_aid ,
2015-11-25 22:43:45 +01:00
cache_info . dt_conf . tc_sr ) ;
2005-04-16 15:20:36 -07:00
2015-11-25 22:43:45 +01:00
printk ( " I-TLB conf: sh %d page %d cst %d aid %d sr %d \n " ,
2005-04-16 15:20:36 -07:00
cache_info . it_conf . tc_sh ,
cache_info . it_conf . tc_page ,
cache_info . it_conf . tc_cst ,
cache_info . it_conf . tc_aid ,
2015-11-25 22:43:45 +01:00
cache_info . it_conf . tc_sr ) ;
2005-04-16 15:20:36 -07:00
# endif
split_tlb = 0 ;
if ( cache_info . dt_conf . tc_sh = = 0 | | cache_info . dt_conf . tc_sh = = 2 ) {
if ( cache_info . dt_conf . tc_sh = = 2 )
printk ( KERN_WARNING " Unexpected TLB configuration. "
" Will flush I/D separately (could be optimized). \n " ) ;
split_tlb = 1 ;
}
/* "New and Improved" version from Jim Hull
* ( 1 < < ( cc_block - 1 ) ) * ( cc_line < < ( 4 + cnf . cc_shift ) )
2005-10-21 22:44:14 -04:00
* The following CAFL_STRIDE is an optimized version , see
* http : //lists.parisc-linux.org/pipermail/parisc-linux/2004-June/023625.html
* http : //lists.parisc-linux.org/pipermail/parisc-linux/2004-June/023671.html
2005-04-16 15:20:36 -07:00
*/
# define CAFL_STRIDE(cnf) (cnf.cc_line << (3 + cnf.cc_block + cnf.cc_shift))
dcache_stride = CAFL_STRIDE ( cache_info . dc_conf ) ;
icache_stride = CAFL_STRIDE ( cache_info . ic_conf ) ;
# undef CAFL_STRIDE
# ifndef CONFIG_PA20
if ( pdc_btlb_info ( & btlb_info ) < 0 ) {
memset ( & btlb_info , 0 , sizeof btlb_info ) ;
}
# endif
if ( ( boot_cpu_data . pdc . capabilities & PDC_MODEL_NVA_MASK ) = =
PDC_MODEL_NVA_UNSUPPORTED ) {
printk ( KERN_WARNING " parisc_cache_init: Only equivalent aliasing supported! \n " ) ;
#if 0
panic ( " SMP kernel required to avoid non-equivalent aliasing " ) ;
# endif
}
}
2022-03-26 15:10:54 +01:00
void disable_sr_hashing ( void )
2005-04-16 15:20:36 -07:00
{
2006-06-16 18:20:00 -04:00
int srhash_type , retval ;
unsigned long space_bits ;
2005-04-16 15:20:36 -07:00
switch ( boot_cpu_data . cpu_type ) {
case pcx : /* We shouldn't get this far. setup.c should prevent it. */
BUG ( ) ;
return ;
case pcxs :
case pcxt :
case pcxt_ :
srhash_type = SRHASH_PCXST ;
break ;
case pcxl :
srhash_type = SRHASH_PCXL ;
break ;
case pcxl2 : /* pcxl2 doesn't support space register hashing */
return ;
default : /* Currently all PA2.0 machines use the same ins. sequence */
srhash_type = SRHASH_PA20 ;
break ;
}
disable_sr_hashing_asm ( srhash_type ) ;
2006-06-16 18:20:00 -04:00
retval = pdc_spaceid_bits ( & space_bits ) ;
/* If this procedure isn't implemented, don't panic. */
if ( retval < 0 & & retval ! = PDC_BAD_OPTION )
panic ( " pdc_spaceid_bits call failed. \n " ) ;
if ( space_bits ! = 0 )
panic ( " SpaceID hashing is still on! \n " ) ;
2005-04-16 15:20:36 -07:00
}
2006-12-12 05:51:54 -08:00
static inline void
2010-12-22 10:22:11 -06:00
__flush_cache_page ( struct vm_area_struct * vma , unsigned long vmaddr ,
unsigned long physaddr )
2006-12-12 05:51:54 -08:00
{
2022-03-18 22:59:59 +01:00
if ( ! static_branch_likely ( & parisc_has_cache ) )
return ;
2013-02-02 23:41:24 +00:00
preempt_disable ( ) ;
2010-12-22 10:22:11 -06:00
flush_dcache_page_asm ( physaddr , vmaddr ) ;
if ( vma - > vm_flags & VM_EXEC )
flush_icache_page_asm ( physaddr , vmaddr ) ;
2013-02-02 23:41:24 +00:00
preempt_enable ( ) ;
2006-12-12 05:51:54 -08:00
}
parisc: Rewrite cache flush code for PA8800/PA8900
Originally, I was convinced that we needed to use tmpalias flushes
everwhere, for both user and kernel flushes. However, when I modified
flush_kernel_dcache_page_addr, to use a tmpalias flush, my c8000
would crash quite early when booting.
The PDC returns alias values of 0 for the icache and dcache. This
indicates that either the alias boundary is greater than 16MB or
equivalent aliasing doesn't work. I modified the tmpalias code to
make it easy to try alternate boundaries. I tried boundaries up to
128MB but still kernel tmpalias flushes didn't work on c8000.
This led me to conclude that tmpalias flushes don't work on PA8800
and PA8900 machines, and that we needed to flush directly using the
virtual address of user and kernel pages. This is likely the major
cause of instability on the c8000 and rp34xx machines.
Flushing user pages requires doing a temporary context switch as we
have to flush pages that don't belong to the current context. Further,
we have to deal with pages that aren't present. If a page isn't
present, the flush instructions fault on every line.
Other code has been rearranged and simplified based on testing. For
example, I introduced a flush_cache_dup_mm routine. flush_cache_mm
and flush_cache_dup_mm differ in that flush_cache_mm calls
purge_cache_pages and flush_cache_dup_mm calls flush_cache_pages.
In some implementations, pdc is more efficient than fdc. Based on
my testing, I don't believe there's any performance benefit on the
c8000.
Signed-off-by: John David Anglin <dave.anglin@bell.net>
Signed-off-by: Helge Deller <deller@gmx.de>
2022-05-16 15:14:47 +00:00
static void flush_user_cache_page ( struct vm_area_struct * vma , unsigned long vmaddr )
2018-10-19 20:48:12 -04:00
{
parisc: Rewrite cache flush code for PA8800/PA8900
Originally, I was convinced that we needed to use tmpalias flushes
everwhere, for both user and kernel flushes. However, when I modified
flush_kernel_dcache_page_addr, to use a tmpalias flush, my c8000
would crash quite early when booting.
The PDC returns alias values of 0 for the icache and dcache. This
indicates that either the alias boundary is greater than 16MB or
equivalent aliasing doesn't work. I modified the tmpalias code to
make it easy to try alternate boundaries. I tried boundaries up to
128MB but still kernel tmpalias flushes didn't work on c8000.
This led me to conclude that tmpalias flushes don't work on PA8800
and PA8900 machines, and that we needed to flush directly using the
virtual address of user and kernel pages. This is likely the major
cause of instability on the c8000 and rp34xx machines.
Flushing user pages requires doing a temporary context switch as we
have to flush pages that don't belong to the current context. Further,
we have to deal with pages that aren't present. If a page isn't
present, the flush instructions fault on every line.
Other code has been rearranged and simplified based on testing. For
example, I introduced a flush_cache_dup_mm routine. flush_cache_mm
and flush_cache_dup_mm differ in that flush_cache_mm calls
purge_cache_pages and flush_cache_dup_mm calls flush_cache_pages.
In some implementations, pdc is more efficient than fdc. Based on
my testing, I don't believe there's any performance benefit on the
c8000.
Signed-off-by: John David Anglin <dave.anglin@bell.net>
Signed-off-by: Helge Deller <deller@gmx.de>
2022-05-16 15:14:47 +00:00
unsigned long flags , space , pgd , prot ;
# ifdef CONFIG_TLB_PTLOCK
unsigned long pgd_lock ;
# endif
vmaddr & = PAGE_MASK ;
2018-10-19 20:48:12 -04:00
preempt_disable ( ) ;
parisc: Rewrite cache flush code for PA8800/PA8900
Originally, I was convinced that we needed to use tmpalias flushes
everwhere, for both user and kernel flushes. However, when I modified
flush_kernel_dcache_page_addr, to use a tmpalias flush, my c8000
would crash quite early when booting.
The PDC returns alias values of 0 for the icache and dcache. This
indicates that either the alias boundary is greater than 16MB or
equivalent aliasing doesn't work. I modified the tmpalias code to
make it easy to try alternate boundaries. I tried boundaries up to
128MB but still kernel tmpalias flushes didn't work on c8000.
This led me to conclude that tmpalias flushes don't work on PA8800
and PA8900 machines, and that we needed to flush directly using the
virtual address of user and kernel pages. This is likely the major
cause of instability on the c8000 and rp34xx machines.
Flushing user pages requires doing a temporary context switch as we
have to flush pages that don't belong to the current context. Further,
we have to deal with pages that aren't present. If a page isn't
present, the flush instructions fault on every line.
Other code has been rearranged and simplified based on testing. For
example, I introduced a flush_cache_dup_mm routine. flush_cache_mm
and flush_cache_dup_mm differ in that flush_cache_mm calls
purge_cache_pages and flush_cache_dup_mm calls flush_cache_pages.
In some implementations, pdc is more efficient than fdc. Based on
my testing, I don't believe there's any performance benefit on the
c8000.
Signed-off-by: John David Anglin <dave.anglin@bell.net>
Signed-off-by: Helge Deller <deller@gmx.de>
2022-05-16 15:14:47 +00:00
/* Set context for flush */
local_irq_save ( flags ) ;
prot = mfctl ( 8 ) ;
space = mfsp ( SR_USER ) ;
pgd = mfctl ( 25 ) ;
# ifdef CONFIG_TLB_PTLOCK
pgd_lock = mfctl ( 28 ) ;
# endif
switch_mm_irqs_off ( NULL , vma - > vm_mm , NULL ) ;
local_irq_restore ( flags ) ;
flush_user_dcache_range_asm ( vmaddr , vmaddr + PAGE_SIZE ) ;
2018-10-19 20:48:12 -04:00
if ( vma - > vm_flags & VM_EXEC )
parisc: Rewrite cache flush code for PA8800/PA8900
Originally, I was convinced that we needed to use tmpalias flushes
everwhere, for both user and kernel flushes. However, when I modified
flush_kernel_dcache_page_addr, to use a tmpalias flush, my c8000
would crash quite early when booting.
The PDC returns alias values of 0 for the icache and dcache. This
indicates that either the alias boundary is greater than 16MB or
equivalent aliasing doesn't work. I modified the tmpalias code to
make it easy to try alternate boundaries. I tried boundaries up to
128MB but still kernel tmpalias flushes didn't work on c8000.
This led me to conclude that tmpalias flushes don't work on PA8800
and PA8900 machines, and that we needed to flush directly using the
virtual address of user and kernel pages. This is likely the major
cause of instability on the c8000 and rp34xx machines.
Flushing user pages requires doing a temporary context switch as we
have to flush pages that don't belong to the current context. Further,
we have to deal with pages that aren't present. If a page isn't
present, the flush instructions fault on every line.
Other code has been rearranged and simplified based on testing. For
example, I introduced a flush_cache_dup_mm routine. flush_cache_mm
and flush_cache_dup_mm differ in that flush_cache_mm calls
purge_cache_pages and flush_cache_dup_mm calls flush_cache_pages.
In some implementations, pdc is more efficient than fdc. Based on
my testing, I don't believe there's any performance benefit on the
c8000.
Signed-off-by: John David Anglin <dave.anglin@bell.net>
Signed-off-by: Helge Deller <deller@gmx.de>
2022-05-16 15:14:47 +00:00
flush_user_icache_range_asm ( vmaddr , vmaddr + PAGE_SIZE ) ;
flush_tlb_page ( vma , vmaddr ) ;
/* Restore previous context */
local_irq_save ( flags ) ;
# ifdef CONFIG_TLB_PTLOCK
mtctl ( pgd_lock , 28 ) ;
# endif
mtctl ( pgd , 25 ) ;
mtsp ( space , SR_USER ) ;
mtctl ( prot , 8 ) ;
local_irq_restore ( flags ) ;
2018-10-19 20:48:12 -04:00
preempt_enable ( ) ;
}
parisc: Rewrite cache flush code for PA8800/PA8900
Originally, I was convinced that we needed to use tmpalias flushes
everwhere, for both user and kernel flushes. However, when I modified
flush_kernel_dcache_page_addr, to use a tmpalias flush, my c8000
would crash quite early when booting.
The PDC returns alias values of 0 for the icache and dcache. This
indicates that either the alias boundary is greater than 16MB or
equivalent aliasing doesn't work. I modified the tmpalias code to
make it easy to try alternate boundaries. I tried boundaries up to
128MB but still kernel tmpalias flushes didn't work on c8000.
This led me to conclude that tmpalias flushes don't work on PA8800
and PA8900 machines, and that we needed to flush directly using the
virtual address of user and kernel pages. This is likely the major
cause of instability on the c8000 and rp34xx machines.
Flushing user pages requires doing a temporary context switch as we
have to flush pages that don't belong to the current context. Further,
we have to deal with pages that aren't present. If a page isn't
present, the flush instructions fault on every line.
Other code has been rearranged and simplified based on testing. For
example, I introduced a flush_cache_dup_mm routine. flush_cache_mm
and flush_cache_dup_mm differ in that flush_cache_mm calls
purge_cache_pages and flush_cache_dup_mm calls flush_cache_pages.
In some implementations, pdc is more efficient than fdc. Based on
my testing, I don't believe there's any performance benefit on the
c8000.
Signed-off-by: John David Anglin <dave.anglin@bell.net>
Signed-off-by: Helge Deller <deller@gmx.de>
2022-05-16 15:14:47 +00:00
static inline pte_t * get_ptep ( struct mm_struct * mm , unsigned long addr )
{
pte_t * ptep = NULL ;
pgd_t * pgd = mm - > pgd ;
p4d_t * p4d ;
pud_t * pud ;
pmd_t * pmd ;
if ( ! pgd_none ( * pgd ) ) {
p4d = p4d_offset ( pgd , addr ) ;
if ( ! p4d_none ( * p4d ) ) {
pud = pud_offset ( p4d , addr ) ;
if ( ! pud_none ( * pud ) ) {
pmd = pmd_offset ( pud , addr ) ;
if ( ! pmd_none ( * pmd ) )
ptep = pte_offset_map ( pmd , addr ) ;
}
}
}
return ptep ;
}
static inline bool pte_needs_flush ( pte_t pte )
{
return ( pte_val ( pte ) & ( _PAGE_PRESENT | _PAGE_ACCESSED | _PAGE_NO_CACHE ) )
= = ( _PAGE_PRESENT | _PAGE_ACCESSED ) ;
}
2005-04-16 15:20:36 -07:00
void flush_dcache_page ( struct page * page )
{
mm: fix races between swapoff and flush dcache
Thanks to commit 4b3ef9daa4fc ("mm/swap: split swap cache into 64MB
trunks"), after swapoff the address_space associated with the swap
device will be freed. So page_mapping() users which may touch the
address_space need some kind of mechanism to prevent the address_space
from being freed during accessing.
The dcache flushing functions (flush_dcache_page(), etc) in architecture
specific code may access the address_space of swap device for anonymous
pages in swap cache via page_mapping() function. But in some cases
there are no mechanisms to prevent the swap device from being swapoff,
for example,
CPU1 CPU2
__get_user_pages() swapoff()
flush_dcache_page()
mapping = page_mapping()
... exit_swap_address_space()
... kvfree(spaces)
mapping_mapped(mapping)
The address space may be accessed after being freed.
But from cachetlb.txt and Russell King, flush_dcache_page() only care
about file cache pages, for anonymous pages, flush_anon_page() should be
used. The implementation of flush_dcache_page() in all architectures
follows this too. They will check whether page_mapping() is NULL and
whether mapping_mapped() is true to determine whether to flush the
dcache immediately. And they will use interval tree (mapping->i_mmap)
to find all user space mappings. While mapping_mapped() and
mapping->i_mmap isn't used by anonymous pages in swap cache at all.
So, to fix the race between swapoff and flush dcache, __page_mapping()
is add to return the address_space for file cache pages and NULL
otherwise. All page_mapping() invoking in flush dcache functions are
replaced with page_mapping_file().
[akpm@linux-foundation.org: simplify page_mapping_file(), per Mike]
Link: http://lkml.kernel.org/r/20180305083634.15174-1-ying.huang@intel.com
Signed-off-by: "Huang, Ying" <ying.huang@intel.com>
Reviewed-by: Andrew Morton <akpm@linux-foundation.org>
Cc: Minchan Kim <minchan@kernel.org>
Cc: Michal Hocko <mhocko@suse.com>
Cc: Johannes Weiner <hannes@cmpxchg.org>
Cc: Mel Gorman <mgorman@techsingularity.net>
Cc: Dave Hansen <dave.hansen@intel.com>
Cc: Chen Liqin <liqin.linux@gmail.com>
Cc: Russell King <linux@armlinux.org.uk>
Cc: Yoshinori Sato <ysato@users.sourceforge.jp>
Cc: "James E.J. Bottomley" <jejb@parisc-linux.org>
Cc: Guan Xuetao <gxt@mprc.pku.edu.cn>
Cc: "David S. Miller" <davem@davemloft.net>
Cc: Chris Zankel <chris@zankel.net>
Cc: Vineet Gupta <vgupta@synopsys.com>
Cc: Ley Foon Tan <lftan@altera.com>
Cc: Ralf Baechle <ralf@linux-mips.org>
Cc: Andi Kleen <ak@linux.intel.com>
Cc: Mike Rapoport <rppt@linux.vnet.ibm.com>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
2018-04-05 16:24:39 -07:00
struct address_space * mapping = page_mapping_file ( page ) ;
2005-04-16 15:20:36 -07:00
struct vm_area_struct * mpnt ;
unsigned long offset ;
2010-12-22 10:22:11 -06:00
unsigned long addr , old_addr = 0 ;
parisc: Rewrite cache flush code for PA8800/PA8900
Originally, I was convinced that we needed to use tmpalias flushes
everwhere, for both user and kernel flushes. However, when I modified
flush_kernel_dcache_page_addr, to use a tmpalias flush, my c8000
would crash quite early when booting.
The PDC returns alias values of 0 for the icache and dcache. This
indicates that either the alias boundary is greater than 16MB or
equivalent aliasing doesn't work. I modified the tmpalias code to
make it easy to try alternate boundaries. I tried boundaries up to
128MB but still kernel tmpalias flushes didn't work on c8000.
This led me to conclude that tmpalias flushes don't work on PA8800
and PA8900 machines, and that we needed to flush directly using the
virtual address of user and kernel pages. This is likely the major
cause of instability on the c8000 and rp34xx machines.
Flushing user pages requires doing a temporary context switch as we
have to flush pages that don't belong to the current context. Further,
we have to deal with pages that aren't present. If a page isn't
present, the flush instructions fault on every line.
Other code has been rearranged and simplified based on testing. For
example, I introduced a flush_cache_dup_mm routine. flush_cache_mm
and flush_cache_dup_mm differ in that flush_cache_mm calls
purge_cache_pages and flush_cache_dup_mm calls flush_cache_pages.
In some implementations, pdc is more efficient than fdc. Based on
my testing, I don't believe there's any performance benefit on the
c8000.
Signed-off-by: John David Anglin <dave.anglin@bell.net>
Signed-off-by: Helge Deller <deller@gmx.de>
2022-05-16 15:14:47 +00:00
unsigned long count = 0 ;
2005-04-16 15:20:36 -07:00
pgoff_t pgoff ;
if ( mapping & & ! mapping_mapped ( mapping ) ) {
set_bit ( PG_dcache_dirty , & page - > flags ) ;
return ;
}
2021-09-02 14:56:36 -07:00
flush_kernel_dcache_page_addr ( page_address ( page ) ) ;
2005-04-16 15:20:36 -07:00
if ( ! mapping )
return ;
mm, fs: get rid of PAGE_CACHE_* and page_cache_{get,release} macros
PAGE_CACHE_{SIZE,SHIFT,MASK,ALIGN} macros were introduced *long* time
ago with promise that one day it will be possible to implement page
cache with bigger chunks than PAGE_SIZE.
This promise never materialized. And unlikely will.
We have many places where PAGE_CACHE_SIZE assumed to be equal to
PAGE_SIZE. And it's constant source of confusion on whether
PAGE_CACHE_* or PAGE_* constant should be used in a particular case,
especially on the border between fs and mm.
Global switching to PAGE_CACHE_SIZE != PAGE_SIZE would cause to much
breakage to be doable.
Let's stop pretending that pages in page cache are special. They are
not.
The changes are pretty straight-forward:
- <foo> << (PAGE_CACHE_SHIFT - PAGE_SHIFT) -> <foo>;
- <foo> >> (PAGE_CACHE_SHIFT - PAGE_SHIFT) -> <foo>;
- PAGE_CACHE_{SIZE,SHIFT,MASK,ALIGN} -> PAGE_{SIZE,SHIFT,MASK,ALIGN};
- page_cache_get() -> get_page();
- page_cache_release() -> put_page();
This patch contains automated changes generated with coccinelle using
script below. For some reason, coccinelle doesn't patch header files.
I've called spatch for them manually.
The only adjustment after coccinelle is revert of changes to
PAGE_CAHCE_ALIGN definition: we are going to drop it later.
There are few places in the code where coccinelle didn't reach. I'll
fix them manually in a separate patch. Comments and documentation also
will be addressed with the separate patch.
virtual patch
@@
expression E;
@@
- E << (PAGE_CACHE_SHIFT - PAGE_SHIFT)
+ E
@@
expression E;
@@
- E >> (PAGE_CACHE_SHIFT - PAGE_SHIFT)
+ E
@@
@@
- PAGE_CACHE_SHIFT
+ PAGE_SHIFT
@@
@@
- PAGE_CACHE_SIZE
+ PAGE_SIZE
@@
@@
- PAGE_CACHE_MASK
+ PAGE_MASK
@@
expression E;
@@
- PAGE_CACHE_ALIGN(E)
+ PAGE_ALIGN(E)
@@
expression E;
@@
- page_cache_get(E)
+ get_page(E)
@@
expression E;
@@
- page_cache_release(E)
+ put_page(E)
Signed-off-by: Kirill A. Shutemov <kirill.shutemov@linux.intel.com>
Acked-by: Michal Hocko <mhocko@suse.com>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
2016-04-01 15:29:47 +03:00
pgoff = page - > index ;
2005-04-16 15:20:36 -07:00
parisc: Rewrite cache flush code for PA8800/PA8900
Originally, I was convinced that we needed to use tmpalias flushes
everwhere, for both user and kernel flushes. However, when I modified
flush_kernel_dcache_page_addr, to use a tmpalias flush, my c8000
would crash quite early when booting.
The PDC returns alias values of 0 for the icache and dcache. This
indicates that either the alias boundary is greater than 16MB or
equivalent aliasing doesn't work. I modified the tmpalias code to
make it easy to try alternate boundaries. I tried boundaries up to
128MB but still kernel tmpalias flushes didn't work on c8000.
This led me to conclude that tmpalias flushes don't work on PA8800
and PA8900 machines, and that we needed to flush directly using the
virtual address of user and kernel pages. This is likely the major
cause of instability on the c8000 and rp34xx machines.
Flushing user pages requires doing a temporary context switch as we
have to flush pages that don't belong to the current context. Further,
we have to deal with pages that aren't present. If a page isn't
present, the flush instructions fault on every line.
Other code has been rearranged and simplified based on testing. For
example, I introduced a flush_cache_dup_mm routine. flush_cache_mm
and flush_cache_dup_mm differ in that flush_cache_mm calls
purge_cache_pages and flush_cache_dup_mm calls flush_cache_pages.
In some implementations, pdc is more efficient than fdc. Based on
my testing, I don't believe there's any performance benefit on the
c8000.
Signed-off-by: John David Anglin <dave.anglin@bell.net>
Signed-off-by: Helge Deller <deller@gmx.de>
2022-05-16 15:14:47 +00:00
/*
* We have carefully arranged in arch_get_unmapped_area ( ) that
2005-04-16 15:20:36 -07:00
* * any * mappings of a file are always congruently mapped ( whether
* declared as MAP_PRIVATE or MAP_SHARED ) , so we only need
parisc: Rewrite cache flush code for PA8800/PA8900
Originally, I was convinced that we needed to use tmpalias flushes
everwhere, for both user and kernel flushes. However, when I modified
flush_kernel_dcache_page_addr, to use a tmpalias flush, my c8000
would crash quite early when booting.
The PDC returns alias values of 0 for the icache and dcache. This
indicates that either the alias boundary is greater than 16MB or
equivalent aliasing doesn't work. I modified the tmpalias code to
make it easy to try alternate boundaries. I tried boundaries up to
128MB but still kernel tmpalias flushes didn't work on c8000.
This led me to conclude that tmpalias flushes don't work on PA8800
and PA8900 machines, and that we needed to flush directly using the
virtual address of user and kernel pages. This is likely the major
cause of instability on the c8000 and rp34xx machines.
Flushing user pages requires doing a temporary context switch as we
have to flush pages that don't belong to the current context. Further,
we have to deal with pages that aren't present. If a page isn't
present, the flush instructions fault on every line.
Other code has been rearranged and simplified based on testing. For
example, I introduced a flush_cache_dup_mm routine. flush_cache_mm
and flush_cache_dup_mm differ in that flush_cache_mm calls
purge_cache_pages and flush_cache_dup_mm calls flush_cache_pages.
In some implementations, pdc is more efficient than fdc. Based on
my testing, I don't believe there's any performance benefit on the
c8000.
Signed-off-by: John David Anglin <dave.anglin@bell.net>
Signed-off-by: Helge Deller <deller@gmx.de>
2022-05-16 15:14:47 +00:00
* to flush one address here for them all to become coherent
* on machines that support equivalent aliasing
*/
2005-04-16 15:20:36 -07:00
flush_dcache_mmap_lock ( mapping ) ;
2012-10-08 16:31:25 -07:00
vma_interval_tree_foreach ( mpnt , & mapping - > i_mmap , pgoff , pgoff ) {
2005-04-16 15:20:36 -07:00
offset = ( pgoff - mpnt - > vm_pgoff ) < < PAGE_SHIFT ;
addr = mpnt - > vm_start + offset ;
parisc: Rewrite cache flush code for PA8800/PA8900
Originally, I was convinced that we needed to use tmpalias flushes
everwhere, for both user and kernel flushes. However, when I modified
flush_kernel_dcache_page_addr, to use a tmpalias flush, my c8000
would crash quite early when booting.
The PDC returns alias values of 0 for the icache and dcache. This
indicates that either the alias boundary is greater than 16MB or
equivalent aliasing doesn't work. I modified the tmpalias code to
make it easy to try alternate boundaries. I tried boundaries up to
128MB but still kernel tmpalias flushes didn't work on c8000.
This led me to conclude that tmpalias flushes don't work on PA8800
and PA8900 machines, and that we needed to flush directly using the
virtual address of user and kernel pages. This is likely the major
cause of instability on the c8000 and rp34xx machines.
Flushing user pages requires doing a temporary context switch as we
have to flush pages that don't belong to the current context. Further,
we have to deal with pages that aren't present. If a page isn't
present, the flush instructions fault on every line.
Other code has been rearranged and simplified based on testing. For
example, I introduced a flush_cache_dup_mm routine. flush_cache_mm
and flush_cache_dup_mm differ in that flush_cache_mm calls
purge_cache_pages and flush_cache_dup_mm calls flush_cache_pages.
In some implementations, pdc is more efficient than fdc. Based on
my testing, I don't believe there's any performance benefit on the
c8000.
Signed-off-by: John David Anglin <dave.anglin@bell.net>
Signed-off-by: Helge Deller <deller@gmx.de>
2022-05-16 15:14:47 +00:00
if ( parisc_requires_coherency ( ) ) {
pte_t * ptep ;
2005-04-16 15:20:36 -07:00
parisc: Rewrite cache flush code for PA8800/PA8900
Originally, I was convinced that we needed to use tmpalias flushes
everwhere, for both user and kernel flushes. However, when I modified
flush_kernel_dcache_page_addr, to use a tmpalias flush, my c8000
would crash quite early when booting.
The PDC returns alias values of 0 for the icache and dcache. This
indicates that either the alias boundary is greater than 16MB or
equivalent aliasing doesn't work. I modified the tmpalias code to
make it easy to try alternate boundaries. I tried boundaries up to
128MB but still kernel tmpalias flushes didn't work on c8000.
This led me to conclude that tmpalias flushes don't work on PA8800
and PA8900 machines, and that we needed to flush directly using the
virtual address of user and kernel pages. This is likely the major
cause of instability on the c8000 and rp34xx machines.
Flushing user pages requires doing a temporary context switch as we
have to flush pages that don't belong to the current context. Further,
we have to deal with pages that aren't present. If a page isn't
present, the flush instructions fault on every line.
Other code has been rearranged and simplified based on testing. For
example, I introduced a flush_cache_dup_mm routine. flush_cache_mm
and flush_cache_dup_mm differ in that flush_cache_mm calls
purge_cache_pages and flush_cache_dup_mm calls flush_cache_pages.
In some implementations, pdc is more efficient than fdc. Based on
my testing, I don't believe there's any performance benefit on the
c8000.
Signed-off-by: John David Anglin <dave.anglin@bell.net>
Signed-off-by: Helge Deller <deller@gmx.de>
2022-05-16 15:14:47 +00:00
ptep = get_ptep ( mpnt - > vm_mm , addr ) ;
if ( ptep & & pte_needs_flush ( * ptep ) )
flush_user_cache_page ( mpnt , addr ) ;
} else {
/*
* The TLB is the engine of coherence on parisc :
* The CPU is entitled to speculate any page
* with a TLB mapping , so here we kill the
* mapping then flush the page along a special
* flush only alias mapping . This guarantees that
* the page is no - longer in the cache for any
* process and nor may it be speculatively read
* in ( until the user or kernel specifically
* accesses it , of course )
*/
flush_tlb_page ( mpnt , addr ) ;
if ( old_addr = = 0 | | ( old_addr & ( SHM_COLOUR - 1 ) )
! = ( addr & ( SHM_COLOUR - 1 ) ) ) {
__flush_cache_page ( mpnt , addr , page_to_phys ( page ) ) ;
/*
* Software is allowed to have any number
* of private mappings to a page .
*/
if ( ! ( mpnt - > vm_flags & VM_SHARED ) )
continue ;
if ( old_addr )
pr_err ( " INEQUIVALENT ALIASES 0x%lx and 0x%lx in file %pD \n " ,
old_addr , addr , mpnt - > vm_file ) ;
old_addr = addr ;
}
2005-10-29 18:16:36 -07:00
}
parisc: Rewrite cache flush code for PA8800/PA8900
Originally, I was convinced that we needed to use tmpalias flushes
everwhere, for both user and kernel flushes. However, when I modified
flush_kernel_dcache_page_addr, to use a tmpalias flush, my c8000
would crash quite early when booting.
The PDC returns alias values of 0 for the icache and dcache. This
indicates that either the alias boundary is greater than 16MB or
equivalent aliasing doesn't work. I modified the tmpalias code to
make it easy to try alternate boundaries. I tried boundaries up to
128MB but still kernel tmpalias flushes didn't work on c8000.
This led me to conclude that tmpalias flushes don't work on PA8800
and PA8900 machines, and that we needed to flush directly using the
virtual address of user and kernel pages. This is likely the major
cause of instability on the c8000 and rp34xx machines.
Flushing user pages requires doing a temporary context switch as we
have to flush pages that don't belong to the current context. Further,
we have to deal with pages that aren't present. If a page isn't
present, the flush instructions fault on every line.
Other code has been rearranged and simplified based on testing. For
example, I introduced a flush_cache_dup_mm routine. flush_cache_mm
and flush_cache_dup_mm differ in that flush_cache_mm calls
purge_cache_pages and flush_cache_dup_mm calls flush_cache_pages.
In some implementations, pdc is more efficient than fdc. Based on
my testing, I don't believe there's any performance benefit on the
c8000.
Signed-off-by: John David Anglin <dave.anglin@bell.net>
Signed-off-by: Helge Deller <deller@gmx.de>
2022-05-16 15:14:47 +00:00
WARN_ON ( + + count = = 4096 ) ;
2005-04-16 15:20:36 -07:00
}
flush_dcache_mmap_unlock ( mapping ) ;
}
EXPORT_SYMBOL ( flush_dcache_page ) ;
/* Defined in arch/parisc/kernel/pacache.S */
EXPORT_SYMBOL ( flush_kernel_dcache_range_asm ) ;
EXPORT_SYMBOL ( flush_kernel_icache_range_asm ) ;
# define FLUSH_THRESHOLD 0x80000 /* 0.5MB */
2019-05-10 20:47:11 +02:00
static unsigned long parisc_cache_flush_threshold __ro_after_init = FLUSH_THRESHOLD ;
2015-07-01 17:18:37 -04:00
2018-10-16 20:49:56 -04:00
# define FLUSH_TLB_THRESHOLD (16*1024) /* 16 KiB minimum TLB threshold */
2020-10-02 21:28:31 +02:00
static unsigned long parisc_tlb_flush_threshold __ro_after_init = ~ 0UL ;
2005-04-16 15:20:36 -07:00
2006-12-12 05:51:54 -08:00
void __init parisc_setup_cache_timing ( void )
2005-04-16 15:20:36 -07:00
{
unsigned long rangetime , alltime ;
2020-10-02 21:28:31 +02:00
unsigned long size ;
parisc: Rewrite cache flush code for PA8800/PA8900
Originally, I was convinced that we needed to use tmpalias flushes
everwhere, for both user and kernel flushes. However, when I modified
flush_kernel_dcache_page_addr, to use a tmpalias flush, my c8000
would crash quite early when booting.
The PDC returns alias values of 0 for the icache and dcache. This
indicates that either the alias boundary is greater than 16MB or
equivalent aliasing doesn't work. I modified the tmpalias code to
make it easy to try alternate boundaries. I tried boundaries up to
128MB but still kernel tmpalias flushes didn't work on c8000.
This led me to conclude that tmpalias flushes don't work on PA8800
and PA8900 machines, and that we needed to flush directly using the
virtual address of user and kernel pages. This is likely the major
cause of instability on the c8000 and rp34xx machines.
Flushing user pages requires doing a temporary context switch as we
have to flush pages that don't belong to the current context. Further,
we have to deal with pages that aren't present. If a page isn't
present, the flush instructions fault on every line.
Other code has been rearranged and simplified based on testing. For
example, I introduced a flush_cache_dup_mm routine. flush_cache_mm
and flush_cache_dup_mm differ in that flush_cache_mm calls
purge_cache_pages and flush_cache_dup_mm calls flush_cache_pages.
In some implementations, pdc is more efficient than fdc. Based on
my testing, I don't believe there's any performance benefit on the
c8000.
Signed-off-by: John David Anglin <dave.anglin@bell.net>
Signed-off-by: Helge Deller <deller@gmx.de>
2022-05-16 15:14:47 +00:00
unsigned long threshold , threshold2 ;
2005-04-16 15:20:36 -07:00
alltime = mfctl ( 16 ) ;
flush_data_cache ( ) ;
alltime = mfctl ( 16 ) - alltime ;
2005-10-21 22:44:14 -04:00
size = ( unsigned long ) ( _end - _text ) ;
2005-04-16 15:20:36 -07:00
rangetime = mfctl ( 16 ) ;
2005-10-21 22:44:14 -04:00
flush_kernel_dcache_range ( ( unsigned long ) _text , size ) ;
2005-04-16 15:20:36 -07:00
rangetime = mfctl ( 16 ) - rangetime ;
printk ( KERN_DEBUG " Whole cache flush %lu cycles, flushing %lu bytes %lu cycles \n " ,
alltime , size , rangetime ) ;
parisc: Rewrite cache flush code for PA8800/PA8900
Originally, I was convinced that we needed to use tmpalias flushes
everwhere, for both user and kernel flushes. However, when I modified
flush_kernel_dcache_page_addr, to use a tmpalias flush, my c8000
would crash quite early when booting.
The PDC returns alias values of 0 for the icache and dcache. This
indicates that either the alias boundary is greater than 16MB or
equivalent aliasing doesn't work. I modified the tmpalias code to
make it easy to try alternate boundaries. I tried boundaries up to
128MB but still kernel tmpalias flushes didn't work on c8000.
This led me to conclude that tmpalias flushes don't work on PA8800
and PA8900 machines, and that we needed to flush directly using the
virtual address of user and kernel pages. This is likely the major
cause of instability on the c8000 and rp34xx machines.
Flushing user pages requires doing a temporary context switch as we
have to flush pages that don't belong to the current context. Further,
we have to deal with pages that aren't present. If a page isn't
present, the flush instructions fault on every line.
Other code has been rearranged and simplified based on testing. For
example, I introduced a flush_cache_dup_mm routine. flush_cache_mm
and flush_cache_dup_mm differ in that flush_cache_mm calls
purge_cache_pages and flush_cache_dup_mm calls flush_cache_pages.
In some implementations, pdc is more efficient than fdc. Based on
my testing, I don't believe there's any performance benefit on the
c8000.
Signed-off-by: John David Anglin <dave.anglin@bell.net>
Signed-off-by: Helge Deller <deller@gmx.de>
2022-05-16 15:14:47 +00:00
threshold = L1_CACHE_ALIGN ( ( unsigned long ) ( ( uint64_t ) size * alltime / rangetime ) ) ;
pr_info ( " Calculated flush threshold is %lu KiB \n " ,
threshold / 1024 ) ;
/*
* The threshold computed above isn ' t very reliable . The following
* heuristic works reasonably well on c8000 / rp3440 .
*/
threshold2 = cache_info . dc_size * num_online_cpus ( ) ;
parisc_cache_flush_threshold = threshold2 ;
parisc: Fix races in parisc_setup_cache_timing()
Helge reported to me the following startup crash:
[ 0.000000] Linux version 4.8.0-1-parisc64-smp (debian-kernel@lists.debian.org) (gcc version 5.4.1 20161019 (GCC) ) #1 SMP Debian 4.8.7-1 (2016-11-13)
[ 0.000000] The 64-bit Kernel has started...
[ 0.000000] Kernel default page size is 4 KB. Huge pages enabled with 1 MB physical and 2 MB virtual size.
[ 0.000000] Determining PDC firmware type: System Map.
[ 0.000000] model 9000/785/J5000
[ 0.000000] Total Memory: 2048 MB
[ 0.000000] Memory: 2018528K/2097152K available (9272K kernel code, 3053K rwdata, 1319K rodata, 1024K init, 840K bss, 78624K reserved, 0K cma-reserved)
[ 0.000000] virtual kernel memory layout:
[ 0.000000] vmalloc : 0x0000000000008000 - 0x000000003f000000 (1007 MB)
[ 0.000000] memory : 0x0000000040000000 - 0x00000000c0000000 (2048 MB)
[ 0.000000] .init : 0x0000000040100000 - 0x0000000040200000 (1024 kB)
[ 0.000000] .data : 0x0000000040b0e000 - 0x0000000040f533e0 (4372 kB)
[ 0.000000] .text : 0x0000000040200000 - 0x0000000040b0e000 (9272 kB)
[ 0.768910] Brought up 1 CPUs
[ 0.992465] NET: Registered protocol family 16
[ 2.429981] Releasing cpu 1 now, hpa=fffffffffffa2000
[ 2.635751] CPU(s): 2 out of 2 PA8500 (PCX-W) at 440.000000 MHz online
[ 2.726692] Setting cache flush threshold to 1024 kB
[ 2.729932] Not-handled unaligned insn 0x43ffff80
[ 2.798114] Setting TLB flush threshold to 140 kB
[ 2.928039] Unaligned handler failed, ret = -1
[ 3.000419] _______________________________
[ 3.000419] < Your System ate a SPARC! Gah! >
[ 3.000419] -------------------------------
[ 3.000419] \ ^__^
[ 3.000419] (__)\ )\/\
[ 3.000419] U ||----w |
[ 3.000419] || ||
[ 9.340055] CPU: 1 PID: 0 Comm: swapper/1 Not tainted 4.8.0-1-parisc64-smp #1 Debian 4.8.7-1
[ 9.448082] task: 00000000bfd48060 task.stack: 00000000bfd50000
[ 9.528040]
[ 10.760029] IASQ: 0000000000000000 0000000000000000 IAOQ: 000000004025d154 000000004025d158
[ 10.868052] IIR: 43ffff80 ISR: 0000000000340000 IOR: 000001ff54150960
[ 10.960029] CPU: 1 CR30: 00000000bfd50000 CR31: 0000000011111111
[ 11.052057] ORIG_R28: 000000004021e3b4
[ 11.100045] IAOQ[0]: irq_exit+0x94/0x120
[ 11.152062] IAOQ[1]: irq_exit+0x98/0x120
[ 11.208031] RP(r2): irq_exit+0xb8/0x120
[ 11.256074] Backtrace:
[ 11.288067] [<00000000402cd944>] cpu_startup_entry+0x1e4/0x598
[ 11.368058] [<0000000040109528>] smp_callin+0x2c0/0x2f0
[ 11.436308] [<00000000402b53fc>] update_curr+0x18c/0x2d0
[ 11.508055] [<00000000402b73b8>] dequeue_entity+0x2c0/0x1030
[ 11.584040] [<00000000402b3cc0>] set_next_entity+0x80/0xd30
[ 11.660069] [<00000000402c1594>] pick_next_task_fair+0x614/0x720
[ 11.740085] [<000000004020dd34>] __schedule+0x394/0xa60
[ 11.808054] [<000000004020e488>] schedule+0x88/0x118
[ 11.876039] [<0000000040283d3c>] rescuer_thread+0x4d4/0x5b0
[ 11.948090] [<000000004028fc4c>] kthread+0x1ec/0x248
[ 12.016053] [<0000000040205020>] end_fault_vector+0x20/0xc0
[ 12.092239] [<00000000402050c0>] _switch_to_ret+0x0/0xf40
[ 12.164044]
[ 12.184036] CPU: 1 PID: 0 Comm: swapper/1 Not tainted 4.8.0-1-parisc64-smp #1 Debian 4.8.7-1
[ 12.244040] Backtrace:
[ 12.244040] [<000000004021c480>] show_stack+0x68/0x80
[ 12.244040] [<00000000406f332c>] dump_stack+0xec/0x168
[ 12.244040] [<000000004021c74c>] die_if_kernel+0x25c/0x430
[ 12.244040] [<000000004022d320>] handle_unaligned+0xb48/0xb50
[ 12.244040]
[ 12.632066] ---[ end trace 9ca05a7215c7bbb2 ]---
[ 12.692036] Kernel panic - not syncing: Attempted to kill the idle task!
We have the insn 0x43ffff80 in IIR but from IAOQ we should have:
4025d150: 0f f3 20 df ldd,s r19(r31),r31
4025d154: 0f 9f 00 9c ldw r31(ret0),ret0
4025d158: bf 80 20 58 cmpb,*<> r0,ret0,4025d18c <irq_exit+0xcc>
Cpu0 has just completed running parisc_setup_cache_timing:
[ 2.429981] Releasing cpu 1 now, hpa=fffffffffffa2000
[ 2.635751] CPU(s): 2 out of 2 PA8500 (PCX-W) at 440.000000 MHz online
[ 2.726692] Setting cache flush threshold to 1024 kB
[ 2.729932] Not-handled unaligned insn 0x43ffff80
[ 2.798114] Setting TLB flush threshold to 140 kB
[ 2.928039] Unaligned handler failed, ret = -1
From the backtrace, cpu1 is in smp_callin:
void __init smp_callin(void)
{
int slave_id = cpu_now_booting;
smp_cpu_init(slave_id);
preempt_disable();
flush_cache_all_local(); /* start with known state */
flush_tlb_all_local(NULL);
local_irq_enable(); /* Interrupts have been off until now */
cpu_startup_entry(CPUHP_AP_ONLINE_IDLE);
So, it has just flushed its caches and the TLB. It would seem either the
flushes in parisc_setup_cache_timing or smp_callin have corrupted kernel
memory.
The attached patch reworks parisc_setup_cache_timing to remove the races
in setting the cache and TLB flush thresholds. It also corrects the
number of bytes flushed in the TLB calculation.
The patch flushes the cache and TLB on cpu0 before starting the
secondary processors so that they are started from a known state.
Tested with a few reboots on c8000.
Signed-off-by: John David Anglin <dave.anglin@bell.net>
Cc: <stable@vger.kernel.org> # v3.18+
Signed-off-by: Helge Deller <deller@gmx.de>
2016-11-20 21:12:36 -05:00
printk ( KERN_INFO " Cache flush threshold set to %lu KiB \n " ,
2015-07-01 17:18:37 -04:00
parisc_cache_flush_threshold / 1024 ) ;
/* calculate TLB flush threshold */
2016-12-08 21:00:46 +01:00
/* On SMP machines, skip the TLB measure of kernel text which
* has been mapped as huge pages . */
if ( num_online_cpus ( ) > 1 & & ! parisc_requires_coherency ( ) ) {
threshold = max ( cache_info . it_size , cache_info . dt_size ) ;
threshold * = PAGE_SIZE ;
threshold / = num_online_cpus ( ) ;
goto set_tlb_threshold ;
}
2020-10-02 21:28:31 +02:00
size = ( unsigned long ) _end - ( unsigned long ) _text ;
2015-07-01 17:18:37 -04:00
rangetime = mfctl ( 16 ) ;
2020-10-02 21:28:31 +02:00
flush_tlb_kernel_range ( ( unsigned long ) _text , ( unsigned long ) _end ) ;
2015-07-01 17:18:37 -04:00
rangetime = mfctl ( 16 ) - rangetime ;
2018-10-16 20:49:56 -04:00
alltime = mfctl ( 16 ) ;
flush_tlb_all ( ) ;
alltime = mfctl ( 16 ) - alltime ;
printk ( KERN_INFO " Whole TLB flush %lu cycles, Range flush %lu bytes %lu cycles \n " ,
2015-07-01 17:18:37 -04:00
alltime , size , rangetime ) ;
2018-10-16 20:49:56 -04:00
threshold = PAGE_ALIGN ( ( num_online_cpus ( ) * size * alltime ) / rangetime ) ;
printk ( KERN_INFO " Calculated TLB flush threshold %lu KiB \n " ,
threshold / 1024 ) ;
2016-12-08 21:00:46 +01:00
set_tlb_threshold :
2020-10-02 21:28:31 +02:00
if ( threshold > FLUSH_TLB_THRESHOLD )
parisc: Fix races in parisc_setup_cache_timing()
Helge reported to me the following startup crash:
[ 0.000000] Linux version 4.8.0-1-parisc64-smp (debian-kernel@lists.debian.org) (gcc version 5.4.1 20161019 (GCC) ) #1 SMP Debian 4.8.7-1 (2016-11-13)
[ 0.000000] The 64-bit Kernel has started...
[ 0.000000] Kernel default page size is 4 KB. Huge pages enabled with 1 MB physical and 2 MB virtual size.
[ 0.000000] Determining PDC firmware type: System Map.
[ 0.000000] model 9000/785/J5000
[ 0.000000] Total Memory: 2048 MB
[ 0.000000] Memory: 2018528K/2097152K available (9272K kernel code, 3053K rwdata, 1319K rodata, 1024K init, 840K bss, 78624K reserved, 0K cma-reserved)
[ 0.000000] virtual kernel memory layout:
[ 0.000000] vmalloc : 0x0000000000008000 - 0x000000003f000000 (1007 MB)
[ 0.000000] memory : 0x0000000040000000 - 0x00000000c0000000 (2048 MB)
[ 0.000000] .init : 0x0000000040100000 - 0x0000000040200000 (1024 kB)
[ 0.000000] .data : 0x0000000040b0e000 - 0x0000000040f533e0 (4372 kB)
[ 0.000000] .text : 0x0000000040200000 - 0x0000000040b0e000 (9272 kB)
[ 0.768910] Brought up 1 CPUs
[ 0.992465] NET: Registered protocol family 16
[ 2.429981] Releasing cpu 1 now, hpa=fffffffffffa2000
[ 2.635751] CPU(s): 2 out of 2 PA8500 (PCX-W) at 440.000000 MHz online
[ 2.726692] Setting cache flush threshold to 1024 kB
[ 2.729932] Not-handled unaligned insn 0x43ffff80
[ 2.798114] Setting TLB flush threshold to 140 kB
[ 2.928039] Unaligned handler failed, ret = -1
[ 3.000419] _______________________________
[ 3.000419] < Your System ate a SPARC! Gah! >
[ 3.000419] -------------------------------
[ 3.000419] \ ^__^
[ 3.000419] (__)\ )\/\
[ 3.000419] U ||----w |
[ 3.000419] || ||
[ 9.340055] CPU: 1 PID: 0 Comm: swapper/1 Not tainted 4.8.0-1-parisc64-smp #1 Debian 4.8.7-1
[ 9.448082] task: 00000000bfd48060 task.stack: 00000000bfd50000
[ 9.528040]
[ 10.760029] IASQ: 0000000000000000 0000000000000000 IAOQ: 000000004025d154 000000004025d158
[ 10.868052] IIR: 43ffff80 ISR: 0000000000340000 IOR: 000001ff54150960
[ 10.960029] CPU: 1 CR30: 00000000bfd50000 CR31: 0000000011111111
[ 11.052057] ORIG_R28: 000000004021e3b4
[ 11.100045] IAOQ[0]: irq_exit+0x94/0x120
[ 11.152062] IAOQ[1]: irq_exit+0x98/0x120
[ 11.208031] RP(r2): irq_exit+0xb8/0x120
[ 11.256074] Backtrace:
[ 11.288067] [<00000000402cd944>] cpu_startup_entry+0x1e4/0x598
[ 11.368058] [<0000000040109528>] smp_callin+0x2c0/0x2f0
[ 11.436308] [<00000000402b53fc>] update_curr+0x18c/0x2d0
[ 11.508055] [<00000000402b73b8>] dequeue_entity+0x2c0/0x1030
[ 11.584040] [<00000000402b3cc0>] set_next_entity+0x80/0xd30
[ 11.660069] [<00000000402c1594>] pick_next_task_fair+0x614/0x720
[ 11.740085] [<000000004020dd34>] __schedule+0x394/0xa60
[ 11.808054] [<000000004020e488>] schedule+0x88/0x118
[ 11.876039] [<0000000040283d3c>] rescuer_thread+0x4d4/0x5b0
[ 11.948090] [<000000004028fc4c>] kthread+0x1ec/0x248
[ 12.016053] [<0000000040205020>] end_fault_vector+0x20/0xc0
[ 12.092239] [<00000000402050c0>] _switch_to_ret+0x0/0xf40
[ 12.164044]
[ 12.184036] CPU: 1 PID: 0 Comm: swapper/1 Not tainted 4.8.0-1-parisc64-smp #1 Debian 4.8.7-1
[ 12.244040] Backtrace:
[ 12.244040] [<000000004021c480>] show_stack+0x68/0x80
[ 12.244040] [<00000000406f332c>] dump_stack+0xec/0x168
[ 12.244040] [<000000004021c74c>] die_if_kernel+0x25c/0x430
[ 12.244040] [<000000004022d320>] handle_unaligned+0xb48/0xb50
[ 12.244040]
[ 12.632066] ---[ end trace 9ca05a7215c7bbb2 ]---
[ 12.692036] Kernel panic - not syncing: Attempted to kill the idle task!
We have the insn 0x43ffff80 in IIR but from IAOQ we should have:
4025d150: 0f f3 20 df ldd,s r19(r31),r31
4025d154: 0f 9f 00 9c ldw r31(ret0),ret0
4025d158: bf 80 20 58 cmpb,*<> r0,ret0,4025d18c <irq_exit+0xcc>
Cpu0 has just completed running parisc_setup_cache_timing:
[ 2.429981] Releasing cpu 1 now, hpa=fffffffffffa2000
[ 2.635751] CPU(s): 2 out of 2 PA8500 (PCX-W) at 440.000000 MHz online
[ 2.726692] Setting cache flush threshold to 1024 kB
[ 2.729932] Not-handled unaligned insn 0x43ffff80
[ 2.798114] Setting TLB flush threshold to 140 kB
[ 2.928039] Unaligned handler failed, ret = -1
From the backtrace, cpu1 is in smp_callin:
void __init smp_callin(void)
{
int slave_id = cpu_now_booting;
smp_cpu_init(slave_id);
preempt_disable();
flush_cache_all_local(); /* start with known state */
flush_tlb_all_local(NULL);
local_irq_enable(); /* Interrupts have been off until now */
cpu_startup_entry(CPUHP_AP_ONLINE_IDLE);
So, it has just flushed its caches and the TLB. It would seem either the
flushes in parisc_setup_cache_timing or smp_callin have corrupted kernel
memory.
The attached patch reworks parisc_setup_cache_timing to remove the races
in setting the cache and TLB flush thresholds. It also corrects the
number of bytes flushed in the TLB calculation.
The patch flushes the cache and TLB on cpu0 before starting the
secondary processors so that they are started from a known state.
Tested with a few reboots on c8000.
Signed-off-by: John David Anglin <dave.anglin@bell.net>
Cc: <stable@vger.kernel.org> # v3.18+
Signed-off-by: Helge Deller <deller@gmx.de>
2016-11-20 21:12:36 -05:00
parisc_tlb_flush_threshold = threshold ;
2020-10-02 21:28:31 +02:00
else
parisc_tlb_flush_threshold = FLUSH_TLB_THRESHOLD ;
parisc: Fix races in parisc_setup_cache_timing()
Helge reported to me the following startup crash:
[ 0.000000] Linux version 4.8.0-1-parisc64-smp (debian-kernel@lists.debian.org) (gcc version 5.4.1 20161019 (GCC) ) #1 SMP Debian 4.8.7-1 (2016-11-13)
[ 0.000000] The 64-bit Kernel has started...
[ 0.000000] Kernel default page size is 4 KB. Huge pages enabled with 1 MB physical and 2 MB virtual size.
[ 0.000000] Determining PDC firmware type: System Map.
[ 0.000000] model 9000/785/J5000
[ 0.000000] Total Memory: 2048 MB
[ 0.000000] Memory: 2018528K/2097152K available (9272K kernel code, 3053K rwdata, 1319K rodata, 1024K init, 840K bss, 78624K reserved, 0K cma-reserved)
[ 0.000000] virtual kernel memory layout:
[ 0.000000] vmalloc : 0x0000000000008000 - 0x000000003f000000 (1007 MB)
[ 0.000000] memory : 0x0000000040000000 - 0x00000000c0000000 (2048 MB)
[ 0.000000] .init : 0x0000000040100000 - 0x0000000040200000 (1024 kB)
[ 0.000000] .data : 0x0000000040b0e000 - 0x0000000040f533e0 (4372 kB)
[ 0.000000] .text : 0x0000000040200000 - 0x0000000040b0e000 (9272 kB)
[ 0.768910] Brought up 1 CPUs
[ 0.992465] NET: Registered protocol family 16
[ 2.429981] Releasing cpu 1 now, hpa=fffffffffffa2000
[ 2.635751] CPU(s): 2 out of 2 PA8500 (PCX-W) at 440.000000 MHz online
[ 2.726692] Setting cache flush threshold to 1024 kB
[ 2.729932] Not-handled unaligned insn 0x43ffff80
[ 2.798114] Setting TLB flush threshold to 140 kB
[ 2.928039] Unaligned handler failed, ret = -1
[ 3.000419] _______________________________
[ 3.000419] < Your System ate a SPARC! Gah! >
[ 3.000419] -------------------------------
[ 3.000419] \ ^__^
[ 3.000419] (__)\ )\/\
[ 3.000419] U ||----w |
[ 3.000419] || ||
[ 9.340055] CPU: 1 PID: 0 Comm: swapper/1 Not tainted 4.8.0-1-parisc64-smp #1 Debian 4.8.7-1
[ 9.448082] task: 00000000bfd48060 task.stack: 00000000bfd50000
[ 9.528040]
[ 10.760029] IASQ: 0000000000000000 0000000000000000 IAOQ: 000000004025d154 000000004025d158
[ 10.868052] IIR: 43ffff80 ISR: 0000000000340000 IOR: 000001ff54150960
[ 10.960029] CPU: 1 CR30: 00000000bfd50000 CR31: 0000000011111111
[ 11.052057] ORIG_R28: 000000004021e3b4
[ 11.100045] IAOQ[0]: irq_exit+0x94/0x120
[ 11.152062] IAOQ[1]: irq_exit+0x98/0x120
[ 11.208031] RP(r2): irq_exit+0xb8/0x120
[ 11.256074] Backtrace:
[ 11.288067] [<00000000402cd944>] cpu_startup_entry+0x1e4/0x598
[ 11.368058] [<0000000040109528>] smp_callin+0x2c0/0x2f0
[ 11.436308] [<00000000402b53fc>] update_curr+0x18c/0x2d0
[ 11.508055] [<00000000402b73b8>] dequeue_entity+0x2c0/0x1030
[ 11.584040] [<00000000402b3cc0>] set_next_entity+0x80/0xd30
[ 11.660069] [<00000000402c1594>] pick_next_task_fair+0x614/0x720
[ 11.740085] [<000000004020dd34>] __schedule+0x394/0xa60
[ 11.808054] [<000000004020e488>] schedule+0x88/0x118
[ 11.876039] [<0000000040283d3c>] rescuer_thread+0x4d4/0x5b0
[ 11.948090] [<000000004028fc4c>] kthread+0x1ec/0x248
[ 12.016053] [<0000000040205020>] end_fault_vector+0x20/0xc0
[ 12.092239] [<00000000402050c0>] _switch_to_ret+0x0/0xf40
[ 12.164044]
[ 12.184036] CPU: 1 PID: 0 Comm: swapper/1 Not tainted 4.8.0-1-parisc64-smp #1 Debian 4.8.7-1
[ 12.244040] Backtrace:
[ 12.244040] [<000000004021c480>] show_stack+0x68/0x80
[ 12.244040] [<00000000406f332c>] dump_stack+0xec/0x168
[ 12.244040] [<000000004021c74c>] die_if_kernel+0x25c/0x430
[ 12.244040] [<000000004022d320>] handle_unaligned+0xb48/0xb50
[ 12.244040]
[ 12.632066] ---[ end trace 9ca05a7215c7bbb2 ]---
[ 12.692036] Kernel panic - not syncing: Attempted to kill the idle task!
We have the insn 0x43ffff80 in IIR but from IAOQ we should have:
4025d150: 0f f3 20 df ldd,s r19(r31),r31
4025d154: 0f 9f 00 9c ldw r31(ret0),ret0
4025d158: bf 80 20 58 cmpb,*<> r0,ret0,4025d18c <irq_exit+0xcc>
Cpu0 has just completed running parisc_setup_cache_timing:
[ 2.429981] Releasing cpu 1 now, hpa=fffffffffffa2000
[ 2.635751] CPU(s): 2 out of 2 PA8500 (PCX-W) at 440.000000 MHz online
[ 2.726692] Setting cache flush threshold to 1024 kB
[ 2.729932] Not-handled unaligned insn 0x43ffff80
[ 2.798114] Setting TLB flush threshold to 140 kB
[ 2.928039] Unaligned handler failed, ret = -1
From the backtrace, cpu1 is in smp_callin:
void __init smp_callin(void)
{
int slave_id = cpu_now_booting;
smp_cpu_init(slave_id);
preempt_disable();
flush_cache_all_local(); /* start with known state */
flush_tlb_all_local(NULL);
local_irq_enable(); /* Interrupts have been off until now */
cpu_startup_entry(CPUHP_AP_ONLINE_IDLE);
So, it has just flushed its caches and the TLB. It would seem either the
flushes in parisc_setup_cache_timing or smp_callin have corrupted kernel
memory.
The attached patch reworks parisc_setup_cache_timing to remove the races
in setting the cache and TLB flush thresholds. It also corrects the
number of bytes flushed in the TLB calculation.
The patch flushes the cache and TLB on cpu0 before starting the
secondary processors so that they are started from a known state.
Tested with a few reboots on c8000.
Signed-off-by: John David Anglin <dave.anglin@bell.net>
Cc: <stable@vger.kernel.org> # v3.18+
Signed-off-by: Helge Deller <deller@gmx.de>
2016-11-20 21:12:36 -05:00
printk ( KERN_INFO " TLB flush threshold set to %lu KiB \n " ,
2015-07-01 17:18:37 -04:00
parisc_tlb_flush_threshold / 1024 ) ;
2005-04-16 15:20:36 -07:00
}
2006-08-23 09:00:04 -07:00
2013-02-03 22:59:09 +00:00
extern void purge_kernel_dcache_page_asm ( unsigned long ) ;
extern void clear_user_page_asm ( void * , unsigned long ) ;
extern void copy_user_page_asm ( void * , void * , unsigned long ) ;
2006-08-23 09:00:04 -07:00
2022-07-06 13:15:19 +02:00
void flush_kernel_dcache_page_addr ( const void * addr )
2006-08-23 09:00:04 -07:00
{
2009-06-16 20:51:48 +00:00
unsigned long flags ;
2006-08-23 09:00:04 -07:00
flush_kernel_dcache_page_asm ( addr ) ;
2009-06-16 20:51:48 +00:00
purge_tlb_start ( flags ) ;
2022-02-17 15:26:27 +01:00
pdtlb ( SR_KERNEL , addr ) ;
2009-06-16 20:51:48 +00:00
purge_tlb_end ( flags ) ;
2006-08-23 09:00:04 -07:00
}
EXPORT_SYMBOL ( flush_kernel_dcache_page_addr ) ;
parisc: Rewrite cache flush code for PA8800/PA8900
Originally, I was convinced that we needed to use tmpalias flushes
everwhere, for both user and kernel flushes. However, when I modified
flush_kernel_dcache_page_addr, to use a tmpalias flush, my c8000
would crash quite early when booting.
The PDC returns alias values of 0 for the icache and dcache. This
indicates that either the alias boundary is greater than 16MB or
equivalent aliasing doesn't work. I modified the tmpalias code to
make it easy to try alternate boundaries. I tried boundaries up to
128MB but still kernel tmpalias flushes didn't work on c8000.
This led me to conclude that tmpalias flushes don't work on PA8800
and PA8900 machines, and that we needed to flush directly using the
virtual address of user and kernel pages. This is likely the major
cause of instability on the c8000 and rp34xx machines.
Flushing user pages requires doing a temporary context switch as we
have to flush pages that don't belong to the current context. Further,
we have to deal with pages that aren't present. If a page isn't
present, the flush instructions fault on every line.
Other code has been rearranged and simplified based on testing. For
example, I introduced a flush_cache_dup_mm routine. flush_cache_mm
and flush_cache_dup_mm differ in that flush_cache_mm calls
purge_cache_pages and flush_cache_dup_mm calls flush_cache_pages.
In some implementations, pdc is more efficient than fdc. Based on
my testing, I don't believe there's any performance benefit on the
c8000.
Signed-off-by: John David Anglin <dave.anglin@bell.net>
Signed-off-by: Helge Deller <deller@gmx.de>
2022-05-16 15:14:47 +00:00
static void flush_cache_page_if_present ( struct vm_area_struct * vma ,
unsigned long vmaddr , unsigned long pfn )
2014-01-31 21:33:17 +01:00
{
parisc: Rewrite cache flush code for PA8800/PA8900
Originally, I was convinced that we needed to use tmpalias flushes
everwhere, for both user and kernel flushes. However, when I modified
flush_kernel_dcache_page_addr, to use a tmpalias flush, my c8000
would crash quite early when booting.
The PDC returns alias values of 0 for the icache and dcache. This
indicates that either the alias boundary is greater than 16MB or
equivalent aliasing doesn't work. I modified the tmpalias code to
make it easy to try alternate boundaries. I tried boundaries up to
128MB but still kernel tmpalias flushes didn't work on c8000.
This led me to conclude that tmpalias flushes don't work on PA8800
and PA8900 machines, and that we needed to flush directly using the
virtual address of user and kernel pages. This is likely the major
cause of instability on the c8000 and rp34xx machines.
Flushing user pages requires doing a temporary context switch as we
have to flush pages that don't belong to the current context. Further,
we have to deal with pages that aren't present. If a page isn't
present, the flush instructions fault on every line.
Other code has been rearranged and simplified based on testing. For
example, I introduced a flush_cache_dup_mm routine. flush_cache_mm
and flush_cache_dup_mm differ in that flush_cache_mm calls
purge_cache_pages and flush_cache_dup_mm calls flush_cache_pages.
In some implementations, pdc is more efficient than fdc. Based on
my testing, I don't believe there's any performance benefit on the
c8000.
Signed-off-by: John David Anglin <dave.anglin@bell.net>
Signed-off-by: Helge Deller <deller@gmx.de>
2022-05-16 15:14:47 +00:00
pte_t * ptep = get_ptep ( vma - > vm_mm , vmaddr ) ;
/*
* The pte check is racy and sometimes the flush will trigger
* a non - access TLB miss . Hopefully , the page has already been
* flushed .
*/
if ( ptep & & pte_needs_flush ( * ptep ) )
flush_cache_page ( vma , vmaddr , pfn ) ;
}
void copy_user_highpage ( struct page * to , struct page * from ,
unsigned long vaddr , struct vm_area_struct * vma )
{
void * kto , * kfrom ;
kfrom = kmap_local_page ( from ) ;
kto = kmap_local_page ( to ) ;
flush_cache_page_if_present ( vma , vaddr , page_to_pfn ( from ) ) ;
copy_page_asm ( kto , kfrom ) ;
kunmap_local ( kto ) ;
kunmap_local ( kfrom ) ;
}
void copy_to_user_page ( struct vm_area_struct * vma , struct page * page ,
unsigned long user_vaddr , void * dst , void * src , int len )
{
flush_cache_page_if_present ( vma , user_vaddr , page_to_pfn ( page ) ) ;
memcpy ( dst , src , len ) ;
flush_kernel_dcache_range_asm ( ( unsigned long ) dst , ( unsigned long ) dst + len ) ;
}
void copy_from_user_page ( struct vm_area_struct * vma , struct page * page ,
unsigned long user_vaddr , void * dst , void * src , int len )
{
flush_cache_page_if_present ( vma , user_vaddr , page_to_pfn ( page ) ) ;
memcpy ( dst , src , len ) ;
2014-01-31 21:33:17 +01:00
}
2015-07-01 17:18:37 -04:00
/* __flush_tlb_range()
*
* returns 1 if all TLBs were flushed .
*/
int __flush_tlb_range ( unsigned long sid , unsigned long start ,
unsigned long end )
2006-12-12 05:51:54 -08:00
{
2018-02-27 08:16:07 -05:00
unsigned long flags ;
2006-12-12 05:51:54 -08:00
2018-02-27 08:16:07 -05:00
if ( ( ! IS_ENABLED ( CONFIG_SMP ) | | ! arch_irqs_disabled ( ) ) & &
end - start > = parisc_tlb_flush_threshold ) {
2006-12-12 05:51:54 -08:00
flush_tlb_all ( ) ;
2015-07-01 17:18:37 -04:00
return 1 ;
}
2009-06-16 20:51:48 +00:00
2015-07-01 17:18:37 -04:00
/* Purge TLB entries for small ranges using the pdtlb and
pitlb instructions . These instructions execute locally
but cause a purge request to be broadcast to other TLBs . */
while ( start < end ) {
2009-06-16 20:51:48 +00:00
purge_tlb_start ( flags ) ;
2022-02-17 15:26:27 +01:00
mtsp ( sid , SR_TEMP1 ) ;
pdtlb ( SR_TEMP1 , start ) ;
pitlb ( SR_TEMP1 , start ) ;
2009-06-16 20:51:48 +00:00
purge_tlb_end ( flags ) ;
2015-07-01 17:18:37 -04:00
start + = PAGE_SIZE ;
2006-12-12 05:51:54 -08:00
}
2015-07-01 17:18:37 -04:00
return 0 ;
2006-12-12 05:51:54 -08:00
}
parisc: Rewrite cache flush code for PA8800/PA8900
Originally, I was convinced that we needed to use tmpalias flushes
everwhere, for both user and kernel flushes. However, when I modified
flush_kernel_dcache_page_addr, to use a tmpalias flush, my c8000
would crash quite early when booting.
The PDC returns alias values of 0 for the icache and dcache. This
indicates that either the alias boundary is greater than 16MB or
equivalent aliasing doesn't work. I modified the tmpalias code to
make it easy to try alternate boundaries. I tried boundaries up to
128MB but still kernel tmpalias flushes didn't work on c8000.
This led me to conclude that tmpalias flushes don't work on PA8800
and PA8900 machines, and that we needed to flush directly using the
virtual address of user and kernel pages. This is likely the major
cause of instability on the c8000 and rp34xx machines.
Flushing user pages requires doing a temporary context switch as we
have to flush pages that don't belong to the current context. Further,
we have to deal with pages that aren't present. If a page isn't
present, the flush instructions fault on every line.
Other code has been rearranged and simplified based on testing. For
example, I introduced a flush_cache_dup_mm routine. flush_cache_mm
and flush_cache_dup_mm differ in that flush_cache_mm calls
purge_cache_pages and flush_cache_dup_mm calls flush_cache_pages.
In some implementations, pdc is more efficient than fdc. Based on
my testing, I don't believe there's any performance benefit on the
c8000.
Signed-off-by: John David Anglin <dave.anglin@bell.net>
Signed-off-by: Helge Deller <deller@gmx.de>
2022-05-16 15:14:47 +00:00
static void flush_cache_pages ( struct vm_area_struct * vma , unsigned long start , unsigned long end )
2013-02-03 23:01:47 +00:00
{
parisc: Rewrite cache flush code for PA8800/PA8900
Originally, I was convinced that we needed to use tmpalias flushes
everwhere, for both user and kernel flushes. However, when I modified
flush_kernel_dcache_page_addr, to use a tmpalias flush, my c8000
would crash quite early when booting.
The PDC returns alias values of 0 for the icache and dcache. This
indicates that either the alias boundary is greater than 16MB or
equivalent aliasing doesn't work. I modified the tmpalias code to
make it easy to try alternate boundaries. I tried boundaries up to
128MB but still kernel tmpalias flushes didn't work on c8000.
This led me to conclude that tmpalias flushes don't work on PA8800
and PA8900 machines, and that we needed to flush directly using the
virtual address of user and kernel pages. This is likely the major
cause of instability on the c8000 and rp34xx machines.
Flushing user pages requires doing a temporary context switch as we
have to flush pages that don't belong to the current context. Further,
we have to deal with pages that aren't present. If a page isn't
present, the flush instructions fault on every line.
Other code has been rearranged and simplified based on testing. For
example, I introduced a flush_cache_dup_mm routine. flush_cache_mm
and flush_cache_dup_mm differ in that flush_cache_mm calls
purge_cache_pages and flush_cache_dup_mm calls flush_cache_pages.
In some implementations, pdc is more efficient than fdc. Based on
my testing, I don't believe there's any performance benefit on the
c8000.
Signed-off-by: John David Anglin <dave.anglin@bell.net>
Signed-off-by: Helge Deller <deller@gmx.de>
2022-05-16 15:14:47 +00:00
unsigned long addr , pfn ;
pte_t * ptep ;
2013-02-03 23:01:47 +00:00
parisc: Rewrite cache flush code for PA8800/PA8900
Originally, I was convinced that we needed to use tmpalias flushes
everwhere, for both user and kernel flushes. However, when I modified
flush_kernel_dcache_page_addr, to use a tmpalias flush, my c8000
would crash quite early when booting.
The PDC returns alias values of 0 for the icache and dcache. This
indicates that either the alias boundary is greater than 16MB or
equivalent aliasing doesn't work. I modified the tmpalias code to
make it easy to try alternate boundaries. I tried boundaries up to
128MB but still kernel tmpalias flushes didn't work on c8000.
This led me to conclude that tmpalias flushes don't work on PA8800
and PA8900 machines, and that we needed to flush directly using the
virtual address of user and kernel pages. This is likely the major
cause of instability on the c8000 and rp34xx machines.
Flushing user pages requires doing a temporary context switch as we
have to flush pages that don't belong to the current context. Further,
we have to deal with pages that aren't present. If a page isn't
present, the flush instructions fault on every line.
Other code has been rearranged and simplified based on testing. For
example, I introduced a flush_cache_dup_mm routine. flush_cache_mm
and flush_cache_dup_mm differ in that flush_cache_mm calls
purge_cache_pages and flush_cache_dup_mm calls flush_cache_pages.
In some implementations, pdc is more efficient than fdc. Based on
my testing, I don't believe there's any performance benefit on the
c8000.
Signed-off-by: John David Anglin <dave.anglin@bell.net>
Signed-off-by: Helge Deller <deller@gmx.de>
2022-05-16 15:14:47 +00:00
for ( addr = start ; addr < end ; addr + = PAGE_SIZE ) {
/*
* The vma can contain pages that aren ' t present . Although
* the pte search is expensive , we need the pte to find the
* page pfn and to check whether the page should be flushed .
*/
ptep = get_ptep ( vma - > vm_mm , addr ) ;
if ( ptep & & pte_needs_flush ( * ptep ) ) {
if ( parisc_requires_coherency ( ) ) {
flush_user_cache_page ( vma , addr ) ;
} else {
pfn = pte_pfn ( * ptep ) ;
if ( WARN_ON ( ! pfn_valid ( pfn ) ) )
return ;
__flush_cache_page ( vma , addr , PFN_PHYS ( pfn ) ) ;
2019-12-04 16:54:12 -08:00
}
2013-02-03 23:01:47 +00:00
}
}
}
parisc: Rewrite cache flush code for PA8800/PA8900
Originally, I was convinced that we needed to use tmpalias flushes
everwhere, for both user and kernel flushes. However, when I modified
flush_kernel_dcache_page_addr, to use a tmpalias flush, my c8000
would crash quite early when booting.
The PDC returns alias values of 0 for the icache and dcache. This
indicates that either the alias boundary is greater than 16MB or
equivalent aliasing doesn't work. I modified the tmpalias code to
make it easy to try alternate boundaries. I tried boundaries up to
128MB but still kernel tmpalias flushes didn't work on c8000.
This led me to conclude that tmpalias flushes don't work on PA8800
and PA8900 machines, and that we needed to flush directly using the
virtual address of user and kernel pages. This is likely the major
cause of instability on the c8000 and rp34xx machines.
Flushing user pages requires doing a temporary context switch as we
have to flush pages that don't belong to the current context. Further,
we have to deal with pages that aren't present. If a page isn't
present, the flush instructions fault on every line.
Other code has been rearranged and simplified based on testing. For
example, I introduced a flush_cache_dup_mm routine. flush_cache_mm
and flush_cache_dup_mm differ in that flush_cache_mm calls
purge_cache_pages and flush_cache_dup_mm calls flush_cache_pages.
In some implementations, pdc is more efficient than fdc. Based on
my testing, I don't believe there's any performance benefit on the
c8000.
Signed-off-by: John David Anglin <dave.anglin@bell.net>
Signed-off-by: Helge Deller <deller@gmx.de>
2022-05-16 15:14:47 +00:00
static inline unsigned long mm_total_size ( struct mm_struct * mm )
2021-10-09 20:24:36 +02:00
{
parisc: Rewrite cache flush code for PA8800/PA8900
Originally, I was convinced that we needed to use tmpalias flushes
everwhere, for both user and kernel flushes. However, when I modified
flush_kernel_dcache_page_addr, to use a tmpalias flush, my c8000
would crash quite early when booting.
The PDC returns alias values of 0 for the icache and dcache. This
indicates that either the alias boundary is greater than 16MB or
equivalent aliasing doesn't work. I modified the tmpalias code to
make it easy to try alternate boundaries. I tried boundaries up to
128MB but still kernel tmpalias flushes didn't work on c8000.
This led me to conclude that tmpalias flushes don't work on PA8800
and PA8900 machines, and that we needed to flush directly using the
virtual address of user and kernel pages. This is likely the major
cause of instability on the c8000 and rp34xx machines.
Flushing user pages requires doing a temporary context switch as we
have to flush pages that don't belong to the current context. Further,
we have to deal with pages that aren't present. If a page isn't
present, the flush instructions fault on every line.
Other code has been rearranged and simplified based on testing. For
example, I introduced a flush_cache_dup_mm routine. flush_cache_mm
and flush_cache_dup_mm differ in that flush_cache_mm calls
purge_cache_pages and flush_cache_dup_mm calls flush_cache_pages.
In some implementations, pdc is more efficient than fdc. Based on
my testing, I don't believe there's any performance benefit on the
c8000.
Signed-off-by: John David Anglin <dave.anglin@bell.net>
Signed-off-by: Helge Deller <deller@gmx.de>
2022-05-16 15:14:47 +00:00
struct vm_area_struct * vma ;
unsigned long usize = 0 ;
2022-09-06 19:48:53 +00:00
VMA_ITERATOR ( vmi , mm , 0 ) ;
2021-10-09 20:24:36 +02:00
2022-09-06 19:48:53 +00:00
for_each_vma ( vmi , vma ) {
if ( usize > = parisc_cache_flush_threshold )
break ;
parisc: Rewrite cache flush code for PA8800/PA8900
Originally, I was convinced that we needed to use tmpalias flushes
everwhere, for both user and kernel flushes. However, when I modified
flush_kernel_dcache_page_addr, to use a tmpalias flush, my c8000
would crash quite early when booting.
The PDC returns alias values of 0 for the icache and dcache. This
indicates that either the alias boundary is greater than 16MB or
equivalent aliasing doesn't work. I modified the tmpalias code to
make it easy to try alternate boundaries. I tried boundaries up to
128MB but still kernel tmpalias flushes didn't work on c8000.
This led me to conclude that tmpalias flushes don't work on PA8800
and PA8900 machines, and that we needed to flush directly using the
virtual address of user and kernel pages. This is likely the major
cause of instability on the c8000 and rp34xx machines.
Flushing user pages requires doing a temporary context switch as we
have to flush pages that don't belong to the current context. Further,
we have to deal with pages that aren't present. If a page isn't
present, the flush instructions fault on every line.
Other code has been rearranged and simplified based on testing. For
example, I introduced a flush_cache_dup_mm routine. flush_cache_mm
and flush_cache_dup_mm differ in that flush_cache_mm calls
purge_cache_pages and flush_cache_dup_mm calls flush_cache_pages.
In some implementations, pdc is more efficient than fdc. Based on
my testing, I don't believe there's any performance benefit on the
c8000.
Signed-off-by: John David Anglin <dave.anglin@bell.net>
Signed-off-by: Helge Deller <deller@gmx.de>
2022-05-16 15:14:47 +00:00
usize + = vma - > vm_end - vma - > vm_start ;
2022-09-06 19:48:53 +00:00
}
parisc: Rewrite cache flush code for PA8800/PA8900
Originally, I was convinced that we needed to use tmpalias flushes
everwhere, for both user and kernel flushes. However, when I modified
flush_kernel_dcache_page_addr, to use a tmpalias flush, my c8000
would crash quite early when booting.
The PDC returns alias values of 0 for the icache and dcache. This
indicates that either the alias boundary is greater than 16MB or
equivalent aliasing doesn't work. I modified the tmpalias code to
make it easy to try alternate boundaries. I tried boundaries up to
128MB but still kernel tmpalias flushes didn't work on c8000.
This led me to conclude that tmpalias flushes don't work on PA8800
and PA8900 machines, and that we needed to flush directly using the
virtual address of user and kernel pages. This is likely the major
cause of instability on the c8000 and rp34xx machines.
Flushing user pages requires doing a temporary context switch as we
have to flush pages that don't belong to the current context. Further,
we have to deal with pages that aren't present. If a page isn't
present, the flush instructions fault on every line.
Other code has been rearranged and simplified based on testing. For
example, I introduced a flush_cache_dup_mm routine. flush_cache_mm
and flush_cache_dup_mm differ in that flush_cache_mm calls
purge_cache_pages and flush_cache_dup_mm calls flush_cache_pages.
In some implementations, pdc is more efficient than fdc. Based on
my testing, I don't believe there's any performance benefit on the
c8000.
Signed-off-by: John David Anglin <dave.anglin@bell.net>
Signed-off-by: Helge Deller <deller@gmx.de>
2022-05-16 15:14:47 +00:00
return usize ;
2021-10-09 20:24:36 +02:00
}
2006-12-12 05:51:54 -08:00
void flush_cache_mm ( struct mm_struct * mm )
{
2013-07-23 12:27:52 -04:00
struct vm_area_struct * vma ;
2022-09-06 19:48:53 +00:00
VMA_ITERATOR ( vmi , mm , 0 ) ;
2013-07-23 12:27:52 -04:00
parisc: Rewrite cache flush code for PA8800/PA8900
Originally, I was convinced that we needed to use tmpalias flushes
everwhere, for both user and kernel flushes. However, when I modified
flush_kernel_dcache_page_addr, to use a tmpalias flush, my c8000
would crash quite early when booting.
The PDC returns alias values of 0 for the icache and dcache. This
indicates that either the alias boundary is greater than 16MB or
equivalent aliasing doesn't work. I modified the tmpalias code to
make it easy to try alternate boundaries. I tried boundaries up to
128MB but still kernel tmpalias flushes didn't work on c8000.
This led me to conclude that tmpalias flushes don't work on PA8800
and PA8900 machines, and that we needed to flush directly using the
virtual address of user and kernel pages. This is likely the major
cause of instability on the c8000 and rp34xx machines.
Flushing user pages requires doing a temporary context switch as we
have to flush pages that don't belong to the current context. Further,
we have to deal with pages that aren't present. If a page isn't
present, the flush instructions fault on every line.
Other code has been rearranged and simplified based on testing. For
example, I introduced a flush_cache_dup_mm routine. flush_cache_mm
and flush_cache_dup_mm differ in that flush_cache_mm calls
purge_cache_pages and flush_cache_dup_mm calls flush_cache_pages.
In some implementations, pdc is more efficient than fdc. Based on
my testing, I don't believe there's any performance benefit on the
c8000.
Signed-off-by: John David Anglin <dave.anglin@bell.net>
Signed-off-by: Helge Deller <deller@gmx.de>
2022-05-16 15:14:47 +00:00
/*
* Flushing the whole cache on each cpu takes forever on
* rp3440 , etc . So , avoid it if the mm isn ' t too big .
*
* Note that we must flush the entire cache on machines
* with aliasing caches to prevent random segmentation
* faults .
*/
if ( ! parisc_requires_coherency ( )
| | mm_total_size ( mm ) > = parisc_cache_flush_threshold ) {
if ( WARN_ON ( IS_ENABLED ( CONFIG_SMP ) & & arch_irqs_disabled ( ) ) )
return ;
flush_tlb_all ( ) ;
2013-07-23 12:27:52 -04:00
flush_cache_all ( ) ;
return ;
}
parisc: Rewrite cache flush code for PA8800/PA8900
Originally, I was convinced that we needed to use tmpalias flushes
everwhere, for both user and kernel flushes. However, when I modified
flush_kernel_dcache_page_addr, to use a tmpalias flush, my c8000
would crash quite early when booting.
The PDC returns alias values of 0 for the icache and dcache. This
indicates that either the alias boundary is greater than 16MB or
equivalent aliasing doesn't work. I modified the tmpalias code to
make it easy to try alternate boundaries. I tried boundaries up to
128MB but still kernel tmpalias flushes didn't work on c8000.
This led me to conclude that tmpalias flushes don't work on PA8800
and PA8900 machines, and that we needed to flush directly using the
virtual address of user and kernel pages. This is likely the major
cause of instability on the c8000 and rp34xx machines.
Flushing user pages requires doing a temporary context switch as we
have to flush pages that don't belong to the current context. Further,
we have to deal with pages that aren't present. If a page isn't
present, the flush instructions fault on every line.
Other code has been rearranged and simplified based on testing. For
example, I introduced a flush_cache_dup_mm routine. flush_cache_mm
and flush_cache_dup_mm differ in that flush_cache_mm calls
purge_cache_pages and flush_cache_dup_mm calls flush_cache_pages.
In some implementations, pdc is more efficient than fdc. Based on
my testing, I don't believe there's any performance benefit on the
c8000.
Signed-off-by: John David Anglin <dave.anglin@bell.net>
Signed-off-by: Helge Deller <deller@gmx.de>
2022-05-16 15:14:47 +00:00
/* Flush mm */
2022-09-06 19:48:53 +00:00
for_each_vma ( vmi , vma )
parisc: Rewrite cache flush code for PA8800/PA8900
Originally, I was convinced that we needed to use tmpalias flushes
everwhere, for both user and kernel flushes. However, when I modified
flush_kernel_dcache_page_addr, to use a tmpalias flush, my c8000
would crash quite early when booting.
The PDC returns alias values of 0 for the icache and dcache. This
indicates that either the alias boundary is greater than 16MB or
equivalent aliasing doesn't work. I modified the tmpalias code to
make it easy to try alternate boundaries. I tried boundaries up to
128MB but still kernel tmpalias flushes didn't work on c8000.
This led me to conclude that tmpalias flushes don't work on PA8800
and PA8900 machines, and that we needed to flush directly using the
virtual address of user and kernel pages. This is likely the major
cause of instability on the c8000 and rp34xx machines.
Flushing user pages requires doing a temporary context switch as we
have to flush pages that don't belong to the current context. Further,
we have to deal with pages that aren't present. If a page isn't
present, the flush instructions fault on every line.
Other code has been rearranged and simplified based on testing. For
example, I introduced a flush_cache_dup_mm routine. flush_cache_mm
and flush_cache_dup_mm differ in that flush_cache_mm calls
purge_cache_pages and flush_cache_dup_mm calls flush_cache_pages.
In some implementations, pdc is more efficient than fdc. Based on
my testing, I don't believe there's any performance benefit on the
c8000.
Signed-off-by: John David Anglin <dave.anglin@bell.net>
Signed-off-by: Helge Deller <deller@gmx.de>
2022-05-16 15:14:47 +00:00
flush_cache_pages ( vma , vma - > vm_start , vma - > vm_end ) ;
2006-12-12 05:51:54 -08:00
}
parisc: Rewrite cache flush code for PA8800/PA8900
Originally, I was convinced that we needed to use tmpalias flushes
everwhere, for both user and kernel flushes. However, when I modified
flush_kernel_dcache_page_addr, to use a tmpalias flush, my c8000
would crash quite early when booting.
The PDC returns alias values of 0 for the icache and dcache. This
indicates that either the alias boundary is greater than 16MB or
equivalent aliasing doesn't work. I modified the tmpalias code to
make it easy to try alternate boundaries. I tried boundaries up to
128MB but still kernel tmpalias flushes didn't work on c8000.
This led me to conclude that tmpalias flushes don't work on PA8800
and PA8900 machines, and that we needed to flush directly using the
virtual address of user and kernel pages. This is likely the major
cause of instability on the c8000 and rp34xx machines.
Flushing user pages requires doing a temporary context switch as we
have to flush pages that don't belong to the current context. Further,
we have to deal with pages that aren't present. If a page isn't
present, the flush instructions fault on every line.
Other code has been rearranged and simplified based on testing. For
example, I introduced a flush_cache_dup_mm routine. flush_cache_mm
and flush_cache_dup_mm differ in that flush_cache_mm calls
purge_cache_pages and flush_cache_dup_mm calls flush_cache_pages.
In some implementations, pdc is more efficient than fdc. Based on
my testing, I don't believe there's any performance benefit on the
c8000.
Signed-off-by: John David Anglin <dave.anglin@bell.net>
Signed-off-by: Helge Deller <deller@gmx.de>
2022-05-16 15:14:47 +00:00
void flush_cache_range ( struct vm_area_struct * vma , unsigned long start , unsigned long end )
2006-12-12 05:51:54 -08:00
{
parisc: Rewrite cache flush code for PA8800/PA8900
Originally, I was convinced that we needed to use tmpalias flushes
everwhere, for both user and kernel flushes. However, when I modified
flush_kernel_dcache_page_addr, to use a tmpalias flush, my c8000
would crash quite early when booting.
The PDC returns alias values of 0 for the icache and dcache. This
indicates that either the alias boundary is greater than 16MB or
equivalent aliasing doesn't work. I modified the tmpalias code to
make it easy to try alternate boundaries. I tried boundaries up to
128MB but still kernel tmpalias flushes didn't work on c8000.
This led me to conclude that tmpalias flushes don't work on PA8800
and PA8900 machines, and that we needed to flush directly using the
virtual address of user and kernel pages. This is likely the major
cause of instability on the c8000 and rp34xx machines.
Flushing user pages requires doing a temporary context switch as we
have to flush pages that don't belong to the current context. Further,
we have to deal with pages that aren't present. If a page isn't
present, the flush instructions fault on every line.
Other code has been rearranged and simplified based on testing. For
example, I introduced a flush_cache_dup_mm routine. flush_cache_mm
and flush_cache_dup_mm differ in that flush_cache_mm calls
purge_cache_pages and flush_cache_dup_mm calls flush_cache_pages.
In some implementations, pdc is more efficient than fdc. Based on
my testing, I don't believe there's any performance benefit on the
c8000.
Signed-off-by: John David Anglin <dave.anglin@bell.net>
Signed-off-by: Helge Deller <deller@gmx.de>
2022-05-16 15:14:47 +00:00
if ( ! parisc_requires_coherency ( )
| | end - start > = parisc_cache_flush_threshold ) {
if ( WARN_ON ( IS_ENABLED ( CONFIG_SMP ) & & arch_irqs_disabled ( ) ) )
return ;
flush_tlb_range ( vma , start , end ) ;
2006-12-12 05:51:54 -08:00
flush_cache_all ( ) ;
2013-07-23 12:27:52 -04:00
return ;
}
parisc: Rewrite cache flush code for PA8800/PA8900
Originally, I was convinced that we needed to use tmpalias flushes
everwhere, for both user and kernel flushes. However, when I modified
flush_kernel_dcache_page_addr, to use a tmpalias flush, my c8000
would crash quite early when booting.
The PDC returns alias values of 0 for the icache and dcache. This
indicates that either the alias boundary is greater than 16MB or
equivalent aliasing doesn't work. I modified the tmpalias code to
make it easy to try alternate boundaries. I tried boundaries up to
128MB but still kernel tmpalias flushes didn't work on c8000.
This led me to conclude that tmpalias flushes don't work on PA8800
and PA8900 machines, and that we needed to flush directly using the
virtual address of user and kernel pages. This is likely the major
cause of instability on the c8000 and rp34xx machines.
Flushing user pages requires doing a temporary context switch as we
have to flush pages that don't belong to the current context. Further,
we have to deal with pages that aren't present. If a page isn't
present, the flush instructions fault on every line.
Other code has been rearranged and simplified based on testing. For
example, I introduced a flush_cache_dup_mm routine. flush_cache_mm
and flush_cache_dup_mm differ in that flush_cache_mm calls
purge_cache_pages and flush_cache_dup_mm calls flush_cache_pages.
In some implementations, pdc is more efficient than fdc. Based on
my testing, I don't believe there's any performance benefit on the
c8000.
Signed-off-by: John David Anglin <dave.anglin@bell.net>
Signed-off-by: Helge Deller <deller@gmx.de>
2022-05-16 15:14:47 +00:00
flush_cache_pages ( vma , start , end ) ;
2006-12-12 05:51:54 -08:00
}
parisc: Rewrite cache flush code for PA8800/PA8900
Originally, I was convinced that we needed to use tmpalias flushes
everwhere, for both user and kernel flushes. However, when I modified
flush_kernel_dcache_page_addr, to use a tmpalias flush, my c8000
would crash quite early when booting.
The PDC returns alias values of 0 for the icache and dcache. This
indicates that either the alias boundary is greater than 16MB or
equivalent aliasing doesn't work. I modified the tmpalias code to
make it easy to try alternate boundaries. I tried boundaries up to
128MB but still kernel tmpalias flushes didn't work on c8000.
This led me to conclude that tmpalias flushes don't work on PA8800
and PA8900 machines, and that we needed to flush directly using the
virtual address of user and kernel pages. This is likely the major
cause of instability on the c8000 and rp34xx machines.
Flushing user pages requires doing a temporary context switch as we
have to flush pages that don't belong to the current context. Further,
we have to deal with pages that aren't present. If a page isn't
present, the flush instructions fault on every line.
Other code has been rearranged and simplified based on testing. For
example, I introduced a flush_cache_dup_mm routine. flush_cache_mm
and flush_cache_dup_mm differ in that flush_cache_mm calls
purge_cache_pages and flush_cache_dup_mm calls flush_cache_pages.
In some implementations, pdc is more efficient than fdc. Based on
my testing, I don't believe there's any performance benefit on the
c8000.
Signed-off-by: John David Anglin <dave.anglin@bell.net>
Signed-off-by: Helge Deller <deller@gmx.de>
2022-05-16 15:14:47 +00:00
void flush_cache_page ( struct vm_area_struct * vma , unsigned long vmaddr , unsigned long pfn )
2006-12-12 05:51:54 -08:00
{
parisc: Rewrite cache flush code for PA8800/PA8900
Originally, I was convinced that we needed to use tmpalias flushes
everwhere, for both user and kernel flushes. However, when I modified
flush_kernel_dcache_page_addr, to use a tmpalias flush, my c8000
would crash quite early when booting.
The PDC returns alias values of 0 for the icache and dcache. This
indicates that either the alias boundary is greater than 16MB or
equivalent aliasing doesn't work. I modified the tmpalias code to
make it easy to try alternate boundaries. I tried boundaries up to
128MB but still kernel tmpalias flushes didn't work on c8000.
This led me to conclude that tmpalias flushes don't work on PA8800
and PA8900 machines, and that we needed to flush directly using the
virtual address of user and kernel pages. This is likely the major
cause of instability on the c8000 and rp34xx machines.
Flushing user pages requires doing a temporary context switch as we
have to flush pages that don't belong to the current context. Further,
we have to deal with pages that aren't present. If a page isn't
present, the flush instructions fault on every line.
Other code has been rearranged and simplified based on testing. For
example, I introduced a flush_cache_dup_mm routine. flush_cache_mm
and flush_cache_dup_mm differ in that flush_cache_mm calls
purge_cache_pages and flush_cache_dup_mm calls flush_cache_pages.
In some implementations, pdc is more efficient than fdc. Based on
my testing, I don't believe there's any performance benefit on the
c8000.
Signed-off-by: John David Anglin <dave.anglin@bell.net>
Signed-off-by: Helge Deller <deller@gmx.de>
2022-05-16 15:14:47 +00:00
if ( WARN_ON ( ! pfn_valid ( pfn ) ) )
return ;
if ( parisc_requires_coherency ( ) )
flush_user_cache_page ( vma , vmaddr ) ;
else
__flush_cache_page ( vma , vmaddr , PFN_PHYS ( pfn ) ) ;
}
void flush_anon_page ( struct vm_area_struct * vma , struct page * page , unsigned long vmaddr )
{
if ( ! PageAnon ( page ) )
return ;
if ( parisc_requires_coherency ( ) ) {
2022-06-18 15:14:34 +00:00
if ( vma - > vm_flags & VM_SHARED )
flush_data_cache ( ) ;
else
flush_user_cache_page ( vma , vmaddr ) ;
parisc: Rewrite cache flush code for PA8800/PA8900
Originally, I was convinced that we needed to use tmpalias flushes
everwhere, for both user and kernel flushes. However, when I modified
flush_kernel_dcache_page_addr, to use a tmpalias flush, my c8000
would crash quite early when booting.
The PDC returns alias values of 0 for the icache and dcache. This
indicates that either the alias boundary is greater than 16MB or
equivalent aliasing doesn't work. I modified the tmpalias code to
make it easy to try alternate boundaries. I tried boundaries up to
128MB but still kernel tmpalias flushes didn't work on c8000.
This led me to conclude that tmpalias flushes don't work on PA8800
and PA8900 machines, and that we needed to flush directly using the
virtual address of user and kernel pages. This is likely the major
cause of instability on the c8000 and rp34xx machines.
Flushing user pages requires doing a temporary context switch as we
have to flush pages that don't belong to the current context. Further,
we have to deal with pages that aren't present. If a page isn't
present, the flush instructions fault on every line.
Other code has been rearranged and simplified based on testing. For
example, I introduced a flush_cache_dup_mm routine. flush_cache_mm
and flush_cache_dup_mm differ in that flush_cache_mm calls
purge_cache_pages and flush_cache_dup_mm calls flush_cache_pages.
In some implementations, pdc is more efficient than fdc. Based on
my testing, I don't believe there's any performance benefit on the
c8000.
Signed-off-by: John David Anglin <dave.anglin@bell.net>
Signed-off-by: Helge Deller <deller@gmx.de>
2022-05-16 15:14:47 +00:00
return ;
2013-07-23 12:27:52 -04:00
}
parisc: Rewrite cache flush code for PA8800/PA8900
Originally, I was convinced that we needed to use tmpalias flushes
everwhere, for both user and kernel flushes. However, when I modified
flush_kernel_dcache_page_addr, to use a tmpalias flush, my c8000
would crash quite early when booting.
The PDC returns alias values of 0 for the icache and dcache. This
indicates that either the alias boundary is greater than 16MB or
equivalent aliasing doesn't work. I modified the tmpalias code to
make it easy to try alternate boundaries. I tried boundaries up to
128MB but still kernel tmpalias flushes didn't work on c8000.
This led me to conclude that tmpalias flushes don't work on PA8800
and PA8900 machines, and that we needed to flush directly using the
virtual address of user and kernel pages. This is likely the major
cause of instability on the c8000 and rp34xx machines.
Flushing user pages requires doing a temporary context switch as we
have to flush pages that don't belong to the current context. Further,
we have to deal with pages that aren't present. If a page isn't
present, the flush instructions fault on every line.
Other code has been rearranged and simplified based on testing. For
example, I introduced a flush_cache_dup_mm routine. flush_cache_mm
and flush_cache_dup_mm differ in that flush_cache_mm calls
purge_cache_pages and flush_cache_dup_mm calls flush_cache_pages.
In some implementations, pdc is more efficient than fdc. Based on
my testing, I don't believe there's any performance benefit on the
c8000.
Signed-off-by: John David Anglin <dave.anglin@bell.net>
Signed-off-by: Helge Deller <deller@gmx.de>
2022-05-16 15:14:47 +00:00
flush_tlb_page ( vma , vmaddr ) ;
preempt_disable ( ) ;
flush_dcache_page_asm ( page_to_phys ( page ) , vmaddr ) ;
preempt_enable ( ) ;
2006-12-12 05:51:54 -08:00
}
2017-03-11 18:03:34 -05:00
void flush_kernel_vmap_range ( void * vaddr , int size )
{
unsigned long start = ( unsigned long ) vaddr ;
2018-02-27 08:16:07 -05:00
unsigned long end = start + size ;
2017-03-11 18:03:34 -05:00
2018-02-27 08:16:07 -05:00
if ( ( ! IS_ENABLED ( CONFIG_SMP ) | | ! arch_irqs_disabled ( ) ) & &
( unsigned long ) size > = parisc_cache_flush_threshold ) {
flush_tlb_kernel_range ( start , end ) ;
2017-03-11 18:03:34 -05:00
flush_data_cache ( ) ;
2018-02-27 08:16:07 -05:00
return ;
}
2022-03-27 18:53:42 +02:00
flush_kernel_dcache_range_asm ( start , end ) ;
flush_tlb_kernel_range ( start , end ) ;
2017-03-11 18:03:34 -05:00
}
EXPORT_SYMBOL ( flush_kernel_vmap_range ) ;
void invalidate_kernel_vmap_range ( void * vaddr , int size )
{
unsigned long start = ( unsigned long ) vaddr ;
2018-02-27 08:16:07 -05:00
unsigned long end = start + size ;
2017-03-11 18:03:34 -05:00
2022-03-30 14:42:30 +00:00
/* Ensure DMA is complete */
asm_syncdma ( ) ;
2018-02-27 08:16:07 -05:00
if ( ( ! IS_ENABLED ( CONFIG_SMP ) | | ! arch_irqs_disabled ( ) ) & &
( unsigned long ) size > = parisc_cache_flush_threshold ) {
flush_tlb_kernel_range ( start , end ) ;
2017-03-11 18:03:34 -05:00
flush_data_cache ( ) ;
2018-02-27 08:16:07 -05:00
return ;
}
2022-03-27 18:53:42 +02:00
purge_kernel_dcache_range_asm ( start , end ) ;
flush_tlb_kernel_range ( start , end ) ;
2017-03-11 18:03:34 -05:00
}
EXPORT_SYMBOL ( invalidate_kernel_vmap_range ) ;