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

Commit fe0f4976 authored by Martin Schwidefsky's avatar Martin Schwidefsky
Browse files

s390/nohz: use a per-cpu flag for arch_needs_cpu



Move the nohz_delay bit from the s390_idle data structure to the
per-cpu flags. Clear the nohz delay flag in __cpu_disable and
remove the cpu hotplug notifier that used to do this.

Signed-off-by: default avatarMartin Schwidefsky <schwidefsky@de.ibm.com>
parent a9b16499
Loading
Loading
Loading
Loading
+0 −8
Original line number Original line Diff line number Diff line
@@ -166,7 +166,6 @@ static inline clock_t cputime64_to_clock_t(cputime64_t cputime)
}
}


struct s390_idle_data {
struct s390_idle_data {
	int nohz_delay;
	unsigned int sequence;
	unsigned int sequence;
	unsigned long long idle_count;
	unsigned long long idle_count;
	unsigned long long idle_time;
	unsigned long long idle_time;
@@ -182,11 +181,4 @@ cputime64_t s390_get_idle_time(int cpu);


#define arch_idle_time(cpu) s390_get_idle_time(cpu)
#define arch_idle_time(cpu) s390_get_idle_time(cpu)


static inline int s390_nohz_delay(int cpu)
{
	return __get_cpu_var(s390_idle).nohz_delay != 0;
}

#define arch_needs_cpu(cpu) s390_nohz_delay(cpu)

#endif /* _S390_CPUTIME_H */
#endif /* _S390_CPUTIME_H */
+4 −0
Original line number Original line Diff line number Diff line
@@ -13,9 +13,11 @@


#define CIF_MCCK_PENDING	0	/* machine check handling is pending */
#define CIF_MCCK_PENDING	0	/* machine check handling is pending */
#define CIF_ASCE		1	/* user asce needs fixup / uaccess */
#define CIF_ASCE		1	/* user asce needs fixup / uaccess */
#define CIF_NOHZ_DELAY		2	/* delay HZ disable for a tick */


#define _CIF_MCCK_PENDING	(1<<CIF_MCCK_PENDING)
#define _CIF_MCCK_PENDING	(1<<CIF_MCCK_PENDING)
#define _CIF_ASCE		(1<<CIF_ASCE)
#define _CIF_ASCE		(1<<CIF_ASCE)
#define _CIF_NOHZ_DELAY		(1<<CIF_NOHZ_DELAY)




#ifndef __ASSEMBLY__
#ifndef __ASSEMBLY__
@@ -43,6 +45,8 @@ static inline int test_cpu_flag(int flag)
	return !!(S390_lowcore.cpu_flags & (1U << flag));
	return !!(S390_lowcore.cpu_flags & (1U << flag));
}
}


#define arch_needs_cpu() test_cpu_flag(CIF_NOHZ_DELAY)

/*
/*
 * Default implementation of macro that returns current
 * Default implementation of macro that returns current
 * instruction pointer ("program counter").
 * instruction pointer ("program counter").
+1 −1
Original line number Original line Diff line number Diff line
@@ -259,7 +259,7 @@ static irqreturn_t do_ext_interrupt(int irq, void *dummy)


	ext_code = *(struct ext_code *) &regs->int_code;
	ext_code = *(struct ext_code *) &regs->int_code;
	if (ext_code.code != EXT_IRQ_CLK_COMP)
	if (ext_code.code != EXT_IRQ_CLK_COMP)
		__get_cpu_var(s390_idle).nohz_delay = 1;
		set_cpu_flag(CIF_NOHZ_DELAY);


	index = ext_hash(ext_code.code);
	index = ext_hash(ext_code.code);
	rcu_read_lock();
	rcu_read_lock();
+1 −0
Original line number Original line Diff line number Diff line
@@ -720,6 +720,7 @@ int __cpu_disable(void)
	cregs[6]  &= ~0xff000000UL;	/* disable all I/O interrupts */
	cregs[6]  &= ~0xff000000UL;	/* disable all I/O interrupts */
	cregs[14] &= ~0x1f000000UL;	/* disable most machine checks */
	cregs[14] &= ~0x1f000000UL;	/* disable most machine checks */
	__ctl_load(cregs, 0, 15);
	__ctl_load(cregs, 0, 15);
	clear_cpu_flag(CIF_NOHZ_DELAY);
	return 0;
	return 0;
}
}


+1 −18
Original line number Original line Diff line number Diff line
@@ -163,7 +163,7 @@ void __kprobes vtime_stop_cpu(void)
	/* Wait for external, I/O or machine check interrupt. */
	/* Wait for external, I/O or machine check interrupt. */
	psw_mask = PSW_KERNEL_BITS | PSW_MASK_WAIT | PSW_MASK_DAT |
	psw_mask = PSW_KERNEL_BITS | PSW_MASK_WAIT | PSW_MASK_DAT |
		PSW_MASK_IO | PSW_MASK_EXT | PSW_MASK_MCHECK;
		PSW_MASK_IO | PSW_MASK_EXT | PSW_MASK_MCHECK;
	idle->nohz_delay = 0;
	clear_cpu_flag(CIF_NOHZ_DELAY);


	/* Call the assembler magic in entry.S */
	/* Call the assembler magic in entry.S */
	psw_idle(idle, psw_mask);
	psw_idle(idle, psw_mask);
@@ -378,25 +378,8 @@ void init_cpu_vtimer(void)
	set_vtimer(VTIMER_MAX_SLICE);
	set_vtimer(VTIMER_MAX_SLICE);
}
}


static int s390_nohz_notify(struct notifier_block *self, unsigned long action,
			    void *hcpu)
{
	struct s390_idle_data *idle;
	long cpu = (long) hcpu;

	idle = &per_cpu(s390_idle, cpu);
	switch (action & ~CPU_TASKS_FROZEN) {
	case CPU_DYING:
		idle->nohz_delay = 0;
	default:
		break;
	}
	return NOTIFY_OK;
}

void __init vtime_init(void)
void __init vtime_init(void)
{
{
	/* Enable cpu timer interrupts on the boot cpu. */
	/* Enable cpu timer interrupts on the boot cpu. */
	init_cpu_vtimer();
	init_cpu_vtimer();
	cpu_notifier(s390_nohz_notify, 0);
}
}
Loading