[PATCH 4/7] x86: pat.c consolidate error/debug messages in reserve_memtype

Previous message: [thread] [date] [author]
Next message: [thread] [date] [author]
From: Andreas Herrmann
Date: Friday, June 20, 2008 - 1:04 pm

... and move last debug message out of locked section.

Signed-off-by: Andreas Herrmann <andreas.herrmann3@amd.com>
---
 arch/x86/mm/pat.c |   51 +++++++++++----------------------------------------
 1 files changed, 11 insertions(+), 40 deletions(-)

diff --git a/arch/x86/mm/pat.c b/arch/x86/mm/pat.c
index c996a36..1118288 100644
--- a/arch/x86/mm/pat.c
+++ b/arch/x86/mm/pat.c
@@ -269,12 +269,6 @@ int reserve_memtype(u64 start, u64 end, unsigned long req_type,
 			}
 
 			if (actual_type != entry->type) {
-				printk(
-		KERN_INFO "%s:%d conflicting memory types %Lx-%Lx %s<->%s\n",
-					current->comm, current->pid,
-					start, end,
-					cattr_name(actual_type),
-					cattr_name(entry->type));
 				err = -EBUSY;
 				break;
 			}
@@ -290,12 +284,6 @@ int reserve_memtype(u64 start, u64 end, unsigned long req_type,
 				}
 
 				if (actual_type != entry->type) {
-					printk(
-		KERN_INFO "%s:%d conflicting memory types %Lx-%Lx %s<->%s\n",
-						current->comm, current->pid,
-						start, end,
-						cattr_name(actual_type),
-						cattr_name(entry->type));
 					err = -EBUSY;
 					break;
 				}
@@ -321,12 +309,6 @@ int reserve_memtype(u64 start, u64 end, unsigned long req_type,
 			}
 
 			if (actual_type != entry->type) {
-				printk(
-		KERN_INFO "%s:%d conflicting memory types %Lx-%Lx %s<->%s\n",
-					current->comm, current->pid,
-					start, end,
-					cattr_name(actual_type),
-					cattr_name(entry->type));
 				err = -EBUSY;
 				break;
 			}
@@ -342,12 +324,6 @@ int reserve_memtype(u64 start, u64 end, unsigned long req_type,
 				}
 
 				if (actual_type != entry->type) {
-					printk(
-		KERN_INFO "%s:%d conflicting memory types %Lx-%Lx %s<->%s\n",
-						current->comm, current->pid,
-						start, end,
-						cattr_name(actual_type),
-						cattr_name(entry->type));
 					err = -EBUSY;
 					break;
 				}
@@ -367,10 +343,12 @@ int reserve_memtype(u64 start, u64 end, unsigned long req_type,
 	}
 
 	if (err) {
-		printk(KERN_INFO
-	"reserve_memtype failed 0x%Lx-0x%Lx, track %s, req %s\n",
-			start, end, cattr_name(new->type),
-			cattr_name(req_type));
+		printk(KERN_INFO "%s:%d conflicting memory types "
+		       "%Lx-%Lx %s<->%s\n", current->comm, current->pid, start,
+		       end, cattr_name(new->type), cattr_name(entry->type));
+		printk(KERN_INFO "reserve_memtype failed 0x%Lx-0x%Lx, "
+		       "track %s, req %s\n",
+		       start, end, cattr_name(new->type), cattr_name(req_type));
 		kfree(new);
 		spin_unlock(&memtype_lock);
 		return err;
@@ -382,19 +360,12 @@ int reserve_memtype(u64 start, u64 end, unsigned long req_type,
 		dprintk("New Entry\n");
 	}
 
-	if (new_type) {
-		dprintk(
-	"reserve_memtype added 0x%Lx-0x%Lx, track %s, req %s, ret %s\n",
-			start, end, cattr_name(actual_type),
-			cattr_name(req_type), cattr_name(*new_type));
-	} else {
-		dprintk(
-	"reserve_memtype added 0x%Lx-0x%Lx, track %s, req %s\n",
-			start, end, cattr_name(actual_type),
-			cattr_name(req_type));
-	}
-
 	spin_unlock(&memtype_lock);
+
+	dprintk("reserve_memtype added 0x%Lx-0x%Lx, track %s, req %s, ret %s\n",
+		start, end, cattr_name(new->type), cattr_name(req_type),
+		new_type ? cattr_name(*new_type) : "-");
+
 	return err;
 }
 
-- 
1.5.5.4



--
Previous message: [thread] [date] [author]
Next message: [thread] [date] [author]

Messages in current thread:
[PATCH 0/7] x86: pat.c: reserve_memtype strip down, Andreas Herrmann, (Fri Jun 20, 12:55 pm)
[PATCH 1/7] x86: introduce macro to check whether an addre ..., Andreas Herrmann, (Fri Jun 20, 12:58 pm)
Re: [PATCH 2/7] x86: pat.c choose more crisp variable names, Andreas Herrmann, (Fri Jun 20, 1:01 pm)
[PATCH 3/7] x86: pat.c more trivial changes, Andreas Herrmann, (Fri Jun 20, 1:03 pm)
[PATCH 4/7] x86: pat.c consolidate error/debug messages in ..., Andreas Herrmann, (Fri Jun 20, 1:04 pm)
Re: [PATCH 0/7] x86: pat.c: reserve_memtype strip down, Ingo Molnar, (Tue Jun 24, 4:08 am)
RE: [PATCH 0/7] x86: pat.c: reserve_memtype strip down, Pallipadi, Venkatesh, (Tue Jun 24, 2:59 pm)