|
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [Xen-devel] [PATCH v1] getpageframeinfo3: replace hardcoded batchsize with constant
While looking for the cause of errors returnd by
XEN_DOMCTL_getpageframeinfo3 I came across this hardcoded value. Replace
it with a constant and use that constant also in libxc.
Signed-off-by: Olaf Hering <olaf@xxxxxxxxx>
---
tools/libxc/xc_domain.c | 9 +++++----
xen/arch/x86/domctl.c | 2 +-
xen/include/public/domctl.h | 2 ++
3 files changed, 8 insertions(+), 5 deletions(-)
diff --git a/tools/libxc/xc_domain.c b/tools/libxc/xc_domain.c
index ea3df1ef31..20dc4e2bf5 100644
--- a/tools/libxc/xc_domain.c
+++ b/tools/libxc/xc_domain.c
@@ -2035,14 +2035,15 @@ int xc_map_domain_meminfo(xc_interface *xch, uint32_t
domid,
minfo->guest_width);
/* Retrieve PFN types in batches */
- for ( i = 0; i < minfo->p2m_size ; i+=1024 )
+ for ( i = 0; i < minfo->p2m_size ; i+=XEN_GETPAGEFRAMEINFO3_MAX_SIZE )
{
- int count = ((minfo->p2m_size - i ) > 1024 ) ?
- 1024: (minfo->p2m_size - i);
+ int count = ((minfo->p2m_size - i ) > XEN_GETPAGEFRAMEINFO3_MAX_SIZE )
?
+ XEN_GETPAGEFRAMEINFO3_MAX_SIZE: (minfo->p2m_size - i);
if ( xc_get_pfn_type_batch(xch, domid, count, minfo->pfn_type + i) )
{
- PERROR("Could not get %d-eth batch of PFN types", (i+1)/1024);
+ PERROR("Could not get %d-eth batch of PFN types",
+ (i+1)/XEN_GETPAGEFRAMEINFO3_MAX_SIZE);
goto failed;
}
}
diff --git a/xen/arch/x86/domctl.c b/xen/arch/x86/domctl.c
index 8fbbf3aeb3..daf733de4f 100644
--- a/xen/arch/x86/domctl.c
+++ b/xen/arch/x86/domctl.c
@@ -421,7 +421,7 @@ long arch_do_domctl(
/* Games to allow this code block to handle a compat guest. */
void __user *guest_handle = domctl->u.getpageframeinfo3.array.p;
- if ( unlikely(num > 1024) ||
+ if ( unlikely(num > XEN_GETPAGEFRAMEINFO3_MAX_SIZE) ||
unlikely(num != domctl->u.getpageframeinfo3.num) )
{
ret = -E2BIG;
diff --git a/xen/include/public/domctl.h b/xen/include/public/domctl.h
index ec7a860afc..8d39cc8f74 100644
--- a/xen/include/public/domctl.h
+++ b/xen/include/public/domctl.h
@@ -137,6 +137,8 @@ DEFINE_XEN_GUEST_HANDLE(xen_domctl_getdomaininfo_t);
#define XEN_DOMCTL_PFINFO_BROKEN (0xdU<<28) /* broken page */
#define XEN_DOMCTL_PFINFO_LTAB_MASK (0xfU<<28)
+#define XEN_GETPAGEFRAMEINFO3_MAX_SIZE 1024U
+
/* XEN_DOMCTL_getpageframeinfo3 */
struct xen_domctl_getpageframeinfo3 {
/* IN variables. */
_______________________________________________
Xen-devel mailing list
Xen-devel@xxxxxxxxxxxxxxxxxxxx
https://lists.xenproject.org/mailman/listinfo/xen-devel
|
![]() |
Lists.xenproject.org is hosted with RackSpace, monitoring our |