From owner-freebsd-arm@FreeBSD.ORG Mon Aug 27 18:54:10 2012 Return-Path: Delivered-To: freebsd-arm@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 49B9F1065714; Mon, 27 Aug 2012 18:54:10 +0000 (UTC) (envelope-from kostikbel@gmail.com) Received: from mail.zoral.com.ua (mx0.zoral.com.ua [91.193.166.200]) by mx1.freebsd.org (Postfix) with ESMTP id D55CC8FC0A; Mon, 27 Aug 2012 18:54:09 +0000 (UTC) Received: from skuns.kiev.zoral.com.ua (localhost [127.0.0.1]) by mail.zoral.com.ua (8.14.2/8.14.2) with ESMTP id q7RIs0nK023175; Mon, 27 Aug 2012 21:54:00 +0300 (EEST) (envelope-from kostikbel@gmail.com) Received: from deviant.kiev.zoral.com.ua (kostik@localhost [127.0.0.1]) by deviant.kiev.zoral.com.ua (8.14.5/8.14.5) with ESMTP id q7RIrlGG059144; Mon, 27 Aug 2012 21:53:47 +0300 (EEST) (envelope-from kostikbel@gmail.com) Received: (from kostik@localhost) by deviant.kiev.zoral.com.ua (8.14.5/8.14.5/Submit) id q7RIrked059143; Mon, 27 Aug 2012 21:53:46 +0300 (EEST) (envelope-from kostikbel@gmail.com) X-Authentication-Warning: deviant.kiev.zoral.com.ua: kostik set sender to kostikbel@gmail.com using -f Date: Mon, 27 Aug 2012 21:53:46 +0300 From: Konstantin Belousov To: Warner Losh Message-ID: <20120827185346.GE33100@deviant.kiev.zoral.com.ua> References: <1345765503.27688.602.camel@revolution.hippie.lan> <1345766109.27688.606.camel@revolution.hippie.lan> <1346002922.1140.56.camel@revolution.hippie.lan> <1346005507.1140.69.camel@revolution.hippie.lan> <10307B47-13F3-45C0-87F7-66FD3ACA3F86@bsdimp.com> Mime-Version: 1.0 Content-Type: multipart/signed; micalg=pgp-sha1; protocol="application/pgp-signature"; boundary="BwgxZU5iS1dWSTZh" Content-Disposition: inline In-Reply-To: <10307B47-13F3-45C0-87F7-66FD3ACA3F86@bsdimp.com> User-Agent: Mutt/1.4.2.3i X-Virus-Scanned: clamav-milter 0.95.2 at skuns.kiev.zoral.com.ua X-Virus-Status: Clean X-Spam-Status: No, score=-4.0 required=5.0 tests=ALL_TRUSTED,AWL,BAYES_00 autolearn=ham version=3.2.5 X-Spam-Checker-Version: SpamAssassin 3.2.5 (2008-06-10) on skuns.kiev.zoral.com.ua Cc: Hans Petter Selasky , freebsd-arm@freebsd.org, freebsd-mips@freebsd.org, freebsd-arch@freebsd.org Subject: Re: Partial cacheline flush problems on ARM and MIPS X-BeenThere: freebsd-arm@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: Porting FreeBSD to the StrongARM Processor List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 27 Aug 2012 18:54:10 -0000 --BwgxZU5iS1dWSTZh Content-Type: text/plain; charset=us-ascii Content-Disposition: inline Content-Transfer-Encoding: quoted-printable On Sun, Aug 26, 2012 at 05:13:31PM -0600, Warner Losh wrote: >=20 > On Aug 26, 2012, at 12:25 PM, Ian Lepore wrote: > > In this regard, it's the busdma implementation that's broken, because it > > should bounce those IOs through a DMA-safe buffer. There's absolutely > > no rule that I've ever heard of in FreeBSD that says IO can only take > > place using memory allocated from busdma. >=20 > That's partially true. Since BUSDMA grew up in the storage area, you > must allocate the memory from busdma, or it must be page aligned has > been the de-facto rule here. The mbuf and uio variants of load were > invented to cope with common cases of mbufs and user I/O to properly > flag things. I once looked at x86 bus_dmamap_load_uio(), and I was unable to understand how to use it with usermode uio. I think this is a good moment to ask. Most existing users use UIO_SYSSPACE, but several crypto drivers might allow the UIO_USERSPACE for them. For UIO_USERSPACE, if the page is not resident, the pmap_extract() call from _bus_dmamap_load_buffer() returns 0. So the i/o happens to the page located at 0, which contains real mode IVT and other BIOS sensitive tables. Worse, if the page is resident, but it is mapped at the region which requires COW on write, then DMA will be performed to the wrong page which is typically shared with other innocent users. to the COW area which was not yet copied, Am I missing some trick there ? --BwgxZU5iS1dWSTZh Content-Type: application/pgp-signature Content-Disposition: inline -----BEGIN PGP SIGNATURE----- Version: GnuPG v1.4.12 (FreeBSD) iEYEARECAAYFAlA7wjoACgkQC3+MBN1Mb4hJsACg9rY5d4jEjVBz1gmM0pcHvbwY 1N0AoKmBOQ6HFrErCDyO1ME2rbSRZLt/ =iNrn -----END PGP SIGNATURE----- --BwgxZU5iS1dWSTZh--