WARNING - OLD ARCHIVES

This is an archived copy of the Xen.org mailing list, which we have preserved to ensure that existing links to archives are not broken. The live archive, which contains the latest emails, can be found at http://lists.xen.org/
   
 
 
Xen 
 
Home Products Support Community News
 
   
 

xen-ppc-devel

[XenPPC] [linux-ppc-2.6] [powerpc] Use new method to detect NULL xencomm

To: xen-ppc-devel@xxxxxxxxxxxxxxxxxxx
Subject: [XenPPC] [linux-ppc-2.6] [powerpc] Use new method to detect NULL xencomm handle
From: Xen patchbot-linux-ppc-2.6 <patchbot-linux-ppc-2.6@xxxxxxxxxxxxxxxxxxx>
Date: Fri, 28 Jul 2006 00:02:39 +0000
Delivery-date: Thu, 27 Jul 2006 17:09:33 -0700
Envelope-to: www-data@xxxxxxxxxxxxxxxxxx
List-help: <mailto:xen-ppc-devel-request@lists.xensource.com?subject=help>
List-id: Xen PPC development <xen-ppc-devel.lists.xensource.com>
List-post: <mailto:xen-ppc-devel@lists.xensource.com>
List-subscribe: <http://lists.xensource.com/cgi-bin/mailman/listinfo/xen-ppc-devel>, <mailto:xen-ppc-devel-request@lists.xensource.com?subject=subscribe>
List-unsubscribe: <http://lists.xensource.com/cgi-bin/mailman/listinfo/xen-ppc-devel>, <mailto:xen-ppc-devel-request@lists.xensource.com?subject=unsubscribe>
Reply-to: xen-ppc-devel@xxxxxxxxxxxxxxxxxxx
Sender: xen-ppc-devel-bounces@xxxxxxxxxxxxxxxxxxx
# HG changeset patch
# User Jimi Xenidis <jimix@xxxxxxxxxxxxxx>
# Node ID 17aa29a18b080bd96286b29e7b5918701a330eff
# Parent  e30fba67c38de4e6a769f0b57bb8613d79a23f16
[powerpc] Use new method to detect NULL xencomm handle

old method wasted cycles and could give false positive.

Signed-off-by: Jimi Xenidis <jimix@xxxxxxxxxxxxxx>
---
 arch/powerpc/platforms/xen/hcall.c |    5 +---
 drivers/xen/core/xencomm.c         |   45 +++++++++++++++++++------------------
 2 files changed, 26 insertions(+), 24 deletions(-)

diff -r e30fba67c38d -r 17aa29a18b08 arch/powerpc/platforms/xen/hcall.c
--- a/arch/powerpc/platforms/xen/hcall.c        Wed Jul 26 15:00:06 2006 -0400
+++ b/arch/powerpc/platforms/xen/hcall.c        Thu Jul 27 18:57:20 2006 -0400
@@ -93,9 +93,8 @@ int HYPERVISOR_xen_version(int cmd, void
                argsize = sizeof(xen_platform_parameters_t);
                break;
        case XENVER_pagesize:
-               argsize = sizeof(void *);
-               break;
-
+               argsize = (arg == NULL) ? 0 : sizeof(void *);
+               break;
        default:
                printk("%s: unknown version cmd %d\n", __func__, cmd);
                return -ENOSYS;
diff -r e30fba67c38d -r 17aa29a18b08 drivers/xen/core/xencomm.c
--- a/drivers/xen/core/xencomm.c        Wed Jul 26 15:00:06 2006 -0400
+++ b/drivers/xen/core/xencomm.c        Thu Jul 27 18:57:20 2006 -0400
@@ -59,33 +59,36 @@ static int __xencomm_init(struct xencomm
        unsigned long recorded = 0;
        int i = 0;
 
+       BUG_ON((buffer == NULL) && (bytes > 0));
+
        /* record the physical pages used */
-       if (buffer) {
-               while ((recorded < bytes) && (i < desc->nr_addrs)) {
-                       unsigned long vaddr = (unsigned long)buffer + recorded;
-                       unsigned long paddr;
-                       int offset;
-                       int chunksz;
+       if (buffer == NULL)
+               desc->nr_addrs = 0;
 
-                       offset = vaddr % PAGE_SIZE; /* handle partial pages */
-                       chunksz = min(PAGE_SIZE - offset, bytes - recorded);
+       while ((recorded < bytes) && (i < desc->nr_addrs)) {
+               unsigned long vaddr = (unsigned long)buffer + recorded;
+               unsigned long paddr;
+               int offset;
+               int chunksz;
 
-                       paddr = to_phys(vaddr);
-                       if (paddr == ~0UL) {
-                               printk("%s: couldn't translate vaddr %lx\n",
-                                      __func__, vaddr);
-                               return -EINVAL;
-                       }
+               offset = vaddr % PAGE_SIZE; /* handle partial pages */
+               chunksz = min(PAGE_SIZE - offset, bytes - recorded);
 
-                       desc->address[i++] = paddr;
-                       recorded += chunksz;
+               paddr = to_phys(vaddr);
+               if (paddr == ~0UL) {
+                       printk("%s: couldn't translate vaddr %lx\n",
+                              __func__, vaddr);
+                       return -EINVAL;
                }
 
-               if (recorded < bytes) {
-                       printk("%s: could only translate %ld of %ld bytes\n",
-                              __func__, recorded, bytes);
-                       return -ENOSPC;
-               }
+               desc->address[i++] = paddr;
+               recorded += chunksz;
+       }
+
+       if (recorded < bytes) {
+               printk("%s: could only translate %ld of %ld bytes\n",
+                      __func__, recorded, bytes);
+               return -ENOSPC;
        }
 
        /* mark remaining addresses invalid (just for safety) */

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

<Prev in Thread] Current Thread [Next in Thread>
  • [XenPPC] [linux-ppc-2.6] [powerpc] Use new method to detect NULL xencomm handle, Xen patchbot-linux-ppc-2 . 6 <=