From owner-freebsd-hackers@FreeBSD.ORG Mon Nov 2 19:33:10 2009 Return-Path: Delivered-To: freebsd-hackers@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 826F81065694 for ; Mon, 2 Nov 2009 19:33:10 +0000 (UTC) (envelope-from jason.harmening@gmail.com) Received: from mail-bw0-f213.google.com (mail-bw0-f213.google.com [209.85.218.213]) by mx1.freebsd.org (Postfix) with ESMTP id 1158D8FC13 for ; Mon, 2 Nov 2009 19:33:09 +0000 (UTC) Received: by bwz5 with SMTP id 5so6853430bwz.3 for ; Mon, 02 Nov 2009 11:33:09 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=gamma; h=domainkey-signature:mime-version:received:in-reply-to:references :date:message-id:subject:from:to:content-type :content-transfer-encoding; bh=aBsG+cwyqhvimAiXmypQAjmF3qUsg8ZcQOa9bz3Ad7A=; b=NjdOEH7XdHDXDSoLJTYKnWLiHIBDsfVkXfj0f/EfNDdhTMCFo4A9N+C/ioxf/tkc/F xxAZ6pqn/lAVIpOTwp5r30wImGrIZFQCu2sosSVIsJyFm2UTAJ1eKic3TyZPsK6jewCu 2SpQ+qTKaM2rVfC3B0f1FsxYvTMdsSccorpXs= DomainKey-Signature: a=rsa-sha1; c=nofws; d=gmail.com; s=gamma; h=mime-version:in-reply-to:references:date:message-id:subject:from:to :content-type:content-transfer-encoding; b=Tx7xyc3znhlYPrIU+0oZdgJFBFx9+Db45zHdGbPU6qwBX9tO/rfnPpT58BGQC9jTeR ubYL+viRY8lbJzv0H9m6n3gvPa99DIzTvEpqe/QIul128Jvt4Cv6gb6lslCmFKY1K0ri zznApMCFzwlz+JoEwd/H6nu/GD5zNl7XN5Dag= MIME-Version: 1.0 Received: by 10.223.7.21 with SMTP id b21mr855445fab.104.1257190388854; Mon, 02 Nov 2009 11:33:08 -0800 (PST) In-Reply-To: References: <2d1264630910290849k2ca29237ubb25cc3b7313ec26@mail.gmail.com> Date: Mon, 2 Nov 2009 13:33:08 -0600 Message-ID: <2d1264630911021133uf3033deu20b41adfe54f62c2@mail.gmail.com> From: Jason Harmening To: gonzo@bluezbox.com, freebsd-hackers@freebsd.org Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: quoted-printable X-Mailman-Approved-At: Mon, 02 Nov 2009 19:53:13 +0000 Cc: Subject: Re: MIPS: bus_dma(9) and cache problems X-BeenThere: freebsd-hackers@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: Technical Discussions relating to FreeBSD List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 02 Nov 2009 19:33:10 -0000 On Mon, Nov 2, 2009 at 12:24 PM, Ryan Stone wrote: >> What sync operation are you doing? =A0At least for PREREAD or PREWRITE, >> I'd expect any dirty cache lines to be flushed to RAM. =A0If this isn't >> happening, then you may want to submit a bug report. > > For a PREREAD, I don't believe that it's correct to flush a dirty > cache line to RAM. =A0That would overwrite whatever had been DMA'ed into > that cache line. > I don't think that should matter--if you're issuing a PREREAD, *before* the start of a DMA transfer, the CPU either doesn't care about what's currently in the part of the line that is to be DMA'ed into (because it's about to be overwritten by the device anyway), or it's finished accessing what's in there from a previous DMA operation (in which case you'd expect it to either be present in the cache or already flushed out by something else anyway). But the basic idea is that the CPU shouldn't access the cache line from the time the PRE-whatever operation is issued to the time the POST-whatever operation is issued, so if you have multiple threads (anywhere on the system) accessing that line, you could be screwed. Heh, I just noticed the copyright at the top of the MIPS busdma implementation--apparently you ARE familiar w/ the MIPS sync implementation :)