From owner-freebsd-hackers@FreeBSD.ORG Mon Nov 2 18:24:15 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 1406F106566C for ; Mon, 2 Nov 2009 18:24:15 +0000 (UTC) (envelope-from rysto32@gmail.com) Received: from mail-ew0-f209.google.com (mail-ew0-f209.google.com [209.85.219.209]) by mx1.freebsd.org (Postfix) with ESMTP id 9C12C8FC08 for ; Mon, 2 Nov 2009 18:24:14 +0000 (UTC) Received: by ewy5 with SMTP id 5so1674212ewy.36 for ; Mon, 02 Nov 2009 10:24:13 -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:cc:content-type :content-transfer-encoding; bh=ZJg4d6ku3JJMN1KPsjnHdu+dTc5TMpN+duDXfa/B+Rk=; b=j472v+ozbk27HMHGRt4Tb6LLuIqE1NaOkiwEo9jIQBvSj/UqmT7bzyUQLIsjoAB116 rBXa1WjKhYiHVx1p+ZsYaB8QoibNv1kTprMJLzbvXJb8/asVmNfDcWVn6WR0AXTGXKFK 7Nmt3XUOS8YrsFQ3Y/bQYoSy2YDZjJR5AAj1w= 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 :cc:content-type:content-transfer-encoding; b=uZsAJJp15UEN0rkCGUZ96iis8fK3z1YUkfAM0Qn6UJzLI5EBs22WluBuIQOX5vFyze /mtDvrIOpSUN0ySIA+dCVQqlNeEttsyZ3dhxz2BCauWNV3PdCI4sVbwbU3s9OZ3BTKBd DziKH2UoWFwFhIDUY0T4KJd5bIKcK10UxYfj4= MIME-Version: 1.0 Received: by 10.216.89.146 with SMTP id c18mr5085275wef.84.1257186253147; Mon, 02 Nov 2009 10:24:13 -0800 (PST) In-Reply-To: <2d1264630910290849k2ca29237ubb25cc3b7313ec26@mail.gmail.com> References: <2d1264630910290849k2ca29237ubb25cc3b7313ec26@mail.gmail.com> Date: Mon, 2 Nov 2009 13:24:13 -0500 Message-ID: From: Ryan Stone To: Jason Harmening Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: quoted-printable Cc: freebsd-hackers@freebsd.org, gonzo@bluezbox.com 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 18:24:15 -0000 > 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. That would overwrite whatever had been DMA'ed into that cache line. What about the following procedure for a PREREAD for a non-cache aligned buffer I'll call dma_buf 1) read the entire cache line into a buffer, buf1 2) issue the invalidate 3) copy the portion of buf1 that preceeds dma_buf back to that address One problem I can see immediately is that there is a race here: if something tries to access the memory preceeding dma_buf after the invalidate is issued but before the copy completes they will see inconsistent data. Maybe somebody else can think of a way around that. Ryan Stone