Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > linux.kernel > #1290065

Re: [PATCHSET v2] ->follow_link() without dropping from RCU mode

From Al Viro <viro@ZenIV.linux.org.uk>
Newsgroups linux.kernel
Subject Re: [PATCHSET v2] ->follow_link() without dropping from RCU mode
Date 2015-12-12 03:10 +0100
Message-ID <qEHNg-4i9-7@gated-at.bofh.it> (permalink)
References (4 earlier) <qDX7I-73a-7@gated-at.bofh.it> <qDZsR-8qg-3@gated-at.bofh.it> <qEla2-5TY-15@gated-at.bofh.it> <qEqCJ-167-7@gated-at.bofh.it> <qEF8J-2zj-3@gated-at.bofh.it>
Organization linux.* mail to news gateway

Show all headers | View raw


On Fri, Dec 11, 2015 at 11:16:24PM +0000, Al Viro wrote:

> #define set_delayed_type(call, f, arg) \
> 	sizeof(f(arg),0), \
> 	__set_delayed_type(call, __closure_##f, (void *)arg)
> 
> That could be reused for timers with typechecking - we have a lot of timer
> callbacks that start with casting the argument (unsigned long, not void *,
> but that's not a big deal) to whatever it is that callback really wants,
> with setup_timer() callers explicitly casting that whatever the callback
> really wants to unsigned long.  Which, of course, defeats the typechecking
> by both cc(1) and sparse(1)...
> 
> I still hope for better solution, though...  Comments?

Hmm...

#define set_delayed_type(call, f, arg)					\
 	(sizeof(f(arg),0),						\
	__set_delayed_type(call, ({					\
		void _(void *__) {f((typeof(arg))(unsigned long)__);}	\
		_;}), (void *)arg))

woult do nicely, but it's a gccism, and the one clang doesn't support ;-/
gcc support goes back at least to 4.1, not sure about the earlier branches
(and not at all sure how flaky it was/is, obviously).

But this thing works for e.g. f being void(char) and arg being char,
and AFAICS generates correct code - we end up with a stub like
_.1765:
        movsbl  %dil, %edi
        jmp     f
and its address gets stored in call->fn, which should DTRT on call...
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/

Back to linux.kernel | Previous | Next — Previous in thread | Next in thread | Find similar | Unroll thread


Thread

[PATCHSET v2] ->follow_link() without dropping from RCU mode Al Viro <viro@ZenIV.linux.org.uk> - 2015-12-09 06:40 +0100
  [PATCH v2 02/11] logfs: don't duplicate page_symlink_inode_operations Al Viro <viro@ZenIV.linux.org.uk> - 2015-12-09 06:40 +0100
  [PATCH v2 08/11] teach page_get_link() to work in RCU mode Al Viro <viro@ZenIV.linux.org.uk> - 2015-12-09 06:40 +0100
  [PATCH v2 10/11] teach proc_self_get_link()/proc_thread_self_get_link() to work in RCU mode Al Viro <viro@ZenIV.linux.org.uk> - 2015-12-09 06:40 +0100
  [PATCH v2 11/11] teach nfs_get_link() to work in RCU mode Al Viro <viro@ZenIV.linux.org.uk> - 2015-12-09 06:40 +0100
  [PATCH v2 06/11] don't put symlink bodies in pagecache into highmem Al Viro <viro@ZenIV.linux.org.uk> - 2015-12-09 06:40 +0100
  [PATCH v2 01/11] switch befs long symlinks to page_symlink_operations Al Viro <viro@ZenIV.linux.org.uk> - 2015-12-09 06:40 +0100
  [PATCH v2 03/11] udf: don't duplicate page_symlink_inode_operations Al Viro <viro@ZenIV.linux.org.uk> - 2015-12-09 06:40 +0100
  [PATCH v2 09/11] teach shmem_get_link() to work in RCU mode Al Viro <viro@ZenIV.linux.org.uk> - 2015-12-09 06:40 +0100
  [PATCH v2 04/11] ufs: get rid of ->setattr() for symlinks Al Viro <viro@ZenIV.linux.org.uk> - 2015-12-09 06:40 +0100
  Re: [PATCHSET v2] ->follow_link() without dropping from RCU mode Linus Torvalds <torvalds@linux-foundation.org> - 2015-12-09 18:30 +0100
    Re: [PATCHSET v2] ->follow_link() without dropping from RCU mode Al Viro <viro@ZenIV.linux.org.uk> - 2015-12-09 19:30 +0100
      Re: [PATCHSET v2] ->follow_link() without dropping from RCU mode Al Viro <viro@ZenIV.linux.org.uk> - 2015-12-10 01:20 +0100
        Re: [PATCHSET v2] ->follow_link() without dropping from RCU mode Al Viro <viro@ZenIV.linux.org.uk> - 2015-12-10 03:50 +0100
          Re: [PATCHSET v2] ->follow_link() without dropping from RCU mode Rasmus Villemoes <linux@rasmusvillemoes.dk> - 2015-12-11 08:50 +0100
            Re: [PATCHSET v2] ->follow_link() without dropping from RCU mode Al Viro <viro@ZenIV.linux.org.uk> - 2015-12-12 00:20 +0100
              Re: [PATCHSET v2] ->follow_link() without dropping from RCU mode Al Viro <viro@ZenIV.linux.org.uk> - 2015-12-12 03:10 +0100
                Re: [PATCHSET v2] ->follow_link() without dropping from RCU mode Rasmus Villemoes <linux@rasmusvillemoes.dk> - 2015-12-13 19:50 +0100
          Re: [PATCHSET v2] ->follow_link() without dropping from RCU mode Al Viro <viro@ZenIV.linux.org.uk> - 2015-12-13 04:50 +0100
  Re: [PATCHSET v2] ->follow_link() without dropping from RCU mode NeilBrown <neilb@suse.com> - 2015-12-09 23:00 +0100

csiph-web