lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <1353003204.18025.109.camel@gandalf.local.home>
Date:	Thu, 15 Nov 2012 13:13:24 -0500
From:	Steven Rostedt <rostedt@...dmis.org>
To:	Frederic Weisbecker <fweisbec@...il.com>
Cc:	Ingo Molnar <mingo@...nel.org>,
	LKML <linux-kernel@...r.kernel.org>,
	Peter Zijlstra <peterz@...radead.org>,
	Thomas Gleixner <tglx@...utronix.de>,
	Andrew Morton <akpm@...ux-foundation.org>,
	Paul Gortmaker <paul.gortmaker@...driver.com>
Subject: Re: [PATCH RFC] irq_work: Flush work on CPU_DYING (was: Re: [PATCH
 7/7] printk: Wake up klogd using irq_work)

On Thu, 2012-11-15 at 11:34 -0500, Steven Rostedt wrote:


Frederic,

Please add this one fix below:

> Index: linux-rt.git/kernel/irq_work.c
> ===================================================================
> --- linux-rt.git.orig/kernel/irq_work.c
> +++ linux-rt.git/kernel/irq_work.c
> @@ -14,6 +14,7 @@
>  #include <linux/irqflags.h>
>  #include <linux/sched.h>
>  #include <linux/tick.h>
> +#include <linux/cpu.h>
>  #include <asm/processor.h>
>  
> 
> @@ -105,11 +106,7 @@ bool irq_work_needs_cpu(void)
>  	return true;
>  }
>  
> -/*
> - * Run the irq_work entries on this cpu. Requires to be ran from hardirq
> - * context with local IRQs disabled.
> - */
> -void irq_work_run(void)
> +static void __irq_work_run(void)
>  {
>  	unsigned long flags;
>  	struct irq_work *work;
> @@ -128,7 +125,6 @@ void irq_work_run(void)
>  	if (llist_empty(this_list))
>  		return;
>  
> -	BUG_ON(!in_irq());
>  	BUG_ON(!irqs_disabled());
>  
>  	llnode = llist_del_all(this_list);
> @@ -155,8 +151,23 @@ void irq_work_run(void)
>  		(void)cmpxchg(&work->flags, flags, flags & ~IRQ_WORK_BUSY);
>  	}
>  }
> +
> +/*
> + * Run the irq_work entries on this cpu. Requires to be ran from hardirq
> + * context with local IRQs disabled.
> + */
> +void irq_work_run(void)
> +{
> +	BUG_ON(!in_irq());
> +	__irq_work_run();
> +}
>  EXPORT_SYMBOL_GPL(irq_work_run);

#ifdef CONFIG_HOTPLUG_CPU
>  
> +static void irq_work_run_cpu_down(void)
> +{
> +	__irq_work_run();
> +}
#endif

Or just move the function into the #ifdef that is below.

-- Steve

> +
>  /*
>   * Synchronize against the irq_work @entry, ensures the entry is not
>   * currently in use.
> @@ -169,3 +180,35 @@ void irq_work_sync(struct irq_work *work
>  		cpu_relax();
>  }
>  EXPORT_SYMBOL_GPL(irq_work_sync);
> +
> +#ifdef CONFIG_HOTPLUG_CPU
> +static int irq_work_cpu_notify(struct notifier_block *self,
> +			       unsigned long action, void *hcpu)
> +{
> +	long cpu = (long)hcpu;
> +
> +	switch (action) {
> +	case CPU_DYING:
> +		/* Called from stop_machine */
> +		if (WARN_ON_ONCE(cpu != smp_processor_id()))
> +			break;
> +		irq_work_run_cpu_down();
> +		break;
> +	default:
> +		break;
> +	}
> +	return NOTIFY_OK;
> +}
> +
> +static struct notifier_block cpu_notify;
> +
> +static __init int irq_work_init_cpu_notifier(void)
> +{
> +	cpu_notify.notifier_call = irq_work_cpu_notify;
> +	cpu_notify.priority = 0;
> +	register_cpu_notifier(&cpu_notify);
> +	return 0;
> +}
> +device_initcall(irq_work_init_cpu_notifier);
> +
> +#endif /* CONFIG_HOTPLUG_CPU */
> 


--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ