login
Header Space

 
 

Re: [PATCH 1/10] Add generic helpers for arch IPI function calls

Score:
Previous message: [thread] [date] [author]
Next message: [thread] [date] [author]
To: Peter Zijlstra <peterz@...>
Cc: Nick Piggin <npiggin@...>, Jens Axboe <jens.axboe@...>, <linux-kernel@...>, <linux-arch@...>, <jeremy@...>, <mingo@...>
Date: Friday, May 2, 2008 - 10:21 am

On Fri, May 02, 2008 at 02:59:29PM +0200, Peter Zijlstra wrote:

OK, so one approach would be to check for irqs being disabled,
perhaps as follows, on top of my previous patch:

		struct call_single_data *data = NULL;

		if (!wait) {
			data = kmalloc(sizeof(*data), GFP_ATOMIC);
			if (data)
				data->flags = CSD_FLAG_ALLOC;
		}
		if (!data) {
			if (unlikely(irqs_disabled())) {
				put_cpu();
				return -ENOMEM;
			}
			data = &d;
			data->flags = CSD_FLAG_WAIT;
		}

		data->func = func;
		data->info = info;
		generic_exec_single(cpu, data);

That would prevent -ENOMEM unless you invoked the function with irqs
disabled.  So normal callers would still see the current failure-free
semantics -- you really don't want to be inflicting failure when not
necessary, right?

There could only be one irq-disabled caller at a time, which could be
handled using a trylock, returning -EBUSY if the lock is already held.
Otherwise, you end up with the scenario called out above (which Keith
Ownens pointed out some years ago).

Does this approach make sense?

							Thanx, Paul
--
Previous message: [thread] [date] [author]
Next message: [thread] [date] [author]

Messages in current thread:
Re: [PATCH 1/10] Add generic helpers for arch IPI function c..., Jeremy Fitzhardinge, (Wed Apr 30, 6:56 pm)
Re: [PATCH 1/10] Add generic helpers for arch IPI function c..., Paul E. McKenney, (Fri May 2, 10:21 am)
Re: [PATCH 1/10] Add generic helpers for arch IPI function c..., Paul E. McKenney, (Wed Apr 30, 10:44 pm)
Re: [PATCH 2/10] x86: convert to generic helpers for IPI fun..., Jeremy Fitzhardinge, (Wed Apr 30, 5:39 pm)
Re: [PATCH 2/10] x86: convert to generic helpers for IPI fun..., Jeremy Fitzhardinge, (Tue Apr 29, 4:35 pm)
Re: [PATCH 2/10] x86: convert to generic helpers for IPI fun..., Jeremy Fitzhardinge, (Wed Apr 30, 10:51 am)
speck-geostationary