mirror of
git://git.yoctoproject.org/linux-yocto.git
synced 2026-01-27 12:47:24 +01:00
Fix TLB unification for cores with more than 64 TLB entries
-----BEGIN PGP SIGNATURE----- iQJOBAABCAA4FiEEbt46xwy6kEcDOXoUeZbBVTGwZHAFAmkrXGMaHHRzYm9nZW5k QGFscGhhLmZyYW5rZW4uZGUACgkQeZbBVTGwZHAZ3w/5Adn6Wb0zk1MAtreYjumI VzERvDnfCqJE4SjJf11Fhe1TvT7RLElIUU612ILdPh5OCL0zyPT0PtvX6LlvLCzQ YRTCXXFtybi57rvPtlDIBh0bXcsQskAoGPExMzBJ6Re5oeeyI7qM5P9BV4eYsQD4 tEM0RZKB0oPeUZ0p7Hq7F2xo1ZcJqFn14zAbf6ADHp+Xj1Kdal0FStTcLDMNdaKV QSZqxD26DZ7dCO9fEbDOO7Y/gdpLhPrN8q6rAexGlNwSFAqWWZ/1bY1a2b+oxcVN IyRqxhWwX6HTAzSab7VO/orT6HRCH3X50K7rXwEMGFhAjnyEcqRBhOiRDYtEJg87 AamDQ2IPCkzeIi8UVnzoWDtszcSPs5eFW5LTBdhDCLCkt+UTnU0bi34jS/K6LCpJ HiQ7BbjM36nwqo8goe5Udz9KOcwZLW1+5DaSPT0yazZyxbUqp2lrKrk8Ie6SDIxt QLzDxAlN56lrxfd8MVDOWIrtf9LYcfdxwHsrT937Fwl/eCg+OdicTsGBfTlHHBDE pxTYDIu74lluAyyk1TqSBoeO/qqXLBIs4EIu5IjEqZ/SQmAPxFvP5l5mj38Uz3uP f99jxtUSsc2dttmkAMrTtrdouYoYaaA2XbGFkE0JJYVGWLO8oyrEagGn5OClfdqQ 7jct1es16BKK85NWr8aUvu0= =8cjZ -----END PGP SIGNATURE----- Merge tag 'mips-fixes_6.18_2' of git://git.kernel.org/pub/scm/linux/kernel/git/mips/linux Pull MIPS fix from Thomas Bogendoerfer: "Fix TLB unification for cores with more than 64 TLB entries" * tag 'mips-fixes_6.18_2' of git://git.kernel.org/pub/scm/linux/kernel/git/mips/linux: MIPS: mm: kmalloc tlb_vpn array to avoid stack overflow
This commit is contained in:
commit
6bda50f433
|
|
@ -12,6 +12,7 @@
|
|||
#include <linux/init.h>
|
||||
#include <linux/sched.h>
|
||||
#include <linux/smp.h>
|
||||
#include <linux/memblock.h>
|
||||
#include <linux/mm.h>
|
||||
#include <linux/hugetlb.h>
|
||||
#include <linux/export.h>
|
||||
|
|
@ -522,17 +523,26 @@ static int r4k_vpn_cmp(const void *a, const void *b)
|
|||
* Initialise all TLB entries with unique values that do not clash with
|
||||
* what we have been handed over and what we'll be using ourselves.
|
||||
*/
|
||||
static void r4k_tlb_uniquify(void)
|
||||
static void __ref r4k_tlb_uniquify(void)
|
||||
{
|
||||
unsigned long tlb_vpns[1 << MIPS_CONF1_TLBS_SIZE];
|
||||
int tlbsize = current_cpu_data.tlbsize;
|
||||
bool use_slab = slab_is_available();
|
||||
int start = num_wired_entries();
|
||||
phys_addr_t tlb_vpn_size;
|
||||
unsigned long *tlb_vpns;
|
||||
unsigned long vpn_mask;
|
||||
int cnt, ent, idx, i;
|
||||
|
||||
vpn_mask = GENMASK(cpu_vmbits - 1, 13);
|
||||
vpn_mask |= IS_ENABLED(CONFIG_64BIT) ? 3ULL << 62 : 1 << 31;
|
||||
|
||||
tlb_vpn_size = tlbsize * sizeof(*tlb_vpns);
|
||||
tlb_vpns = (use_slab ?
|
||||
kmalloc(tlb_vpn_size, GFP_KERNEL) :
|
||||
memblock_alloc_raw(tlb_vpn_size, sizeof(*tlb_vpns)));
|
||||
if (WARN_ON(!tlb_vpns))
|
||||
return; /* Pray local_flush_tlb_all() is good enough. */
|
||||
|
||||
htw_stop();
|
||||
|
||||
for (i = start, cnt = 0; i < tlbsize; i++, cnt++) {
|
||||
|
|
@ -585,6 +595,10 @@ static void r4k_tlb_uniquify(void)
|
|||
tlbw_use_hazard();
|
||||
htw_start();
|
||||
flush_micro_tlb();
|
||||
if (use_slab)
|
||||
kfree(tlb_vpns);
|
||||
else
|
||||
memblock_free(tlb_vpns, tlb_vpn_size);
|
||||
}
|
||||
|
||||
/*
|
||||
|
|
|
|||
Loading…
Reference in New Issue
Block a user