Skip to contentSkip to conversation

tools/libxc: handle fallback in linux_privcmd_map_foreign_bulk properly

PATCH Andres Lagar-Cavilla 2 participants 2 messages Jan 26, 2012 – Jan 27, 2012 1 message not in the archive

lore
Share & tools
lore

A message that is not in the archive (sent off-list or not yet received): [email protected]

Andres Lagar-Cavilla

author Acked-by
#1 lore raw
Quoted 15 lines

Date: Thu, 26 Jan 2012 14:36:30 +0100
From: Olaf Hering <[email protected]>
To: [email protected]
Subject: [Xen-devel] [PATCH] tools/libxc: handle fallback in
linux_privcmd_map_foreign_bulk properly
Message-ID: <[email protected]>
Content-Type: text/plain; charset="us-ascii"

# HG changeset patch
# User Olaf Hering <[email protected]>
# Date 1327584962 -3600
# Node ID aa0d678fece208975984e8e59ca223c07fc50c06
# Parent 89fdabcf315fdaabeebf05c51a6b3b6dd4c20e85 tools/libxc: handle fallback in linux_privcmd_map_foreign_bulk properly

Quoted 6 lines

If the first ioctl fails with ENOENT it means the command is known. If a second attempt to map each gfn happens to fail then there is no need to run the fallback code. Some gfns are paged and the fallback code would not fix the failure. Instead return the EINVAL to the caller.

Thanks,
Andres

Quoted 25 lines

diff -r 89fdabcf315f -r aa0d678fece2 tools/libxc/xc_linux_osdep.c

tools/libxc/xc_linux_osdep.c +3 -2
@@ -217,6 +217,7 @@ static void *linux_privcmd_map_foreign_b
 
     rc = ioctl(fd, IOCTL_PRIVCMD_MMAPBATCH_V2, &ioctlx);
 
+    /* Command was recognized, some gfn in arr are in paging state */
     if ( rc < 0 && errno == ENOENT )
     {
         for ( i = rc = 0; rc == 0 && i < num; i++ )
@@ -235,8 +236,8 @@ static void *linux_privcmd_map_foreign_b
             } while ( rc < 0 && errno == ENOENT && err[i] == -ENOENT );
         }
     }
-
-    if ( rc < 0 && errno == EINVAL && (int)num > 0 )
+    /* Command was not recognized, use fall back */
+    else if ( rc < 0 && errno == EINVAL && (int)num > 0 )
     {
         /*
          * IOCTL_PRIVCMD_MMAPBATCH_V2 is not supported - fall back to
#2 lore raw
Quoted 6 lines
Quoted 6 lines

# HG changeset patch
# User Olaf Hering <[email protected]>
# Date 1327584962 -3600
# Node ID aa0d678fece208975984e8e59ca223c07fc50c06
# Parent 89fdabcf315fdaabeebf05c51a6b3b6dd4c20e85 tools/libxc: handle fallback in linux_privcmd_map_foreign_bulk properly