All of lore.kernel.org
 help / color / mirror / Atom feed
From: Suresh Siddha <suresh.b.siddha@intel.com>
To: mingo@elte.hu, hpa@zytor.com, tglx@linutronix.de, arjan@linux.intel.com
Cc: linux-kernel@vger.kernel.org, Suresh Siddha <suresh.b.siddha@intel.com>
Subject: [patch 5/7] x86, cpa: fix taking the pgd_lock with interrupts off
Date: Thu, 11 Sep 2008 13:30:53 -0700	[thread overview]
Message-ID: <20080911204151.010960000@linux-os.sc.intel.com> (raw)
In-Reply-To: 20080911203048.929515000@linux-os.sc.intel.com

[-- Attachment #1: fix_pageattr_irqlock.patch --]
[-- Type: text/plain, Size: 2933 bytes --]

Interrupt context no longer does the large page split, so no need to use
spin_lock_irqsave()

Signed-off-by: Suresh Siddha <suresh.b.siddha@intel.com>
---

Index: tip/arch/x86/mm/pageattr.c
===================================================================
--- tip.orig/arch/x86/mm/pageattr.c	2008-09-11 13:19:54.000000000 -0700
+++ tip/arch/x86/mm/pageattr.c	2008-09-11 13:25:53.000000000 -0700
@@ -43,12 +43,10 @@
 
 void update_page_count(int level, unsigned long pages)
 {
-	unsigned long flags;
-
 	/* Protect against CPA */
-	spin_lock_irqsave(&pgd_lock, flags);
+	spin_lock(&pgd_lock);
 	direct_pages_count[level] += pages;
-	spin_unlock_irqrestore(&pgd_lock, flags);
+	spin_unlock(&pgd_lock);
 }
 
 static void split_page_count(int level)
@@ -338,7 +336,7 @@
 try_preserve_large_page(pte_t *kpte, unsigned long address,
 			struct cpa_data *cpa)
 {
-	unsigned long nextpage_addr, numpages, pmask, psize, flags, addr, pfn;
+	unsigned long nextpage_addr, numpages, pmask, psize, addr, pfn;
 	pte_t new_pte, old_pte, *tmp;
 	pgprot_t old_prot, new_prot;
 	int i, do_split = 1;
@@ -347,7 +345,7 @@
 	if (cpa->force_split)
 		return 1;
 
-	spin_lock_irqsave(&pgd_lock, flags);
+	spin_lock(&pgd_lock);
 	/*
 	 * Check for races, another CPU might have split this page
 	 * up already:
@@ -442,7 +440,7 @@
 	}
 
 out_unlock:
-	spin_unlock_irqrestore(&pgd_lock, flags);
+	spin_unlock(&pgd_lock);
 
 	return do_split;
 }
@@ -454,7 +452,6 @@
 static void cpa_fill_pool(struct page **ret)
 {
 	gfp_t gfp = GFP_KERNEL;
-	unsigned long flags;
 	struct page *p;
 
 	/*
@@ -484,10 +481,10 @@
 			*ret = p;
 			continue;
 		}
-		spin_lock_irqsave(&pgd_lock, flags);
+		spin_lock(&pgd_lock);
 		list_add(&p->lru, &page_pool);
 		pool_pages++;
-		spin_unlock_irqrestore(&pgd_lock, flags);
+		spin_unlock(&pgd_lock);
 	}
 
 	current->flags &= ~PF_MEMALLOC;
@@ -527,7 +524,7 @@
 
 static int split_large_page(pte_t *kpte, unsigned long address)
 {
-	unsigned long flags, pfn, pfninc = 1;
+	unsigned long pfn, pfninc = 1;
 	unsigned int i, level;
 	pte_t *pbase, *tmp;
 	pgprot_t ref_prot;
@@ -538,14 +535,14 @@
 	 * pgd_lock, which we have to take anyway for the split
 	 * operation:
 	 */
-	spin_lock_irqsave(&pgd_lock, flags);
+	spin_lock(&pgd_lock);
 	if (list_empty(&page_pool)) {
-		spin_unlock_irqrestore(&pgd_lock, flags);
+		spin_unlock(&pgd_lock);
 		base = NULL;
 		cpa_fill_pool(&base);
 		if (!base)
 			return -ENOMEM;
-		spin_lock_irqsave(&pgd_lock, flags);
+		spin_lock(&pgd_lock);
 	} else {
 		base = list_first_entry(&page_pool, struct page, lru);
 		list_del(&base->lru);
@@ -616,7 +613,7 @@
 		pool_pages++;
 	} else
 		pool_used++;
-	spin_unlock_irqrestore(&pgd_lock, flags);
+	spin_unlock(&pgd_lock);
 
 	return 0;
 }
@@ -676,6 +673,10 @@
 		return 0;
 	}
 
+#ifdef CONFIG_DEBUG_PAGEALLOC
+	BUG_ON(irqs_disabled());
+#endif
+
 	/*
 	 * Check, whether we can keep the large page intact
 	 * and just change the pte:

-- 


  parent reply	other threads:[~2008-09-11 21:33 UTC|newest]

Thread overview: 14+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2008-09-11 20:30 [patch 0/7] x86, cpa: cpa related changes to be inline with TLB Application note Suresh Siddha
2008-09-11 20:30 ` [patch 1/7] x86, cpa: rename PTE attribute macros for kernel direct mapping in early boot Suresh Siddha
2008-09-11 20:30 ` [patch 2/7] x86, cpa: remove USER permission from the very early identity mapping attribute Suresh Siddha
2008-09-11 20:30 ` [patch 3/7] x86, cpa: make the kernel physical mapping initialization a two pass sequence Suresh Siddha
2008-09-11 20:30 ` [patch 4/7] x86, cpa: dont use large pages for kernel identity mapping with DEBUG_PAGEALLOC Suresh Siddha
2008-09-11 20:30 ` Suresh Siddha [this message]
2008-09-11 20:30 ` [patch 6/7] x86, cpa: remove cpa pool code Suresh Siddha
2008-09-11 20:30 ` [patch 7/7] x86, cpa: global flush tlb after splitting large page and before doing cpa Suresh Siddha
2008-09-13 17:10   ` Jeremy Fitzhardinge
2008-09-14 15:29 ` [patch 0/7] x86, cpa: cpa related changes to be inline with TLB Application note Ingo Molnar
2008-09-14 16:59   ` Ingo Molnar
2008-09-16  5:44     ` Suresh Siddha
2008-09-14 15:40 ` Arjan van de Ven
2008-09-14 15:52   ` Ingo Molnar

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20080911204151.010960000@linux-os.sc.intel.com \
    --to=suresh.b.siddha@intel.com \
    --cc=arjan@linux.intel.com \
    --cc=hpa@zytor.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=mingo@elte.hu \
    --cc=tglx@linutronix.de \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.