From owner-freebsd-hackers@FreeBSD.ORG Thu Jul 29 20:16:42 2010 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 EC9491065672 for ; Thu, 29 Jul 2010 20:16:42 +0000 (UTC) (envelope-from avg@icyb.net.ua) Received: from citadel.icyb.net.ua (citadel.icyb.net.ua [212.40.38.140]) by mx1.freebsd.org (Postfix) with ESMTP id 4254A8FC08 for ; Thu, 29 Jul 2010 20:16:41 +0000 (UTC) Received: from porto.topspin.kiev.ua (porto-e.starpoint.kiev.ua [212.40.38.100]) by citadel.icyb.net.ua (8.8.8p3/ICyb-2.3exp) with ESMTP id XAA29684; Thu, 29 Jul 2010 23:16:32 +0300 (EEST) (envelope-from avg@icyb.net.ua) Received: from localhost.topspin.kiev.ua ([127.0.0.1]) by porto.topspin.kiev.ua with esmtp (Exim 4.34 (FreeBSD)) id 1OeZWq-0002Kr-4u; Thu, 29 Jul 2010 23:16:32 +0300 Message-ID: <4C51E198.8060800@icyb.net.ua> Date: Thu, 29 Jul 2010 23:16:24 +0300 From: Andriy Gapon User-Agent: Thunderbird 2.0.0.24 (X11/20100603) MIME-Version: 1.0 To: Sergey Babkin References: <382607918.1356296.1280433776963.JavaMail.root@vms170009.mailsrvcs.net> In-Reply-To: <382607918.1356296.1280433776963.JavaMail.root@vms170009.mailsrvcs.net> X-Enigmail-Version: 0.96.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: freebsd-hackers@freebsd.org, pebu3op@googlemail.com Subject: Re: coherence-problem on the mapped memory buffer 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: Thu, 29 Jul 2010 20:16:43 -0000 on 29/07/2010 23:02 Sergey Babkin said the following: > Jul 29, 2010 12:58:07 PM, avg@icyb.net.ua wrote: > >> on 29/07/2010 19:13 Andriy Gapon said the following: >>> on 29/07/2010 17:13 Alexander Fiveg said the following: >> In fact I have a suspicion that the problem might have to do with multiple >> mappings of the shared pages, but far from sure... >> Take a look at Intel® 64 and IA-32 Architectures Software Developer’s Manual >> Volume 3A - System Programming Guide, Part 1; Chapter 11.12.4 Programming the PAT; >> starting at the following words: >> «The PAT allows any memory type to be specified in the page tables, and therefore >> it is possible to have a single physical page mapped to two or more different >> linear addresses, each with different memory types. Intel does not support this >> practice...» > > My guess would be that the memory type is not marked as DMA-capable. AFAIK the Intel CPUs > do the hardware snooping on the physical addresses, so they have no coherency issues benween > themselves. However if a DMA writer changes the memory, this I think does not get normally > propagated to the front-side bus, and the CPUs would not see it. You may need to either > explicitly flush the CPU cache before accessing these pages or mark them as non-cacheable. My guess was approximately the same - if one mapping is done in kernel for DMA purposes, then the memory type is, most likely, set to uncached. But the userland mapping of the same pages most likely marks the same pages (via different virtual addresses) as cached. Depending on the hardware and on what mappings were used on a particular CPU (core) to access that memory, there could be differences in interaction with DMA. -- Andriy Gapon