From owner-svn-src-all@freebsd.org Sun Nov 29 01:30:17 2020 Return-Path: Delivered-To: svn-src-all@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id DDB66471C45; Sun, 29 Nov 2020 01:30:17 +0000 (UTC) (envelope-from mav@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4Ck9ls5kQlz3HRG; Sun, 29 Nov 2020 01:30:17 +0000 (UTC) (envelope-from mav@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id B768C1088; Sun, 29 Nov 2020 01:30:17 +0000 (UTC) (envelope-from mav@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id 0AT1UHUV000192; Sun, 29 Nov 2020 01:30:17 GMT (envelope-from mav@FreeBSD.org) Received: (from mav@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id 0AT1UHD1000191; Sun, 29 Nov 2020 01:30:17 GMT (envelope-from mav@FreeBSD.org) Message-Id: <202011290130.0AT1UHD1000191@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: mav set sender to mav@FreeBSD.org using -f From: Alexander Motin Date: Sun, 29 Nov 2020 01:30:17 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r368138 - head/sys/kern X-SVN-Group: head X-SVN-Commit-Author: mav X-SVN-Commit-Paths: head/sys/kern X-SVN-Commit-Revision: 368138 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 29 Nov 2020 01:30:17 -0000 Author: mav Date: Sun Nov 29 01:30:17 2020 New Revision: 368138 URL: https://svnweb.freebsd.org/changeset/base/368138 Log: Remove alignment requirements for KVA buffer mapping. After r368124 pbuf_zone has extra page to handle this particular case. Modified: head/sys/kern/kern_physio.c Modified: head/sys/kern/kern_physio.c ============================================================================== --- head/sys/kern/kern_physio.c Sun Nov 29 01:22:30 2020 (r368137) +++ head/sys/kern/kern_physio.c Sun Nov 29 01:30:17 2020 (r368138) @@ -30,11 +30,14 @@ __FBSDID("$FreeBSD$"); #include #include #include +#include #include #include #include +#include #include +#include #include #include @@ -107,7 +110,7 @@ physio(struct cdev *dev, struct uio *uio, int ioflag) pbuf = uma_zalloc(pbuf_zone, M_WAITOK); MPASS((pbuf->b_flags & B_MAXPHYS) != 0); sa = pbuf->b_data; - maxpages = btoc(maxphys); + maxpages = PBUF_PAGES; pages = pbuf->b_pages; } prot = VM_PROT_READ; @@ -147,28 +150,6 @@ physio(struct cdev *dev, struct uio *uio, int ioflag) bp->bio_length = dev->si_iosize_max; if (bp->bio_length > maxphys) bp->bio_length = maxphys; - - /* - * Make sure the pbuf can map the request. - * The pbuf has kvasize = maxphys, so a request - * larger than maxphys - PAGE_SIZE must be - * page aligned or it will be fragmented. - */ - poff = (vm_offset_t)base & PAGE_MASK; - if (pbuf && bp->bio_length + poff > pbuf->b_kvasize) { - if (dev->si_flags & SI_NOSPLIT) { - uprintf("%s: request ptr %p is not " - "on a page boundary; cannot split " - "request\n", devtoname(dev), - base); - error = EFBIG; - goto doerror; - } - bp->bio_length = pbuf->b_kvasize; - if (poff != 0) - bp->bio_length -= PAGE_SIZE; - } - bp->bio_bcount = bp->bio_length; bp->bio_dev = dev; @@ -180,6 +161,7 @@ physio(struct cdev *dev, struct uio *uio, int ioflag) error = EFAULT; goto doerror; } + poff = (vm_offset_t)base & PAGE_MASK; if (pbuf && sa) { pmap_qenter((vm_offset_t)sa, pages, npages);