From owner-svn-src-head@freebsd.org Sun Jun 18 07:16:11 2017 Return-Path: Delivered-To: svn-src-head@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id AAD40D8AEDD; Sun, 18 Jun 2017 07:16:11 +0000 (UTC) (envelope-from melounmichal@gmail.com) Received: from mail-wm0-x241.google.com (mail-wm0-x241.google.com [IPv6:2a00:1450:400c:c09::241]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (Client CN "smtp.gmail.com", Issuer "Google Internet Authority G2" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4BC87296D; Sun, 18 Jun 2017 07:16:11 +0000 (UTC) (envelope-from melounmichal@gmail.com) Received: by mail-wm0-x241.google.com with SMTP id 70so11653267wme.1; Sun, 18 Jun 2017 00:16:11 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=from:reply-to:subject:to:references:message-id:date:user-agent :mime-version:in-reply-to:content-language:content-transfer-encoding; bh=RlTdsIuSaZu2zEEObbHS/g0vTEO2YClyA6AY2gjwfI8=; b=h6+sGpwcg3xFeVyXyVuXL7eBXTFCcbRnsK3dfu29nfM10hQmjkUCfnafqgpWf+cMjn QfQxCnbRBELSSfkrc8ar43nu4kFbHIjSLbFgwkHr24rfXAO9xXqYXOmB0rJSDklgGOwR LcQ10y7Cl4MSkEbEyWIbGzDnC2eIOS2sx1XCO6CUfdWQoRWW4c9PHM5CBILFAOgdaV09 CebC1GPQ2Ht0/vPr4cDCUS9bu9mNyWN3tdx6Y3ldBag8C1FUs9mbS0J+Pj2x5OaPec2Y nEn2B/BIAZxJEpD50tNmqzPG6kDSQosVh0q3e/FhghnF/MAVzHAA4qwETw3/pFmtgYX7 VhZw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:reply-to:subject:to:references:message-id :date:user-agent:mime-version:in-reply-to:content-language :content-transfer-encoding; bh=RlTdsIuSaZu2zEEObbHS/g0vTEO2YClyA6AY2gjwfI8=; b=qhClYZ4Ciwp5lyx/Oo7NQPMIa9TY85S+1jmylhQREqIw+sS2nUr41D9uodGbStqf/O GCvWvpcbqrgwrGFWSOUStY6kachWBwjdNicSOG2Yi2f53qygX4JQwQVrPhG6WPTuLxkT VqrnCRRfM/UygTxj4jyd8+xHGv3DsPWvpjE3btZM4jgNAvtH4X4sq1olVRQQBCkBZBNS u7FZcktmhBWZzkNWGS2GGO9btgxj/sSwy/26ruxwHIgGpD1dvkUEldtImzcNiW4NL3BL 20KwWABvSgVZGAJ31TWu8FE+3MZ0PfZHWion3f3RuHVmMMBCP/V9upBXi+mjtz+mPVtT DMEw== X-Gm-Message-State: AKS2vOxRPwX5kKgO4nWz6BGGeudf818W+/8ZaNXTB9IZ+8cskTlOeYhJ 65sfn+cXtHtdzXpSlkqu/Q== X-Received: by 10.80.162.38 with SMTP id 35mr12537591edl.99.1497770168471; Sun, 18 Jun 2017 00:16:08 -0700 (PDT) Received: from [88.208.79.100] (halouny.humusoft.cz. [88.208.79.100]) by smtp.gmail.com with ESMTPSA id h57sm3941725edh.52.2017.06.18.00.16.07 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Sun, 18 Jun 2017 00:16:07 -0700 (PDT) From: Michal Meloun X-Google-Original-From: Michal Meloun Reply-To: meloun.michal@gmail.com Subject: Re: svn commit: r320062 - in head/sys: fs/nfs fs/nfsclient kern sys To: Rick Macklem , src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org References: <201706172224.v5HMOJoV090858@repo.freebsd.org> Message-ID: Date: Sun, 18 Jun 2017 09:16:07 +0200 User-Agent: Mozilla/5.0 (Windows NT 10.0; WOW64; rv:52.0) Gecko/20100101 Thunderbird/52.2.0 MIME-Version: 1.0 In-Reply-To: <201706172224.v5HMOJoV090858@repo.freebsd.org> Content-Type: text/plain; charset=utf-8 Content-Language: en-US Content-Transfer-Encoding: 7bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 18 Jun 2017 07:16:11 -0000 On 18.06.2017 0:24, Rick Macklem wrote: > Author: rmacklem > Date: Sat Jun 17 22:24:19 2017 > New Revision: 320062 > URL: https://svnweb.freebsd.org/changeset/base/320062 > > Log: > Make MAXBCACHEBUF a tunable called vfs.maxbcachebuf. > > By making MAXBCACHEBUF a tunable, it can be increased to allow for > larger read/write data sizes for the NFS client. > The tunable is limited to MAXPHYS, which is currently 128K. > Making MAXPHYS a tunable or increasing its value is being discussed, > since it would be nice to support a read/write data size of 1Mbyte > for the NFS client when mounting the AmazonEFS file service. > > Reviewed by: kib > MFC after: 2 weeks > Relnotes: yes > Differential Revision: https://reviews.freebsd.org/D10991 > > Modified: > head/sys/fs/nfs/nfs_commonkrpc.c > head/sys/fs/nfs/nfsport.h > head/sys/fs/nfsclient/nfs_clrpcops.c > head/sys/kern/vfs_bio.c > head/sys/sys/param.h > This one breaks armv6 kernel: cc -target armv6-gnueabihf-freebsd12.0 --sysroot=/usr2/Meloun/obj//arm.armv6/usr2/Meloun/git/tegra/tmp -B/usr2/Meloun/obj//arm.armv6/usr2/Meloun/git/tegra/tmp/usr/bin -c -x assembler-with-cpp -DLOCORE -O -pipe -g -nostdinc -I. -I/usr2/Meloun/git/tegra/sys -I/usr2/Meloun/git/tegra/sys/contrib/libfdt -I/usr2/Meloun/git/tegra/sys/gnu/dts/include -D_KERNEL -DHAVE_KERNEL_OPTION_HEADERS -include opt_global.h -march=armv7a -funwind-tables -MD -MF.depend.elf_note.o -MTelf_note.o -ffreestanding -fwrapv -gdwarf-2 -Wall -Wredundant-decls -Wnested-externs -Wstrict-prototypes -Wmissing-prototypes -Wpointer-arith -Winline -Wcast-qual -Wundef -Wno-pointer-sign -D__printf__=__freebsd_kprintf__ -Wmissing-include-dirs -fdiagnostics-show-option -Wno-unknown-pragmas -Wno-error-tautological-compare -Wno-error-empty-body -Wno-error-parentheses-equality -Wno-error-unused-function -Wno-error-pointer-sign -Wno-error-shift-negative-value -Wno-error-address-of-packed-member -mfpu=none -std=iso9899:1999 -Werror /usr2/Meloun/git/tegra/sys/arm/arm/elf_note.S /usr2/Meloun/git/tegra/sys/sys/param.h:272:12: error: unexpected token in argument list extern int maxbcachebuf; ^ /usr2/Meloun/git/tegra/sys/arm/arm/elf_note.S:35:1: warning: DWARF2 only supports one section per compilation unit .pushsection .note.tag ; .balign 4 ; .long 2f - 1f ; .long 4f - 3f ; .long 1 ; 1: .asciz "FreeBSD" ; 2: .balign 4 ; 3: .long 1200033 ; 4: .balign 4 ; .popsection; ^ *** Error code 1 Michal > Modified: head/sys/fs/nfs/nfs_commonkrpc.c > ============================================================================== > --- head/sys/fs/nfs/nfs_commonkrpc.c Sat Jun 17 20:33:11 2017 (r320061) > +++ head/sys/fs/nfs/nfs_commonkrpc.c Sat Jun 17 22:24:19 2017 (r320062) > @@ -161,7 +161,7 @@ newnfs_connect(struct nfsmount *nmp, struct nfssockreq > struct ucred *cred, NFSPROC_T *p, int callback_retry_mult) > { > int rcvreserve, sndreserve; > - int pktscale; > + int pktscale, pktscalesav; > struct sockaddr *saddr; > struct ucred *origcred; > CLIENT *client; > @@ -210,6 +210,7 @@ newnfs_connect(struct nfsmount *nmp, struct nfssockreq > pktscale = 2; > if (pktscale > 64) > pktscale = 64; > + pktscalesav = pktscale; > /* > * soreserve() can fail if sb_max is too small, so shrink pktscale > * and try again if there is an error. > @@ -228,8 +229,12 @@ newnfs_connect(struct nfsmount *nmp, struct nfssockreq > goto out; > } > do { > - if (error != 0 && pktscale > 2) > + if (error != 0 && pktscale > 2) { > + if (nmp != NULL && nrp->nr_sotype == SOCK_STREAM && > + pktscale == pktscalesav) > + printf("Consider increasing kern.ipc.maxsockbuf\n"); > pktscale--; > + } > if (nrp->nr_sotype == SOCK_DGRAM) { > if (nmp != NULL) { > sndreserve = (NFS_MAXDGRAMDATA + NFS_MAXPKTHDR) * > @@ -243,15 +248,19 @@ newnfs_connect(struct nfsmount *nmp, struct nfssockreq > if (nrp->nr_sotype != SOCK_STREAM) > panic("nfscon sotype"); > if (nmp != NULL) { > - sndreserve = (NFS_MAXBSIZE + NFS_MAXPKTHDR + > + sndreserve = (NFS_MAXBSIZE + NFS_MAXXDR + > sizeof (u_int32_t)) * pktscale; > - rcvreserve = (NFS_MAXBSIZE + NFS_MAXPKTHDR + > + rcvreserve = (NFS_MAXBSIZE + NFS_MAXXDR + > sizeof (u_int32_t)) * pktscale; > } else { > sndreserve = rcvreserve = 1024 * pktscale; > } > } > error = soreserve(so, sndreserve, rcvreserve); > + if (error != 0 && nmp != NULL && nrp->nr_sotype == SOCK_STREAM && > + pktscale <= 2) > + printf("Must increase kern.ipc.maxsockbuf or reduce" > + " rsize, wsize\n"); > } while (error != 0 && pktscale > 2); > soclose(so); > if (error) { > > Modified: head/sys/fs/nfs/nfsport.h > ============================================================================== > --- head/sys/fs/nfs/nfsport.h Sat Jun 17 20:33:11 2017 (r320061) > +++ head/sys/fs/nfs/nfsport.h Sat Jun 17 22:24:19 2017 (r320062) > @@ -1016,7 +1016,7 @@ struct nfsreq { > }; > > #ifndef NFS_MAXBSIZE > -#define NFS_MAXBSIZE MAXBCACHEBUF > +#define NFS_MAXBSIZE (maxbcachebuf) > #endif > > /* > > Modified: head/sys/fs/nfsclient/nfs_clrpcops.c > ============================================================================== > --- head/sys/fs/nfsclient/nfs_clrpcops.c Sat Jun 17 20:33:11 2017 (r320061) > +++ head/sys/fs/nfsclient/nfs_clrpcops.c Sat Jun 17 22:24:19 2017 (r320062) > @@ -4625,7 +4625,7 @@ nfsrpc_createsession(struct nfsmount *nmp, struct nfsc > struct nfssockreq *nrp, uint32_t sequenceid, int mds, struct ucred *cred, > NFSPROC_T *p) > { > - uint32_t crflags, *tl; > + uint32_t crflags, maxval, *tl; > struct nfsrv_descript nfsd; > struct nfsrv_descript *nd = &nfsd; > int error, irdcnt; > @@ -4643,8 +4643,8 @@ nfsrpc_createsession(struct nfsmount *nmp, struct nfsc > /* Fill in fore channel attributes. */ > NFSM_BUILD(tl, uint32_t *, 7 * NFSX_UNSIGNED); > *tl++ = 0; /* Header pad size */ > - *tl++ = txdr_unsigned(100000); /* Max request size */ > - *tl++ = txdr_unsigned(100000); /* Max response size */ > + *tl++ = txdr_unsigned(nmp->nm_wsize + NFS_MAXXDR);/* Max request size */ > + *tl++ = txdr_unsigned(nmp->nm_rsize + NFS_MAXXDR);/* Max reply size */ > *tl++ = txdr_unsigned(4096); /* Max response size cached */ > *tl++ = txdr_unsigned(20); /* Max operations */ > *tl++ = txdr_unsigned(64); /* Max slots */ > @@ -4691,7 +4691,26 @@ nfsrpc_createsession(struct nfsmount *nmp, struct nfsc > > /* Get the fore channel slot count. */ > NFSM_DISSECT(tl, uint32_t *, 7 * NFSX_UNSIGNED); > - tl += 3; /* Skip the other counts. */ > + tl++; /* Skip the header pad size. */ > + > + /* Make sure nm_wsize is small enough. */ > + maxval = fxdr_unsigned(uint32_t, *tl++); > + while (maxval < nmp->nm_wsize + NFS_MAXXDR) { > + if (nmp->nm_wsize > 8096) > + nmp->nm_wsize /= 2; > + else > + break; > + } > + > + /* Make sure nm_rsize is small enough. */ > + maxval = fxdr_unsigned(uint32_t, *tl++); > + while (maxval < nmp->nm_rsize + NFS_MAXXDR) { > + if (nmp->nm_rsize > 8096) > + nmp->nm_rsize /= 2; > + else > + break; > + } > + > sep->nfsess_maxcache = fxdr_unsigned(int, *tl++); > tl++; > sep->nfsess_foreslots = fxdr_unsigned(uint16_t, *tl++); > > Modified: head/sys/kern/vfs_bio.c > ============================================================================== > --- head/sys/kern/vfs_bio.c Sat Jun 17 20:33:11 2017 (r320061) > +++ head/sys/kern/vfs_bio.c Sat Jun 17 22:24:19 2017 (r320062) > @@ -131,6 +131,7 @@ static void bufkva_reclaim(vmem_t *, int); > static void bufkva_free(struct buf *); > static int buf_import(void *, void **, int, int); > static void buf_release(void *, void **, int); > +static void maxbcachebuf_adjust(void); > > #if defined(COMPAT_FREEBSD4) || defined(COMPAT_FREEBSD5) || \ > defined(COMPAT_FREEBSD6) || defined(COMPAT_FREEBSD7) > @@ -245,6 +246,9 @@ SYSCTL_LONG(_vfs, OID_AUTO, barrierwrites, CTLFLAG_RW, > SYSCTL_INT(_vfs, OID_AUTO, unmapped_buf_allowed, CTLFLAG_RD, > &unmapped_buf_allowed, 0, > "Permit the use of the unmapped i/o"); > +int maxbcachebuf = MAXBCACHEBUF; > +SYSCTL_INT(_vfs, OID_AUTO, maxbcachebuf, CTLFLAG_RDTUN, &maxbcachebuf, 0, > + "Maximum size of a buffer cache block"); > > /* > * This lock synchronizes access to bd_request. > @@ -847,6 +851,29 @@ bd_wakeup(void) > } > > /* > + * Adjust the maxbcachbuf tunable. > + */ > +static void > +maxbcachebuf_adjust(void) > +{ > + int i; > + > + /* > + * maxbcachebuf must be a power of 2 >= MAXBSIZE. > + */ > + i = 2; > + while (i * 2 <= maxbcachebuf) > + i *= 2; > + maxbcachebuf = i; > + if (maxbcachebuf < MAXBSIZE) > + maxbcachebuf = MAXBSIZE; > + if (maxbcachebuf > MAXPHYS) > + maxbcachebuf = MAXPHYS; > + if (bootverbose != 0 && maxbcachebuf != MAXBCACHEBUF) > + printf("maxbcachebuf=%d\n", maxbcachebuf); > +} > + > +/* > * bd_speedup - speedup the buffer cache flushing code > */ > void > @@ -893,6 +920,7 @@ kern_vfs_bio_buffer_alloc(caddr_t v, long physmem_est) > */ > physmem_est = physmem_est * (PAGE_SIZE / 1024); > > + maxbcachebuf_adjust(); > /* > * The nominal buffer size (and minimum KVA allocation) is BKVASIZE. > * For the first 64MB of ram nominally allocate sufficient buffers to > @@ -1003,7 +1031,9 @@ bufinit(void) > struct buf *bp; > int i; > > - CTASSERT(MAXBCACHEBUF >= MAXBSIZE); > + KASSERT(maxbcachebuf >= MAXBSIZE, > + ("maxbcachebuf (%d) must be >= MAXBSIZE (%d)\n", maxbcachebuf, > + MAXBSIZE)); > mtx_init(&bqlocks[QUEUE_DIRTY], "bufq dirty lock", NULL, MTX_DEF); > mtx_init(&bqlocks[QUEUE_EMPTY], "bufq empty lock", NULL, MTX_DEF); > for (i = QUEUE_CLEAN; i < QUEUE_CLEAN + CLEAN_QUEUES; i++) > @@ -1050,7 +1080,7 @@ bufinit(void) > * PAGE_SIZE. > */ > maxbufspace = (long)nbuf * BKVASIZE; > - hibufspace = lmax(3 * maxbufspace / 4, maxbufspace - MAXBCACHEBUF * 10); > + hibufspace = lmax(3 * maxbufspace / 4, maxbufspace - maxbcachebuf * 10); > lobufspace = (hibufspace / 20) * 19; /* 95% */ > bufspacethresh = lobufspace + (hibufspace - lobufspace) / 2; > > @@ -1062,9 +1092,9 @@ bufinit(void) > * The lower 1 MiB limit is the historical upper limit for > * hirunningspace. > */ > - hirunningspace = lmax(lmin(roundup(hibufspace / 64, MAXBCACHEBUF), > + hirunningspace = lmax(lmin(roundup(hibufspace / 64, maxbcachebuf), > 16 * 1024 * 1024), 1024 * 1024); > - lorunningspace = roundup((hirunningspace * 2) / 3, MAXBCACHEBUF); > + lorunningspace = roundup((hirunningspace * 2) / 3, maxbcachebuf); > > /* > * Limit the amount of malloc memory since it is wired permanently into > @@ -3484,9 +3514,9 @@ getblk(struct vnode *vp, daddr_t blkno, int size, int > KASSERT((flags & (GB_UNMAPPED | GB_KVAALLOC)) != GB_KVAALLOC, > ("GB_KVAALLOC only makes sense with GB_UNMAPPED")); > ASSERT_VOP_LOCKED(vp, "getblk"); > - if (size > MAXBCACHEBUF) > - panic("getblk: size(%d) > MAXBCACHEBUF(%d)\n", size, > - MAXBCACHEBUF); > + if (size > maxbcachebuf) > + panic("getblk: size(%d) > maxbcachebuf(%d)\n", size, > + maxbcachebuf); > if (!unmapped_buf_allowed) > flags &= ~(GB_UNMAPPED | GB_KVAALLOC); > > > Modified: head/sys/sys/param.h > ============================================================================== > --- head/sys/sys/param.h Sat Jun 17 20:33:11 2017 (r320061) > +++ head/sys/sys/param.h Sat Jun 17 22:24:19 2017 (r320062) > @@ -244,9 +244,7 @@ > * Filesystems can of course request smaller chunks. Actual > * backing memory uses a chunk size of a page (PAGE_SIZE). > * The default value here can be overridden on a per-architecture > - * basis by defining it in . This should > - * probably be done to increase its value, when MAXBCACHEBUF is > - * defined as a larger value in . > + * basis by defining it in . > * > * If you make BKVASIZE too small you risk seriously fragmenting > * the buffer KVM map which may slow things down a bit. If you > @@ -265,6 +263,14 @@ > #define BKVASIZE 16384 /* must be power of 2 */ > #endif > #define BKVAMASK (BKVASIZE-1) > + > +/* > + * This variable is tuned via vfs.maxbcachebuf and is set to the value of > + * MAXBCACHEBUF by default. > + */ > +#ifdef _KERNEL > +extern int maxbcachebuf; > +#endif > > /* > * MAXPATHLEN defines the longest permissible path length after expanding >