From owner-svn-src-head@freebsd.org Thu Oct 29 14:10:15 2015 Return-Path: Delivered-To: svn-src-head@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id C61D6A1FC71; Thu, 29 Oct 2015 14:10:15 +0000 (UTC) (envelope-from jhb@freebsd.org) Received: from bigwig.baldwin.cx (bigwig.baldwin.cx [IPv6:2001:470:1f11:75::1]) (using TLSv1 with cipher DHE-RSA-CAMELLIA256-SHA (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id A191C1D2B; Thu, 29 Oct 2015 14:10:15 +0000 (UTC) (envelope-from jhb@freebsd.org) Received: from ralph.baldwin.cx (c-73-231-226-104.hsd1.ca.comcast.net [73.231.226.104]) by bigwig.baldwin.cx (Postfix) with ESMTPSA id AA7E3B9A0; Thu, 29 Oct 2015 10:10:14 -0400 (EDT) From: John Baldwin To: Konstantin Belousov Cc: "Conrad E. Meyer" , src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: Re: svn commit: r290130 - head/sys/dev/ntb/ntb_hw Date: Thu, 29 Oct 2015 06:48:50 -0700 Message-ID: <1703515.Ze3qo7rKK1@ralph.baldwin.cx> User-Agent: KMail/4.14.3 (FreeBSD/10.2-STABLE; KDE/4.14.3; amd64; ; ) In-Reply-To: <20151029075343.GO2257@kib.kiev.ua> References: <201510290416.t9T4GSG7044279@repo.freebsd.org> <20151029075343.GO2257@kib.kiev.ua> MIME-Version: 1.0 Content-Transfer-Encoding: 7Bit Content-Type: text/plain; charset="us-ascii" X-Greylist: Sender succeeded SMTP AUTH, not delayed by milter-greylist-4.2.7 (bigwig.baldwin.cx); Thu, 29 Oct 2015 10:10:14 -0400 (EDT) X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.20 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 29 Oct 2015 14:10:15 -0000 On Thursday, October 29, 2015 09:53:43 AM Konstantin Belousov wrote: > On Thu, Oct 29, 2015 at 04:16:28AM +0000, Conrad E. Meyer wrote: > > Author: cem > > Date: Thu Oct 29 04:16:28 2015 > > New Revision: 290130 > > URL: https://svnweb.freebsd.org/changeset/base/290130 > > > > Log: > > ntb: Do not attempt to set write-combining on MWs > > > > AMD64 pmap assumes ranges will be in the DMAP, which isn't necessarily > > true for NTB memory windows (especially 64-bit BARs). > I am not sure what do you mean. pmap_change_attr() handles either DMAP > or kernel mapped memory. I think it assumes the DMAP is valid in the nested call here: if (tmpva >= VM_MIN_KERNEL_ADDRESS) { if (pa_start == pa_end) { /* Start physical address run. */ pa_start = *pdpe & PG_PS_FRAME; pa_end = pa_start + NBPDP; } else if (pa_end == (*pdpe & PG_PS_FRAME)) pa_end += NBPDP; else { /* Run ended, update direct map. */ error = pmap_change_attr_locked( PHYS_TO_DMAP(pa_start), pa_end - pa_start, mode); if (error != 0) break; /* Start physical address run. */ pa_start = *pdpe & PG_PS_FRAME; pa_end = pa_start + NBPDP; } } That needs to do some sort of range checking on the (pa_start, pa_end) range to only set values that are mapped in the DMAP. In particular, that pmap_change_attr_locked() will fail here: /* * Pages that aren't mapped aren't supported. Also break down 2MB pages * into 4KB pages if required. */ for (tmpva = base; tmpva < base + size; ) { pdpe = pmap_pdpe(kernel_pmap, tmpva); if (*pdpe == 0) return (EINVAL); Since there won't be a valid pdpe, pde, or pte in the DMAP. -- John Baldwin