From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 64477 invoked by alias); 23 Sep 2016 14:24:47 -0000 Mailing-List: contact libc-alpha-help@sourceware.org; run by ezmlm Precedence: bulk List-Id: List-Subscribe: List-Archive: List-Post: List-Help: , Sender: libc-alpha-owner@sourceware.org Received: (qmail 64461 invoked by uid 89); 23 Sep 2016 14:24:46 -0000 Authentication-Results: sourceware.org; auth=none X-Virus-Found: No X-Spam-SWARE-Status: No, score=-1.4 required=5.0 tests=BAYES_00,RCVD_IN_DNSWL_NONE,RCVD_IN_SORBS_SPAM,SPF_PASS autolearn=no version=3.3.2 spammy= X-HELO: mail-yb0-f170.google.com X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:subject:to:references:cc:from:message-id:date :user-agent:mime-version:in-reply-to:content-transfer-encoding; bh=4PD38hCSvUdxSEosmGHmOlUBDYiAUokGUnNryYaQriQ=; b=LfqSHWNaxoSi2GcONymZ+lztTIou0445L4bbus0bXLeLCRpfGwoI+T3yzhstZeyhEZ Z4ZYj1xdEjRWxZVeRoCNYa7NU350SqguRaVytY1irJBjuUFbLLN67LzbbeosreFTrp2u 7w35PwhaNMMZCdEh7Q2GvLAAZf5azbYgHwXuJyfGcaMG0ZemCWTMJ2PrQSi8KVtuLeJm oV1PHwFsQJ/2tjg+k8YIUhbM0xZWx4P8MxLY4AzF5BPDApWJCxUaPmtHnCkIapqqawhD 9Ffd7TQQUjPuBmZVg8Wdwzj2NdTZ+Q5dhFjsEw3g9cbkFbTE+Sd9O+pVScc43BhH4Uu1 9N2w== X-Gm-Message-State: AE9vXwPrStOM3grbRbNioK/R+7dVBeKcXD4S5RS0obdRCCcIzspRshNduM9DXnhGPvwFdcoa X-Received: by 10.37.220.202 with SMTP id y193mr6053302ybe.13.1474640675175; Fri, 23 Sep 2016 07:24:35 -0700 (PDT) Subject: Re: [PATCH] Consolidate Linux readahead() implementations To: Yury Norov References: <1474577068-1781-1-git-send-email-ynorov@caviumnetworks.com> <827f758c-b744-22f2-5dbb-4471208cd6b2@linaro.org> <20160922232119.GA12837@yury-N73SV> <87k2e3jgh8.fsf@mid.deneb.enyo.de> <20160923124456.GA22674@yury-N73SV> <20160923141154.GA970@yury-N73SV> Cc: Florian Weimer , Chris Metcalf , libc-alpha@sourceware.org From: Adhemerval Zanella Message-ID: Date: Fri, 23 Sep 2016 14:24:00 -0000 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:45.0) Gecko/20100101 Thunderbird/45.2.0 MIME-Version: 1.0 In-Reply-To: <20160923141154.GA970@yury-N73SV> Content-Type: text/plain; charset=windows-1252 Content-Transfer-Encoding: 8bit X-SW-Source: 2016-09/txt/msg00494.txt.bz2 On 23/09/2016 11:11, Yury Norov wrote: > On Fri, Sep 23, 2016 at 10:32:35AM -0300, Adhemerval Zanella wrote: >> >> Indeed, unfortunately tile seems to get its own readahead definition. >> However I think it should not prevent us to use my previous strategy, >> we can follow the SH example for pread (where it adds a dummy argument >> before offset), and do something as: >> >> sysdeps/unix/sysv/linux/tile/readahead.c >> >> #include >> >> #ifndef _LP64 >> /* Although tile 32-bit ABI passed 64-bit arguments in even registers, >> readahead interface does not follow this convention. */ >> # undef __ALIGNMENT_ARG >> #endif >> >> #include > > Currently it looks like this to me (see below). If you think that separated file > is better than new option - I'm OK with it, but I think it's strange because in > other patches of series you introduce options (if I'm not mistake). I prefer to not add any more __ASSUME macro until it is more general and for this specific case (tile seems the only supported ABI that implements readhead different than usual ABI). > > We also have 2 another implementations - in linux/wordsize-64/syscalls.list > and linux/mips/mips64/n32/syscalls.list. > > I think wordsize-64 is safe to generalize, but I'm worry about mips64. If we'll > choose adding new options and so having a single file, it seems, we'll have to > add another option for mips64/n32, like this: My understanding is mipc64n32 adds it on syscall list to avoid current default Linux implementation where it splits the off64_t (since mips64n32 passes off64_t in only one register afaik). I think it is safe here, since SYSCALL_LL64 for mips64n32 will correctly pass only one argument instead of splitting it. > > #if __ASSUME_READAHEAD_NO_PAIRS > # define SYSCALL_LL64(val) (val) > #endif > > If we choose 3 implementations, we can introduce no option, but have > generic, tile and mips separated versions. > > Yury. > > -- > diff --git a/sysdeps/unix/sysv/linux/kernel-features.h b/sysdeps/unix/sysv/linux/kernel-features.h > index 71ce57a..ba7d745 100644 > --- a/sysdeps/unix/sysv/linux/kernel-features.h > +++ b/sysdeps/unix/sysv/linux/kernel-features.h > @@ -50,6 +50,11 @@ > #define __ASSUME_ST_INO_64_BIT 1 > #endif > > +#ifndef __ASSUME_READAHEAD_ALIGN > +/* readahead() adds padding to registers if this control is enabled. */ > +# define __ASSUME_READAHEAD_ALIGN 1 > +#endif > + > /* The statfs64 syscalls are available in 2.5.74 (but not for alpha). */ > #define __ASSUME_STATFS64 1 > > diff --git a/sysdeps/unix/sysv/linux/readahead.c b/sysdeps/unix/sysv/linux/readahead.c > index 92e5428..eea3142 100644 > --- a/sysdeps/unix/sysv/linux/readahead.c > +++ b/sysdeps/unix/sysv/linux/readahead.c > @@ -23,16 +23,20 @@ > #include > #include > > +#include > > #ifdef __NR_readahead > > +#if !__ASSUME_READAHEAD_ALIGN > +# undef __ALIGNMENT_ARG > +# define __ALIGNMENT_ARG > +#endif > + > ssize_t > __readahead (int fd, off64_t offset, size_t count) > { > - return INLINE_SYSCALL (readahead, 4, fd, > - __LONG_LONG_PAIR ((off_t) (offset >> 32), > - (off_t) (offset & 0xffffffff)), > - count); > + return INLINE_SYSCALL_CALL (readahead, fd, __ALIGNMENT_ARG > + SYSCALL_LL64 (offset)); > } > #else > ssize_t > diff --git a/sysdeps/unix/sysv/linux/tile/kernel-features.h b/sysdeps/unix/sysv/linux/tile/kernel-features.h > index ded0e43..15ad2d3 100644 > --- a/sysdeps/unix/sysv/linux/tile/kernel-features.h > +++ b/sysdeps/unix/sysv/linux/tile/kernel-features.h > @@ -24,4 +24,5 @@ > #ifndef _LP64 > # define __ASSUME_ALIGNED_REGISTER_PAIRS 1 > # define __ASSUME_FADVISE64_64_NO_ALIGN 1 > +# define __ASSUME_READAHEAD_ALIGN 0 > #endif >