Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit e90f8e16 authored by Maria Yu's avatar Maria Yu
Browse files

arm: highmem: Fix CPU_DYING callback for kmap



Add CPUHP_AP_KMAP_DYING state support instead of
use cpu notify for CPU_DYING which is deprecated.

Change-Id: Idaaf628ef4c89f361391151db523f5ffefc5bcc1
Signed-off-by: default avatarMaria Yu <aiquny@codeaurora.org>
parent d94e9af7
Loading
Loading
Loading
Loading
+2 −24
Original line number Original line Diff line number Diff line
@@ -150,7 +150,7 @@ void *kmap_atomic_pfn(unsigned long pfn)
}
}


#ifdef CONFIG_ARCH_WANT_KMAP_ATOMIC_FLUSH
#ifdef CONFIG_ARCH_WANT_KMAP_ATOMIC_FLUSH
static void kmap_remove_unused_cpu(int cpu)
int kmap_remove_unused_cpu(unsigned int cpu)
{
{
	int start_idx, idx, type;
	int start_idx, idx, type;


@@ -167,6 +167,7 @@ static void kmap_remove_unused_cpu(int cpu)
			set_top_pte(vaddr, __pte(0));
			set_top_pte(vaddr, __pte(0));
	}
	}
	pagefault_enable();
	pagefault_enable();
	return 0;
}
}


static void kmap_remove_unused(void *unused)
static void kmap_remove_unused(void *unused)
@@ -179,27 +180,4 @@ void kmap_atomic_flush_unused(void)
	on_each_cpu(kmap_remove_unused, NULL, 1);
	on_each_cpu(kmap_remove_unused, NULL, 1);
}
}


static int hotplug_kmap_atomic_callback(struct notifier_block *nfb,
					unsigned long action, void *hcpu)
{
	switch (action & (~CPU_TASKS_FROZEN)) {
	case CPU_DYING:
		kmap_remove_unused_cpu((int)hcpu);
		break;
	default:
		break;
	}

	return NOTIFY_OK;
}

static struct notifier_block hotplug_kmap_atomic_notifier = {
	.notifier_call = hotplug_kmap_atomic_callback,
};

static int __init init_kmap_atomic(void)
{
	return register_hotcpu_notifier(&hotplug_kmap_atomic_notifier);
}
early_initcall(init_kmap_atomic);
#endif
#endif
+1 −0
Original line number Original line Diff line number Diff line
@@ -59,6 +59,7 @@ enum cpuhp_state {
	CPUHP_AP_OFFLINE,
	CPUHP_AP_OFFLINE,
	CPUHP_AP_SCHED_STARTING,
	CPUHP_AP_SCHED_STARTING,
	CPUHP_AP_RCUTREE_DYING,
	CPUHP_AP_RCUTREE_DYING,
	CPUHP_AP_KMAP_DYING,
	CPUHP_AP_IRQ_GIC_STARTING,
	CPUHP_AP_IRQ_GIC_STARTING,
	CPUHP_AP_IRQ_GICV3_STARTING,
	CPUHP_AP_IRQ_GICV3_STARTING,
	CPUHP_AP_IRQ_HIP04_STARTING,
	CPUHP_AP_IRQ_HIP04_STARTING,
+5 −0
Original line number Original line Diff line number Diff line
@@ -41,6 +41,7 @@ void kmap_flush_unused(void);


#ifdef CONFIG_ARCH_WANT_KMAP_ATOMIC_FLUSH
#ifdef CONFIG_ARCH_WANT_KMAP_ATOMIC_FLUSH
void kmap_atomic_flush_unused(void);
void kmap_atomic_flush_unused(void);
int kmap_remove_unused_cpu(unsigned int cpu);
#else
#else
static inline void kmap_atomic_flush_unused(void) { }
static inline void kmap_atomic_flush_unused(void) { }
#endif
#endif
@@ -91,6 +92,10 @@ static inline void __kunmap_atomic(void *addr)


#endif /* CONFIG_HIGHMEM */
#endif /* CONFIG_HIGHMEM */


#if !defined(CONFIG_HIGHMEM) || !defined(CONFIG_ARCH_WANT_KMAP_ATOMIC_FLUSH)
static inline int kmap_remove_unused_cpu(unsigned int cpu) { return 0; }
#endif

#if defined(CONFIG_HIGHMEM) || defined(CONFIG_X86_32)
#if defined(CONFIG_HIGHMEM) || defined(CONFIG_X86_32)


DECLARE_PER_CPU(int, __kmap_atomic_idx);
DECLARE_PER_CPU(int, __kmap_atomic_idx);
+6 −0
Original line number Original line Diff line number Diff line
@@ -25,6 +25,7 @@
#include <linux/smpboot.h>
#include <linux/smpboot.h>
#include <linux/relay.h>
#include <linux/relay.h>
#include <linux/slab.h>
#include <linux/slab.h>
#include <linux/highmem.h>


#include <trace/events/power.h>
#include <trace/events/power.h>
#define CREATE_TRACE_POINTS
#define CREATE_TRACE_POINTS
@@ -1433,6 +1434,11 @@ static struct cpuhp_step cpuhp_ap_states[] = {
		.startup.single		= NULL,
		.startup.single		= NULL,
		.teardown.single	= rcutree_dying_cpu,
		.teardown.single	= rcutree_dying_cpu,
	},
	},
	[CPUHP_AP_KMAP_DYING] = {
		.name			= "KMAP:dying",
		.startup.single		= NULL,
		.teardown.single	= kmap_remove_unused_cpu,
	},
	/* Entry state on starting. Interrupts enabled from here on. Transient
	/* Entry state on starting. Interrupts enabled from here on. Transient
	 * state for synchronsization */
	 * state for synchronsization */
	[CPUHP_AP_ONLINE] = {
	[CPUHP_AP_ONLINE] = {