rpms/kernel/F-11 pat-remove-page-granularity-tracking-for-vm_insert_pfn_maps.patch, NONE, 1.1 kernel.spec, 1.1561, 1.1562

Kyle McMartin kyle at fedoraproject.org
Sat Apr 18 21:52:47 UTC 2009


Author: kyle

Update of /cvs/pkgs/rpms/kernel/F-11
In directory cvs1.fedora.phx.redhat.com:/tmp/cvs-serv4419

Modified Files:
	kernel.spec 
Added Files:
	pat-remove-page-granularity-tracking-for-vm_insert_pfn_maps.patch 
Log Message:
* Sat Apr 18 2009 Kyle McMartin <kyle at redhat.com> 2.6.29.1-100
- pat-remove-page-granularity-tracking-for-vm_insert_pfn_maps.patch:
   Fix the spew of "Xorg:3254 freeing invalid memtype" messages.


pat-remove-page-granularity-tracking-for-vm_insert_pfn_maps.patch:

--- NEW FILE pat-remove-page-granularity-tracking-for-vm_insert_pfn_maps.patch ---
>From linux-kernel-owner+kyle=40mcmartin.ca-S1755891AbZDPWsW at vger.kernel.org Thu Apr 16 18:48:26 2009
Return-path: <linux-kernel-owner+kyle=40mcmartin.ca-S1755891AbZDPWsW at vger.kernel.org>
X-Spam-Checker-Version: SpamAssassin 3.2.5 (2008-06-10) on
	bombadil.infradead.org
X-Spam-Level: 
X-Spam-Status: No, score=-4.0 required=5.0 tests=RCVD_IN_DNSWL_MED
	autolearn=ham version=3.2.5
Envelope-to: kyle at bombadil.infradead.org
Delivery-date: Thu, 16 Apr 2009 22:48:26 +0000
Received: from casper.infradead.org ([2001:770:15f::2])
	by bombadil.infradead.org with esmtps (Exim 4.69 #1 (Red Hat Linux))
	id 1LuaNe-0000Of-Cb
	for kyle at bombadil.infradead.org; Thu, 16 Apr 2009 22:48:26 +0000
Received: from vger.kernel.org ([209.132.176.167])
	by casper.infradead.org with esmtp (Exim 4.69 #1 (Red Hat Linux))
	id 1LuaNc-0008Kx-Gy
	for kyle at mcmartin.ca; Thu, 16 Apr 2009 22:48:25 +0000
Received: (majordomo at vger.kernel.org) by vger.kernel.org via listexpand
	id S1755891AbZDPWsW (ORCPT <rfc822;kyle at mcmartin.ca>);
	Thu, 16 Apr 2009 18:48:22 -0400
Received: (majordomo at vger.kernel.org) by vger.kernel.org id S1755206AbZDPWsV
	(ORCPT <rfc822;linux-kernel-outgoing>);
	Thu, 16 Apr 2009 18:48:21 -0400
Received: from hera.kernel.org ([140.211.167.34]:51608 "EHLO hera.kernel.org"
	rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP
	id S1755028AbZDPWsU (ORCPT <rfc822;linux-kernel at vger.kernel.org>);
	Thu, 16 Apr 2009 18:48:20 -0400
Received: from hera.kernel.org (IDENT:U2FsdGVkX18/nhN3Gm0uWXfEhCJkjhWfN6rcXKJG08E at localhost [127.0.0.1])
	by hera.kernel.org (8.14.2/8.14.2) with ESMTP id n3GMlSTT010770
	(version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=NO);
	Thu, 16 Apr 2009 22:47:28 GMT
Received: (from hpa at localhost)
	by hera.kernel.org (8.14.2/8.13.1/Submit) id n3GMlS43010766;
	Thu, 16 Apr 2009 22:47:28 GMT
Date:	Thu, 16 Apr 2009 22:47:28 GMT
From:	"tip-bot for Pallipadi, Venkatesh" <venkatesh.pallipadi at intel.com>
To:	linux-tip-commits at vger.kernel.org
Cc:	linux-kernel at vger.kernel.org, hpa at zytor.com, mingo at redhat.com,
	venkatesh.pallipadi at intel.com, a.miskiewicz at gmail.com,
	jbarnes at virtuousgeek.org, suresh.b.siddha at intel.com,
	tglx at linutronix.de, mingo at elte.hu
Reply-To: mingo at redhat.com, hpa at zytor.com, linux-kernel at vger.kernel.org,
	  jbarnes at virtuousgeek.org, a.miskiewicz at gmail.com,
	  venkatesh.pallipadi at intel.com, suresh.b.siddha at intel.com,
	  tglx at linutronix.de, mingo at elte.hu
In-Reply-To: <20090408223716.GC3493 at linux-os.sc.intel.com>
References: <20090408223716.GC3493 at linux-os.sc.intel.com>
Subject: [tip:x86/urgent] x86, PAT: Remove page granularity tracking for vm_insert_pfn maps
Message-ID: <tip-4b065046273afa01ec8e3de7da407e8d3599251d at git.kernel.org>
Git-Commit-ID: 4b065046273afa01ec8e3de7da407e8d3599251d
X-Mailer: tip-git-log-daemon
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Disposition: inline
X-Virus-Scanned: ClamAV 0.93.3/9248/Thu Apr 16 21:20:40 2009 on hera.kernel.org
X-Virus-Status:	Clean
X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.0 (hera.kernel.org [127.0.0.1]); Thu, 16 Apr 2009 22:47:30 +0000 (UTC)
Sender:	linux-kernel-owner at vger.kernel.org
Precedence: bulk
List-ID: <linux-kernel.vger.kernel.org>
X-Mailing-List:	linux-kernel at vger.kernel.org

Commit-ID:  4b065046273afa01ec8e3de7da407e8d3599251d
Gitweb:     http://git.kernel.org/tip/4b065046273afa01ec8e3de7da407e8d3599251d
Author:     Pallipadi, Venkatesh <venkatesh.pallipadi at intel.com>
AuthorDate: Wed, 8 Apr 2009 15:37:16 -0700
Committer:  Ingo Molnar <mingo at elte.hu>
CommitDate: Fri, 17 Apr 2009 00:44:22 +0200

x86, PAT: Remove page granularity tracking for vm_insert_pfn maps

This change resolves the problem of too many single page entries
in pat_memtype_list and "freeing invalid memtype" errors with i915,
reported here:

  http://marc.info/?l=linux-kernel&m=123845244713183&w=2

Remove page level granularity track and untrack of vm_insert_pfn.
memtype tracking at page granularity does not scale and cleaner
approach would be for the driver to request a type for a bigger
IO address range or PCI io memory range for that device, either at
mmap time or driver init time and just use that type during
vm_insert_pfn.

This patch just removes the track/untrack of vm_insert_pfn. That
means we will be in same state as 2.6.28, with respect to these APIs.

Newer APIs for the drivers to request a memtype for a bigger region
is coming soon.

[ Impact: fix Xorg startup warnings and hangs ]

Reported-by: Arkadiusz Miskiewicz <a.miskiewicz at gmail.com>
Tested-by: Arkadiusz Miskiewicz <a.miskiewicz at gmail.com>
Signed-off-by: Venkatesh Pallipadi <venkatesh.pallipadi at intel.com>
Signed-off-by: Suresh Siddha <suresh.b.siddha at intel.com>
Cc: Jesse Barnes <jbarnes at virtuousgeek.org>
LKML-Reference: <20090408223716.GC3493 at linux-os.sc.intel.com>
Signed-off-by: Ingo Molnar <mingo at elte.hu>


---
 arch/x86/mm/pat.c |   98 ++++++++++------------------------------------------
 1 files changed, 19 insertions(+), 79 deletions(-)

diff --git a/arch/x86/mm/pat.c b/arch/x86/mm/pat.c
index cc5e0e2..41c8057 100644
--- a/arch/x86/mm/pat.c
+++ b/arch/x86/mm/pat.c
@@ -669,29 +669,28 @@ static void free_pfn_range(u64 paddr, unsigned long size)
  *
  * If the vma has a linear pfn mapping for the entire range, we get the prot
  * from pte and reserve the entire vma range with single reserve_pfn_range call.
- * Otherwise, we reserve the entire vma range, my ging through the PTEs page
- * by page to get physical address and protection.
  */
 int track_pfn_vma_copy(struct vm_area_struct *vma)
 {
-	int retval = 0;
-	unsigned long i, j;
 	resource_size_t paddr;
 	unsigned long prot;
-	unsigned long vma_start = vma->vm_start;
-	unsigned long vma_end = vma->vm_end;
-	unsigned long vma_size = vma_end - vma_start;
+	unsigned long vma_size = vma->vm_end - vma->vm_start;
 	pgprot_t pgprot;
 
 	if (!pat_enabled)
 		return 0;
 
+	/*
+	 * For now, only handle remap_pfn_range() vmas where
+	 * is_linear_pfn_mapping() == TRUE. Handling of
+	 * vm_insert_pfn() is TBD.
+	 */
 	if (is_linear_pfn_mapping(vma)) {
 		/*
 		 * reserve the whole chunk covered by vma. We need the
 		 * starting address and protection from pte.
 		 */
-		if (follow_phys(vma, vma_start, 0, &prot, &paddr)) {
+		if (follow_phys(vma, vma->vm_start, 0, &prot, &paddr)) {
 			WARN_ON_ONCE(1);
 			return -EINVAL;
 		}
@@ -699,28 +698,7 @@ int track_pfn_vma_copy(struct vm_area_struct *vma)
 		return reserve_pfn_range(paddr, vma_size, &pgprot, 1);
 	}
 
-	/* reserve entire vma page by page, using pfn and prot from pte */
-	for (i = 0; i < vma_size; i += PAGE_SIZE) {
-		if (follow_phys(vma, vma_start + i, 0, &prot, &paddr))
-			continue;
-
-		pgprot = __pgprot(prot);
-		retval = reserve_pfn_range(paddr, PAGE_SIZE, &pgprot, 1);
-		if (retval)
-			goto cleanup_ret;
-	}
 	return 0;
-
-cleanup_ret:
-	/* Reserve error: Cleanup partial reservation and return error */
-	for (j = 0; j < i; j += PAGE_SIZE) {
-		if (follow_phys(vma, vma_start + j, 0, &prot, &paddr))
-			continue;
-
-		free_pfn_range(paddr, PAGE_SIZE);
-	}
-
-	return retval;
 }
 
 /*
@@ -730,50 +708,28 @@ cleanup_ret:
  * prot is passed in as a parameter for the new mapping. If the vma has a
  * linear pfn mapping for the entire range reserve the entire vma range with
  * single reserve_pfn_range call.
- * Otherwise, we look t the pfn and size and reserve only the specified range
- * page by page.
- *
- * Note that this function can be called with caller trying to map only a
- * subrange/page inside the vma.
  */
 int track_pfn_vma_new(struct vm_area_struct *vma, pgprot_t *prot,
 			unsigned long pfn, unsigned long size)
 {
-	int retval = 0;
-	unsigned long i, j;
-	resource_size_t base_paddr;
 	resource_size_t paddr;
-	unsigned long vma_start = vma->vm_start;
-	unsigned long vma_end = vma->vm_end;
-	unsigned long vma_size = vma_end - vma_start;
+	unsigned long vma_size = vma->vm_end - vma->vm_start;
 
 	if (!pat_enabled)
 		return 0;
 
+	/*
+	 * For now, only handle remap_pfn_range() vmas where
+	 * is_linear_pfn_mapping() == TRUE. Handling of
+	 * vm_insert_pfn() is TBD.
+	 */
 	if (is_linear_pfn_mapping(vma)) {
 		/* reserve the whole chunk starting from vm_pgoff */
 		paddr = (resource_size_t)vma->vm_pgoff << PAGE_SHIFT;
 		return reserve_pfn_range(paddr, vma_size, prot, 0);
 	}
 
-	/* reserve page by page using pfn and size */
-	base_paddr = (resource_size_t)pfn << PAGE_SHIFT;
-	for (i = 0; i < size; i += PAGE_SIZE) {
-		paddr = base_paddr + i;
-		retval = reserve_pfn_range(paddr, PAGE_SIZE, prot, 0);
-		if (retval)
-			goto cleanup_ret;
-	}
 	return 0;
-
-cleanup_ret:
-	/* Reserve error: Cleanup partial reservation and return error */
-	for (j = 0; j < i; j += PAGE_SIZE) {
-		paddr = base_paddr + j;
-		free_pfn_range(paddr, PAGE_SIZE);
-	}
-
-	return retval;
 }
 
 /*
@@ -784,39 +740,23 @@ cleanup_ret:
 void untrack_pfn_vma(struct vm_area_struct *vma, unsigned long pfn,
 			unsigned long size)
 {
-	unsigned long i;
 	resource_size_t paddr;
-	unsigned long prot;
-	unsigned long vma_start = vma->vm_start;
-	unsigned long vma_end = vma->vm_end;
-	unsigned long vma_size = vma_end - vma_start;
+	unsigned long vma_size = vma->vm_end - vma->vm_start;
 
 	if (!pat_enabled)
 		return;
 
+	/*
+	 * For now, only handle remap_pfn_range() vmas where
+	 * is_linear_pfn_mapping() == TRUE. Handling of
+	 * vm_insert_pfn() is TBD.
+	 */
 	if (is_linear_pfn_mapping(vma)) {
 		/* free the whole chunk starting from vm_pgoff */
 		paddr = (resource_size_t)vma->vm_pgoff << PAGE_SHIFT;
 		free_pfn_range(paddr, vma_size);
 		return;
 	}
-
-	if (size != 0 && size != vma_size) {
-		/* free page by page, using pfn and size */
-		paddr = (resource_size_t)pfn << PAGE_SHIFT;
-		for (i = 0; i < size; i += PAGE_SIZE) {
-			paddr = paddr + i;
-			free_pfn_range(paddr, PAGE_SIZE);
-		}
-	} else {
-		/* free entire vma, page by page, using the pfn from pte */
-		for (i = 0; i < vma_size; i += PAGE_SIZE) {
-			if (follow_phys(vma, vma_start + i, 0, &prot, &paddr))
-				continue;
-
-			free_pfn_range(paddr, PAGE_SIZE);
-		}
-	}
 }
 
 pgprot_t pgprot_writecombine(pgprot_t prot)
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo at vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/



Index: kernel.spec
===================================================================
RCS file: /cvs/pkgs/rpms/kernel/F-11/kernel.spec,v
retrieving revision 1.1561
retrieving revision 1.1562
diff -u -r1.1561 -r1.1562
--- kernel.spec	18 Apr 2009 17:45:46 -0000	1.1561
+++ kernel.spec	18 Apr 2009 21:52:16 -0000	1.1562
@@ -751,6 +751,8 @@
 
 Patch9304: linux-2.6-kvm-skip-pit-check.patch
 
+Patch9400: pat-remove-page-granularity-tracking-for-vm_insert_pfn_maps.patch
+
 %endif
 
 BuildRoot: %{_tmppath}/kernel-%{KVERREL}-root
@@ -1386,6 +1388,8 @@
 ApplyPatch linux-2.6-kvm-reset-pit-irq-on-unmask.patch
 ApplyPatch linux-2.6-kvm-skip-pit-check.patch
 
+ApplyPatch pat-remove-page-granularity-tracking-for-vm_insert_pfn_maps.patch
+
 # END OF PATCH APPLICATIONS
 
 %endif
@@ -1971,6 +1975,10 @@
 # and build.
 
 %changelog
+* Sat Apr 18 2009 Kyle McMartin <kyle at redhat.com> 2.6.29.1-100
+- pat-remove-page-granularity-tracking-for-vm_insert_pfn_maps.patch:
+   Fix the spew of "Xorg:3254 freeing invalid memtype" messages.
+
 * Sat Apr 18 2009 Chuck Ebbert <cebbert at redhat.com>
 - Build in the rfkill and rfkill-input modules (F10#485322)
 




More information about the fedora-extras-commits mailing list