public inbox for kvm@vger.kernel.org
 help / color / mirror / Atom feed
* [PATCH] fix *nopage() in kvm_main.c
@ 2007-07-11 10:53 Nguyen Anh Quynh
       [not found] ` <9cde8bff0707110353k5dd0e8adg1b944cd142f97fbe-JsoAwUIsXosN+BqQ9rBEUg@public.gmane.org>
  0 siblings, 1 reply; 4+ messages in thread
From: Nguyen Anh Quynh @ 2007-07-11 10:53 UTC (permalink / raw)
  To: kvm-devel-5NWGOfrQmneRv+LV9MX5uipxlwaOVQ5f

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

*nopage() in kvm_main.c should only store the type of mmap() fault if
the pointers are  not NULL. This patch fixes the problem.

Signed-off-by: Nguyen Anh Quynh <aquynh-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org>

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

diff --git a/drivers/kvm/kvm_main.c b/drivers/kvm/kvm_main.c
index 83bb284..0520d15 100644
--- a/drivers/kvm/kvm_main.c
+++ b/drivers/kvm/kvm_main.c
@@ -2317,7 +2317,6 @@ static struct page *kvm_vcpu_nopage(struct vm_area_struct *vma,
 	unsigned long pgoff;
 	struct page *page;
 
-	*type = VM_FAULT_MINOR;
 	pgoff = ((address - vma->vm_start) >> PAGE_SHIFT) + vma->vm_pgoff;
 	if (pgoff == 0)
 		page = virt_to_page(vcpu->run);
@@ -2326,6 +2325,9 @@ static struct page *kvm_vcpu_nopage(struct vm_area_struct *vma,
 	else
 		return NOPAGE_SIGBUS;
 	get_page(page);
+	if (type != NULL)
+		*type = VM_FAULT_MINOR;
+
 	return page;
 }
 
@@ -2800,12 +2802,14 @@ static struct page *kvm_vm_nopage(struct vm_area_struct *vma,
 	unsigned long pgoff;
 	struct page *page;
 
-	*type = VM_FAULT_MINOR;
 	pgoff = ((address - vma->vm_start) >> PAGE_SHIFT) + vma->vm_pgoff;
 	page = gfn_to_page(kvm, pgoff);
 	if (!page)
 		return NOPAGE_SIGBUS;
 	get_page(page);
+	if (type != NULL)
+		*type = VM_FAULT_MINOR;
+
 	return page;
 }
 

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

-------------------------------------------------------------------------
This SF.net email is sponsored by DB2 Express
Download DB2 Express C - the FREE version of DB2 express and take
control of your XML. No limits. Just data. Click to get it now.
http://sourceforge.net/powerbar/db2/

[-- Attachment #4: Type: text/plain, Size: 186 bytes --]

_______________________________________________
kvm-devel mailing list
kvm-devel-5NWGOfrQmneRv+LV9MX5uipxlwaOVQ5f@public.gmane.org
https://lists.sourceforge.net/lists/listinfo/kvm-devel

^ permalink raw reply related	[flat|nested] 4+ messages in thread

* Re: [PATCH] fix *nopage() in kvm_main.c
       [not found] ` <9cde8bff0707110353k5dd0e8adg1b944cd142f97fbe-JsoAwUIsXosN+BqQ9rBEUg@public.gmane.org>
@ 2007-07-11 11:09   ` Avi Kivity
       [not found]     ` <4694BA50.20405-atKUWr5tajBWk0Htik3J/w@public.gmane.org>
  0 siblings, 1 reply; 4+ messages in thread
From: Avi Kivity @ 2007-07-11 11:09 UTC (permalink / raw)
  To: Nguyen Anh Quynh; +Cc: kvm-devel-5NWGOfrQmneRv+LV9MX5uipxlwaOVQ5f

Nguyen Anh Quynh wrote:
> *nopage() in kvm_main.c should only store the type of mmap() fault if
> the pointers are  not NULL. This patch fixes the problem.
>

What caller of ->nopage() passes a NULL for type?

-- 
error compiling committee.c: too many arguments to function


-------------------------------------------------------------------------
This SF.net email is sponsored by DB2 Express
Download DB2 Express C - the FREE version of DB2 express and take
control of your XML. No limits. Just data. Click to get it now.
http://sourceforge.net/powerbar/db2/

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: [PATCH] fix *nopage() in kvm_main.c
       [not found]     ` <4694BA50.20405-atKUWr5tajBWk0Htik3J/w@public.gmane.org>
@ 2007-07-11 11:26       ` Nguyen Anh Quynh
       [not found]         ` <9cde8bff0707110426n4312edffga5f2d733142b71d9-JsoAwUIsXosN+BqQ9rBEUg@public.gmane.org>
  0 siblings, 1 reply; 4+ messages in thread
From: Nguyen Anh Quynh @ 2007-07-11 11:26 UTC (permalink / raw)
  To: Avi Kivity; +Cc: kvm-devel-5NWGOfrQmneRv+LV9MX5uipxlwaOVQ5f

On 7/11/07, Avi Kivity <avi-atKUWr5tajBWk0Htik3J/w@public.gmane.org> wrote:
> Nguyen Anh Quynh wrote:
> > *nopage() in kvm_main.c should only store the type of mmap() fault if
> > the pointers are  not NULL. This patch fixes the problem.
> >
>
> What caller of ->nopage() passes a NULL for type?

In that case we simply do nothing.

I check all the related code in kernel, and they handle the situation
in the same way: only store value into "type" if it is not NULL, and
ignore otherwise.

Cheers,
Q

-------------------------------------------------------------------------
This SF.net email is sponsored by DB2 Express
Download DB2 Express C - the FREE version of DB2 express and take
control of your XML. No limits. Just data. Click to get it now.
http://sourceforge.net/powerbar/db2/

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: [PATCH] fix *nopage() in kvm_main.c
       [not found]         ` <9cde8bff0707110426n4312edffga5f2d733142b71d9-JsoAwUIsXosN+BqQ9rBEUg@public.gmane.org>
@ 2007-07-11 11:31           ` Avi Kivity
  0 siblings, 0 replies; 4+ messages in thread
From: Avi Kivity @ 2007-07-11 11:31 UTC (permalink / raw)
  To: Nguyen Anh Quynh; +Cc: kvm-devel-5NWGOfrQmneRv+LV9MX5uipxlwaOVQ5f

Nguyen Anh Quynh wrote:
> On 7/11/07, Avi Kivity <avi-atKUWr5tajBWk0Htik3J/w@public.gmane.org> wrote:
>> Nguyen Anh Quynh wrote:
>> > *nopage() in kvm_main.c should only store the type of mmap() fault if
>> > the pointers are  not NULL. This patch fixes the problem.
>> >
>>
>> What caller of ->nopage() passes a NULL for type?
>
> In that case we simply do nothing.
>
> I check all the related code in kernel, and they handle the situation
> in the same way: only store value into "type" if it is not NULL, and
> ignore otherwise.
>

Right.  Applied, thanks.


-- 
error compiling committee.c: too many arguments to function


-------------------------------------------------------------------------
This SF.net email is sponsored by DB2 Express
Download DB2 Express C - the FREE version of DB2 express and take
control of your XML. No limits. Just data. Click to get it now.
http://sourceforge.net/powerbar/db2/

^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2007-07-11 11:31 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2007-07-11 10:53 [PATCH] fix *nopage() in kvm_main.c Nguyen Anh Quynh
     [not found] ` <9cde8bff0707110353k5dd0e8adg1b944cd142f97fbe-JsoAwUIsXosN+BqQ9rBEUg@public.gmane.org>
2007-07-11 11:09   ` Avi Kivity
     [not found]     ` <4694BA50.20405-atKUWr5tajBWk0Htik3J/w@public.gmane.org>
2007-07-11 11:26       ` Nguyen Anh Quynh
     [not found]         ` <9cde8bff0707110426n4312edffga5f2d733142b71d9-JsoAwUIsXosN+BqQ9rBEUg@public.gmane.org>
2007-07-11 11:31           ` Avi Kivity

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox