All of lore.kernel.org
 help / color / mirror / Atom feed
From: Steven Rostedt <srostedt@redhat.com>
To: Keir Fraser <Keir.Fraser@cl.cam.ac.uk>
Cc: xen-devel@lists.xensource.com, quintela@redhat.com
Subject: Re: [PATCH] wrong accounting in direct_remap_pfn_range
Date: Wed, 30 Aug 2006 21:03:07 -0400	[thread overview]
Message-ID: <44F6354B.2020806@redhat.com> (raw)
In-Reply-To: <C11BEF00.1935%Keir.Fraser@cl.cam.ac.uk>

[-- Attachment #1: Type: text/plain, Size: 716 bytes --]

Keir Fraser wrote:
> On 31/8/06 1:37 am, "Steven Rostedt" <srostedt@redhat.com> wrote:
> 
>> grr, I take it back, I am the one that's confused :P
>>
>> OK, this all happens because this whole blob of code is crazy because it
>> is missing a "if (size == 0)" check!
> 
> It's not really missing. We could have a size==0 check *or* we can have the
> v!=u check. We don't need both and I think the latter is more obviously
> correct, as the test is closer to the code that it 'protects'. Also it's a
> fairly idiomatic way of generating and flushing batches of work.
>

So what is really wrong with this code?  Or is the flushes need even on 
size == 0?

-- Steve

Signed-off-by: Steven Rostedt <srostedt@redhat.com>



[-- Attachment #2: ioredirect.patch --]
[-- Type: text/x-patch, Size: 1148 bytes --]

Index: linux-2.6-xen-sparse/arch/i386/mm/ioremap-xen.c
===================================================================
--- linux-2.6-xen-sparse.orig/arch/i386/mm/ioremap-xen.c
+++ linux-2.6-xen-sparse/arch/i386/mm/ioremap-xen.c
@@ -56,6 +56,9 @@ static int __direct_remap_pfn_range(stru
 	unsigned long i, start_address;
 	mmu_update_t *u, *v, *w;
 
+	if (unlikely(!size))
+		return 0;
+
 	u = v = w = (mmu_update_t *)__get_free_page(GFP_KERNEL|__GFP_REPEAT);
 	if (u == NULL)
 		return -ENOMEM;
@@ -91,17 +94,15 @@ static int __direct_remap_pfn_range(stru
 		v++;
 	}
 
-	if (v != u) {
-		/* get the ptep's filled in */
-		rc = apply_to_page_range(mm, start_address,
-					 address - start_address,
-					 direct_remap_area_pte_fn, &w);
-		if (rc)
-			goto out;
-		rc = -EFAULT;
-		if (unlikely(HYPERVISOR_mmu_update(u, v - u, NULL, domid) < 0))
-			goto out;
-	}
+	/* get the ptep's filled in */
+	rc = apply_to_page_range(mm, start_address,
+				 address - start_address,
+				 direct_remap_area_pte_fn, &w);
+	if (rc)
+		goto out;
+	rc = -EFAULT;
+	if (unlikely(HYPERVISOR_mmu_update(u, v - u, NULL, domid) < 0))
+		goto out;
 
 	rc = 0;
 

[-- Attachment #3: Type: text/plain, Size: 138 bytes --]

_______________________________________________
Xen-devel mailing list
Xen-devel@lists.xensource.com
http://lists.xensource.com/xen-devel

  parent reply	other threads:[~2006-08-31  1:03 UTC|newest]

Thread overview: 10+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2006-08-29 16:25 [PATCH] wrong accounting in direct_remap_pfn_range Steven Rostedt
2006-08-29 18:22 ` Steven Rostedt
2006-08-30 21:29   ` Keir Fraser
2006-08-31  0:17     ` Steven Rostedt
2006-08-31  0:37       ` Steven Rostedt
2006-08-31  0:42         ` Keir Fraser
2006-08-31  0:47           ` Steven Rostedt
2006-08-31  1:03           ` Steven Rostedt [this message]
2006-08-31  1:05             ` Keir Fraser
2006-08-31  1:35               ` Steven Rostedt

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=44F6354B.2020806@redhat.com \
    --to=srostedt@redhat.com \
    --cc=Keir.Fraser@cl.cam.ac.uk \
    --cc=quintela@redhat.com \
    --cc=xen-devel@lists.xensource.com \
    /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.