netdev.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Benjamin LaHaise <ben@communityfibre.ca>
To: Jeff Moyer <jmoyer@redhat.com>
Cc: Christoph Hellwig <hch@lst.de>,
	linux-aio@kvack.org, Avi Kivity <avi@scylladb.com>,
	linux-fsdevel@vger.kernel.org, netdev@vger.kernel.org,
	linux-kernel@vger.kernel.org
Subject: Re: [PATCH 2/6] move _body_io_syscall to the generic syscall.h
Date: Fri, 5 Jan 2018 11:40:31 -0500	[thread overview]
Message-ID: <20180105164031.GK27850@kvack.org> (raw)
In-Reply-To: <x49tvw0z30y.fsf@segfault.boston.devel.redhat.com>

On Fri, Jan 05, 2018 at 11:25:17AM -0500, Jeff Moyer wrote:
> Christoph Hellwig <hch@lst.de> writes:
> 
> > This way it can be used for the fallback 6-argument version on
> > all architectures.
> >
> > Signed-off-by: Christoph Hellwig <hch@lst.de>
> 
> This is a strange way to do things.  However, I was never really sold on
> libaio having to implement its own system call wrappers.  That decision
> definitely resulted in some maintenance overhead.
> 
> Ben, what was your reasoning for not just using syscall?

The main issue was that glibc's pthreads implementation really sucked back
during initial development and there was a use-case for having the io_XXX
functions usable directly from clone()ed threads that didn't have all the
glibc pthread state setup for per-cpu areas to handle per-thread errno.
That made sense back then, but is rather silly today.

Technically, I'm not sure the generic syscall wrapper is safe to use.  The
io_XXX arch wrappers don't modify errno, while it appears the generic one
does.  That said, nobody has ever noticed...

		-ben

> -Jeff
> 
> > ---
> >  src/syscall-generic.h | 6 ------
> >  src/syscall.h         | 7 +++++++
> >  2 files changed, 7 insertions(+), 6 deletions(-)
> >
> > diff --git a/src/syscall-generic.h b/src/syscall-generic.h
> > index 24d7c7c..35b8580 100644
> > --- a/src/syscall-generic.h
> > +++ b/src/syscall-generic.h
> > @@ -2,12 +2,6 @@
> >  #include <unistd.h>
> >  #include <sys/syscall.h>
> >  
> > -#define _body_io_syscall(sname, args...) \
> > -{ \
> > -	int ret = syscall(__NR_##sname, ## args); \
> > -	return ret < 0 ? -errno : ret; \
> > -}
> > -
> >  #define io_syscall1(type,fname,sname,type1,arg1) \
> >  type fname(type1 arg1) \
> >  _body_io_syscall(sname, (long)arg1)
> > diff --git a/src/syscall.h b/src/syscall.h
> > index a2da030..3819519 100644
> > --- a/src/syscall.h
> > +++ b/src/syscall.h
> > @@ -10,6 +10,13 @@
> >  #define DEFSYMVER(compat_sym, orig_sym, ver_sym)	\
> >  	__asm__(".symver " SYMSTR(compat_sym) "," SYMSTR(orig_sym) "@@LIBAIO_" SYMSTR(ver_sym));
> >  
> > +/* generic fallback */
> > +#define _body_io_syscall(sname, args...) \
> > +{ \
> > +	int ret = syscall(__NR_##sname, ## args); \
> > +	return ret < 0 ? -errno : ret; \
> > +}
> > +
> >  #if defined(__i386__)
> >  #include "syscall-i386.h"
> >  #elif defined(__x86_64__)
> 

-- 
"Thought is the essence of where you are now."

--
To unsubscribe, send a message with 'unsubscribe linux-aio' in
the body to majordomo@kvack.org.  For more info on Linux AIO,
see: http://www.kvack.org/aio/
Don't email: <a href=mailto:"aart@kvack.org">aart@kvack.org</a>

  reply	other threads:[~2018-01-05 16:40 UTC|newest]

Thread overview: 14+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2018-01-04  8:03 libaio: resurrect aio poll and add io_pgetevents support Christoph Hellwig
2018-01-04  8:03 ` [PATCH 1/6] resurrect aio poll support Christoph Hellwig
2018-01-04  8:03 ` [PATCH 2/6] move _body_io_syscall to the generic syscall.h Christoph Hellwig
2018-01-05 16:25   ` Jeff Moyer
2018-01-05 16:40     ` Benjamin LaHaise [this message]
2018-01-05 22:49       ` Jeff Moyer
2018-01-04  8:03 ` [PATCH 3/6] provide a generic io_syscall6 Christoph Hellwig
2018-01-04  8:03 ` [PATCH 4/6] move the aio_ring defintion and empty check into a header Christoph Hellwig
2018-01-04  8:03 ` [PATCH 5/6] add support for io_pgetevents Christoph Hellwig
2018-01-04  8:03 ` [PATCH 6/6] add test for aio poll and io_pgetevents Christoph Hellwig
2018-01-04 10:24   ` Philippe Ombredanne
2018-01-04 10:29     ` Christoph Hellwig
2018-01-05 22:55   ` Jeff Moyer
2018-01-05 22:57 ` libaio: resurrect aio poll and add io_pgetevents support Jeff Moyer

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20180105164031.GK27850@kvack.org \
    --to=ben@communityfibre.ca \
    --cc=avi@scylladb.com \
    --cc=hch@lst.de \
    --cc=jmoyer@redhat.com \
    --cc=linux-aio@kvack.org \
    --cc=linux-fsdevel@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=netdev@vger.kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).