From owner-freebsd-arm@FreeBSD.ORG Sun Jun 29 16:34:05 2014 Return-Path: Delivered-To: arm@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) (using TLSv1 with cipher ADH-AES256-SHA (256/256 bits)) (No client certificate requested) by hub.freebsd.org (Postfix) with ESMTPS id 7E371E30 for ; Sun, 29 Jun 2014 16:34:05 +0000 (UTC) Received: from mail-ie0-f171.google.com (mail-ie0-f171.google.com [209.85.223.171]) (using TLSv1 with cipher ECDHE-RSA-RC4-SHA (128/128 bits)) (Client CN "smtp.gmail.com", Issuer "Google Internet Authority G2" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 41BC12694 for ; Sun, 29 Jun 2014 16:34:04 +0000 (UTC) Received: by mail-ie0-f171.google.com with SMTP id x19so6053572ier.2 for ; Sun, 29 Jun 2014 09:33:58 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:sender:content-type:mime-version:subject:from :in-reply-to:date:cc:message-id:references:to; bh=+3nAi3fOGkkDFqr5yOvPo8lvPi5ePRKZoqyB1NSKmPQ=; b=gTkps+4j4VBR6iUNBTavq3iiMdRQSTex3r8j0B2+Z8ge8zi1UAuKuyBfcXnmtfWICp HOa19i06u72IySNN5EOxSbnDK+yi6mkfPqLROhvbvbx6nSjWwRLTJ8IKNCHlo4vHgXNr vNJhCcIhUSZmEpOmr5bg/STN5rVBIRuhjfJ8zhHzKRZwMwHWn73J2lMUo2Ct38qBDLmD yoNPKS0MQW6vyTqQWIUpnhBar1kGBwQncjec/74NnyafX8u7SSDy8x39EHScaQBW57QK VI02e7lIbH2j0Kp22zhEQlU3yKut0L4PV0NHPfNX3ALou8LOj4SbYqrzOKPHIjXlD7rd uSCA== X-Gm-Message-State: ALoCoQneGVFereTNrlgzbF8jaMfq5wCxdNZRi/+N1OokK6sivruW5m+Ir6+cZLJ72TVRY3BsXCcc X-Received: by 10.42.201.84 with SMTP id ez20mr2565081icb.74.1404059638707; Sun, 29 Jun 2014 09:33:58 -0700 (PDT) Received: from [10.0.0.119] (50-78-194-198-static.hfc.comcastbusiness.net. [50.78.194.198]) by mx.google.com with ESMTPSA id b2sm17011862igg.1.2014.06.29.09.33.57 for (version=TLSv1 cipher=ECDHE-RSA-RC4-SHA bits=128/128); Sun, 29 Jun 2014 09:33:57 -0700 (PDT) Sender: Warner Losh Content-Type: multipart/signed; boundary="Apple-Mail=_FC3C17ED-70FE-4F36-B52F-701032B569AD"; protocol="application/pgp-signature"; micalg=pgp-sha512 Mime-Version: 1.0 (Mac OS X Mail 7.3 \(1878.2\)) Subject: Re: arm alignment faults... From: Warner Losh In-Reply-To: <20140629054039.GP1560@funkthat.com> Date: Sun, 29 Jun 2014 10:33:59 -0600 Message-Id: <039F8A84-0193-424C-8093-E411957817E9@bsdimp.com> References: <20140629033823.GN1560@funkthat.com> <20140629040150.GO1560@funkthat.com> <86E20F1C-C161-45B2-AC82-11738596E004@bsdimp.com> <20140629054039.GP1560@funkthat.com> To: John-Mark Gurney X-Mailer: Apple Mail (2.1878.2) Cc: "freebsd-arm@freebsd.org" X-BeenThere: freebsd-arm@freebsd.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: "Porting FreeBSD to ARM processors." List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 29 Jun 2014 16:34:05 -0000 --Apple-Mail=_FC3C17ED-70FE-4F36-B52F-701032B569AD Content-Transfer-Encoding: quoted-printable Content-Type: text/plain; charset=windows-1252 On Jun 28, 2014, at 11:40 PM, John-Mark Gurney wrote: > Warner Losh wrote this message on Sat, Jun 28, 2014 at 22:53 -0600: >>=20 >> On Jun 28, 2014, at 10:52 PM, Adrian Chadd = wrote: >>=20 >>> On 28 June 2014 21:01, John-Mark Gurney wrote: >>>> Adrian Chadd wrote this message on Sat, Jun 28, 2014 at 20:44 = -0700: >>>>> On 28 June 2014 20:38, John-Mark Gurney wrote: >>>>>> So, one of the little projects I'd like to see is the removal of >>>>>> ETHER_ALIGN from the tree.. This bogosity can (and does) cause = the use >>>>>> of bouncing durning DMA ops on all ethernet frames... >>>>=20 >>>> Now that I think about it, total removal may not be necessary, just >>>> the requirement to use it... If the ethernet dma engine can do = half >>>> word aligned dma, then there would be benifit on those to keep >>>> ETHER_ALIGN... >>>>=20 >>>>> Well, as long as you're not doing it by forcing the various CPUs = to >>>>> handle unaligned accesses. >>>>=20 >>>> Hard to do on armv4 which I don't believe supports unaligned = access... >>>>=20 >>>>> The cost of those unaligned accesses on some CPUs that support = them is >>>>> not trivial. We benchmarked some of the ARM cores at Qualcomm back >>>>> when looking to migrate stuff to ARM and it wasn't very quick. >>>>=20 >>>> I plan on fixing the TCP/IP stack to copy data to an aligned buffer >>>> (maybe only if the original buffer isn't aligned) on the stack when >>>> __NO_STRICT_ALIGNMENT is not defined... I can't see how copying = the >>>> entire packet is cheaper than copying 20 bytes or so... >>>=20 >>> There's lots of other stupid corner cases that screw you. >>>=20 >>> VLAN headers add extra bytes. >>>=20 >>> 802.11 headers can offset things depending upon the 802.11 frame = type >>> (3-addr, 4-addr, vlan, no vlan, etc.) >>>=20 >>> There's no guarantee all ethernet DMA engines can do the alignment = as >>> required. :( >>=20 >> The ate driver for Atmel?s AT91RM9200 is one such beast. >=20 > Are you sure? The tag for data says alignment 1: > if (bus_dma_tag_create(bus_get_dma_tag(dev), 1, 0, > BUS_SPACE_MAXADDR_32BIT, BUS_SPACE_MAXADDR, NULL, NULL, = MCLBYTES, > 1, MCLBYTES, 0, busdma_lock_mutex, &sc->sc_mtx, &sc->mtag)) >=20 > Or is that a limitation on the parent? It is a limitation in hardware. You have to DMA to a 4 byte boundary. = That might be a bug in the above line though=85 Warner > I did an audit of the arm drivers (not mips), but I didn't see any = that > have the restriction... The one that I'm thinking of was the Cirrus > EP9302 in the TS-7200 port that I did years ago.. --Apple-Mail=_FC3C17ED-70FE-4F36-B52F-701032B569AD Content-Transfer-Encoding: 7bit Content-Disposition: attachment; filename=signature.asc Content-Type: application/pgp-signature; name=signature.asc Content-Description: Message signed with OpenPGP using GPGMail -----BEGIN PGP SIGNATURE----- Comment: GPGTools - https://gpgtools.org iQIcBAEBCgAGBQJTsD/3AAoJEGwc0Sh9sBEAPEkP/2nWdgA6WJQzATfBDtpFYbBQ lvh6B4Updblfehjknav+Pt+kGp3LSR15Ev5BDHeffjMZt/HLJkG2yyaSiwS+QdSZ D9WMLPFeX+gJfNkul2/STV0XUwv/fcflRyYr2LaNnvccnPqvWRM8bZ++hLgssZmc CG9JTSq6mygTQwel/zISOiJRbAhEKa5iQ7UjvB1Ropli08QgMOJr/DkGQChe3fYU kg0KQXElRC5ser/W0vKTxM7pL4S5ITctXeKV+gMbg9CzxwgbM4Y+sDpqXh8e18kC oMx2B2DOQUgxycV5cO5p2srrz62VRklQmbTZhd2y6NfJjgjCPM1m6l/1Ek39lQ6b rW0Ct40i2R6dlMP/1UnwCV9piVA0Xy/eFr4kaQ04b4J/qadLo4rJlEFFBTD7cRu3 8knBYCuqggMlmOwXBrDV3w9YS845R+kSpHwMB2KvFShmD1AKioauGOmomo2oS1ec jwTAFohxRoF1rZi92I+6VzVN7RfdZI5Oq1LXuJHc5BbiKqre50GxYad/HVlIFji6 qPOrFSvZiAL0TJbR0KK9+heidF1Iq2neQl8MIsjZ0bWA9JbCsSHV/avIaH71UG9R qudby5xCMQpwaIc7EYed/UcV+18SBaQP1kyRcUdWJGacZG34WYWuH/emNxh2Ns2p dStTWQa0/mjvzC6drmU7 =Gi2m -----END PGP SIGNATURE----- --Apple-Mail=_FC3C17ED-70FE-4F36-B52F-701032B569AD--