hi,
I tried to make huge page request in Fedora x86_64 PV DOMU guest using xen
4.1 unstable and it crashed.
I allocated hugepages by specifing boot parameter.
I used following command to check hugepages
#cat /proc/meminfo | grep Huge
HugePages_Total: 10
HugePages_Free: 10
HugePages_Rsvd: 0
Hugepagesize: 2048kB
It gave me that there are 10 free huge pages available.
Then in DOMU,I requested a huge page from C file as below.
#include <stdio.h>
#include <sys/ipc.h>
#include <sys/shm.h>
#include <stdlib.h>
#define MB_1 (1024*1024)
#define MB_8 (8*MB_1)
char *a;
int shmid1;
void init_hugetlb_seg()
{
shmid1 = shmget(2, MB_8, SHM_HUGETLB
| IPC_CREAT | SHM_R
| SHM_W);
if ( shmid1 < 0 ) {
perror("shmget");
exit(1);
}
printf("HugeTLB shmid: 0x%x\n", shmid1);
a = shmat(shmid1, 0, 0);
if (a == (char *)-1) {
perror("Shared memory attach failure");
shmctl(shmid1, IPC_RMID, NULL);
exit(2);
}
}
void wr_to_array()
{
int i;
for( i=0 ; i<MB_8 ; i++) {
a[i] = ''A'';
}
}
void rd_from_array()
{
int i, count = 0;
for( i=0 ; i<MB_8 ; i++)
if (a[i] == ''A'') count++;
if (count==i)
printf("HugeTLB read success :-)\n");
else
printf("HugeTLB read failed :-(\n");
}
int main(int argc, char *argv[])
{
init_hugetlb_seg();
printf("HugeTLB memory segment initialized !\n");
printf("Press any key to write to memory area\n");
getchar();
wr_to_array();
printf("Press any key to rd from memory area\n");
getchar();
rd_from_array();
shmctl(shmid1, IPC_RMID, NULL);
return 0;
}
Unfortunatly when hugepage requested from PV-DOMU, it crashed but when
I run the same code on normal linux, it successfuly returned hugepages.
Does it means that hugepages are not supported in PV-DOMU. If not then
me and my team would like to add support of Hugepages in PV-DOMU.
P.S: Crash report attached with this mail.
--
With Regards,
Ashwin Vasani
B.E. (Fourth Year)
Computer Engineering,
Pune Institute of Computer Technology.
+91 9960405802
_______________________________________________
Xen-devel mailing list
Xen-devel@lists.xensource.com
http://lists.xensource.com/xen-devel
ashwin wasani
2011-Jan-10 18:14 UTC
[Xen-devel] Re: Domain Crashed when requested a Hugepage
Sorry for starting this thread. Please do not reply on this and also follow this thread http://lists.xensource.com/archives/html/xen-devel/2011-01/msg00542.html On Mon, Jan 10, 2011 at 10:43 PM, ashwin wasani <vasani.ashwin@gmail.com>wrote:> hi, > I tried to make huge page request in Fedora x86_64 PV DOMU guest using xen > 4.1 unstable and it crashed. > I allocated hugepages by specifing boot parameter. > I used following command to check hugepages > #cat /proc/meminfo | grep Huge > HugePages_Total: 10 > HugePages_Free: 10 > HugePages_Rsvd: 0 > Hugepagesize: 2048kB > > It gave me that there are 10 free huge pages available. > > Then in DOMU,I requested a huge page from C file as below. > #include <stdio.h> > #include <sys/ipc.h> > #include <sys/shm.h> > #include <stdlib.h> > > #define MB_1 (1024*1024) > #define MB_8 (8*MB_1) > > char *a; > int shmid1; > > void init_hugetlb_seg() > { > shmid1 = shmget(2, MB_8, SHM_HUGETLB > | IPC_CREAT | SHM_R > | SHM_W); > if ( shmid1 < 0 ) { > perror("shmget"); > exit(1); > } > printf("HugeTLB shmid: 0x%x\n", shmid1); > a = shmat(shmid1, 0, 0); > if (a == (char *)-1) { > perror("Shared memory attach failure"); > shmctl(shmid1, IPC_RMID, NULL); > exit(2); > } > } > > void wr_to_array() > { > int i; > for( i=0 ; i<MB_8 ; i++) { > a[i] = ''A''; > } > } > > void rd_from_array() > { > int i, count = 0; > for( i=0 ; i<MB_8 ; i++) > if (a[i] == ''A'') count++; > if (count==i) > printf("HugeTLB read success :-)\n"); > else > printf("HugeTLB read failed :-(\n"); > } > > int main(int argc, char *argv[]) > { > init_hugetlb_seg(); > printf("HugeTLB memory segment initialized !\n"); > printf("Press any key to write to memory area\n"); > getchar(); > wr_to_array(); > printf("Press any key to rd from memory area\n"); > getchar(); > rd_from_array(); > shmctl(shmid1, IPC_RMID, NULL); > return 0; > } > Unfortunatly when hugepage requested from PV-DOMU, it crashed but when > I run the same code on normal linux, it successfuly returned hugepages. > Does it means that hugepages are not supported in PV-DOMU. If not then > me and my team would like to add support of Hugepages in PV-DOMU. > > P.S: Crash report attached with this mail. > -- > With Regards, > Ashwin Vasani > B.E. (Fourth Year) > Computer Engineering, > Pune Institute of Computer Technology. > +91 9960405802 >-- With Regards, Ashwin Vasani B.E. (Fourth Year) Computer Engineering, Pune Institute of Computer Technology. +91 9960405802 _______________________________________________ Xen-devel mailing list Xen-devel@lists.xensource.com http://lists.xensource.com/xen-devel