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: <20090203121041.23d440be.akpm@linux-foundation.org>
Date:	Tue, 3 Feb 2009 12:10:41 -0800
From:	Andrew Morton <akpm@...ux-foundation.org>
To:	Davide Libenzi <davidel@...ilserver.org>
Cc:	linux-kernel@...r.kernel.org, torvalds@...ux-foundation.org,
	alan@...rguk.ukuu.org.uk, mingo@...e.hu, davem@...emloft.net
Subject: Re: [patch 2/6] epoll keyed wakeups v2 - introduce new *_poll()
 wakeup macros

On Tue, 3 Feb 2009 11:20:46 -0800 (PST)
Davide Libenzi <davidel@...ilserver.org> wrote:

> On Tue, 3 Feb 2009, Davide Libenzi wrote:
> 
> > On Tue, 3 Feb 2009, Andrew Morton wrote:
> > 
> > > On Sun, 01 Feb 2009 12:04:23 -0800 Davide Libenzi <davidel@...ilserver.org> wrote:
> > > 
> > > > +#define wake_up_nested_poll(x, m, s)					\
> > > > +do {									\
> > > > +	unsigned long flags;						\
> > > > +									\
> > > > +	spin_lock_irqsave_nested(&(x)->lock, flags, (s));		\
> > > > +	wake_up_locked_poll(x, m);					\
> > > > +	spin_unlock_irqrestore(&(x)->lock, flags);			\
> > > > +} while (0)
> > > 
> > > I had to go and find the callsite to work out the type of `x' :(
> > > 
> > > - this macro can be passed the address of any structure which has a
> > >   `spinlock_t lock;' in it, which seems strange.
> > > 
> > > - It references its first arg three times.
> > > 
> > > Is there any reason why we can't implement this in C?  
> > 
> > I don't see any reason why these two couldn't be normal functions (I 
> > just referenced wake_up_nested(), that was a macro in the first place). 
> 
> Actually reading the comments helps :) It triggers an include-hell, if you 
> make them inline. Since they're lockdep debug thingies, I think it's kinda 
> wasted turn them into non-inline real functions, so they'd better remain 
> macros IMO.
> 

ho hum.  I think it'd be worth at least renaming the arguments to
something less daft, for readability reasons.

One could also do

do {
	wait_queue_head_t *__wqh = x;
	<use __wqh>
}

which would provide typechecking of the first arg (so people can no
longer "pass the address of any structure which has a `spinlock_t
lock;' in it") and which fixes the multiple-references-to-an-argument
issue.


--
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