* [PATCH] remove duplicate code
@ 2007-10-02 20:31 Glauber de Oliveira Costa
[not found] ` <11913571011888-git-send-email-gcosta-H+wXaHxf7aLQT0dZR+AlfA@public.gmane.org>
0 siblings, 1 reply; 6+ messages in thread
From: Glauber de Oliveira Costa @ 2007-10-02 20:31 UTC (permalink / raw)
To: kvm-devel-5NWGOfrQmneRv+LV9MX5uipxlwaOVQ5f
Cc: avi-atKUWr5tajBWk0Htik3J/w, Glauber de Oliveira Costa
This patch removes duplicate code at vl.c. Once the KVM-only
part defines how much physicall memory it wants, the rest should
be the same for everybody.
Signed-off-by: Glauber de Oliveira Costa <gcosta-H+wXaHxf7aLQT0dZR+AlfA@public.gmane.org>
---
qemu/vl.c | 23 +++++++++--------------
1 files changed, 9 insertions(+), 14 deletions(-)
diff --git a/qemu/vl.c b/qemu/vl.c
index fe49d2c..4f8cf51 100644
--- a/qemu/vl.c
+++ b/qemu/vl.c
@@ -8246,7 +8246,7 @@ int main(int argc, char **argv)
help(1);
if (ram_size > PHYS_RAM_MAX_SIZE) {
fprintf(stderr, "qemu: at most %d MB RAM can be simulated\n",
- PHYS_RAM_MAX_SIZE / (1024 * 1024));
+ (int)PHYS_RAM_MAX_SIZE / (1024 * 1024));
exit(1);
}
break;
@@ -8657,20 +8657,15 @@ int main(int argc, char **argv)
fprintf(stderr, "Could not create KVM context\n");
exit(1);
}
- } else {
- phys_ram_base = qemu_vmalloc(phys_ram_size);
- if (!phys_ram_base) {
- fprintf(stderr, "Could not allocate physical memory\n");
- exit(1);
- }
- }
-#else
- phys_ram_base = qemu_vmalloc(phys_ram_size);
- if (!phys_ram_base) {
- fprintf(stderr, "Could not allocate physical memory\n");
- exit(1);
- }
+ } else
#endif
+ {
+ phys_ram_base = qemu_vmalloc(phys_ram_size);
+ if (!phys_ram_base) {
+ fprintf(stderr, "Could not allocate physical memory\n");
+ exit(1);
+ }
+ }
/* we always create the cdrom drive, even if no disk is there */
bdrv_init();
--
1.4.4.2
-------------------------------------------------------------------------
This SF.net email is sponsored by: Microsoft
Defy all challenges. Microsoft(R) Visual Studio 2005.
http://clk.atdmt.com/MRT/go/vse0120000070mrt/direct/01/
^ permalink raw reply related [flat|nested] 6+ messages in thread
* [PATCH] remove duplicate code
@ 2007-10-02 20:36 Glauber de Oliveira Costa
[not found] ` <11913574143708-git-send-email-gcosta-H+wXaHxf7aLQT0dZR+AlfA@public.gmane.org>
0 siblings, 1 reply; 6+ messages in thread
From: Glauber de Oliveira Costa @ 2007-10-02 20:36 UTC (permalink / raw)
To: kvm-devel-5NWGOfrQmneRv+LV9MX5uipxlwaOVQ5f
Cc: avi-atKUWr5tajBWk0Htik3J/w, Glauber de Oliveira Costa
This patch removes duplicate code at vl.c. Once the KVM-only
part defines how much physicall memory it wants, the rest should
be the same for everybody.
Signed-off-by: Glauber de Oliveira Costa <gcosta-H+wXaHxf7aLQT0dZR+AlfA@public.gmane.org>
---
qemu/vl.c | 23 +++++++++--------------
1 files changed, 9 insertions(+), 14 deletions(-)
diff --git a/qemu/vl.c b/qemu/vl.c
index fe49d2c..4f8cf51 100644
--- a/qemu/vl.c
+++ b/qemu/vl.c
@@ -8657,20 +8657,15 @@ int main(int argc, char **argv)
fprintf(stderr, "Could not create KVM context\n");
exit(1);
}
- } else {
- phys_ram_base = qemu_vmalloc(phys_ram_size);
- if (!phys_ram_base) {
- fprintf(stderr, "Could not allocate physical memory\n");
- exit(1);
- }
- }
-#else
- phys_ram_base = qemu_vmalloc(phys_ram_size);
- if (!phys_ram_base) {
- fprintf(stderr, "Could not allocate physical memory\n");
- exit(1);
- }
+ } else
#endif
+ {
+ phys_ram_base = qemu_vmalloc(phys_ram_size);
+ if (!phys_ram_base) {
+ fprintf(stderr, "Could not allocate physical memory\n");
+ exit(1);
+ }
+ }
/* we always create the cdrom drive, even if no disk is there */
bdrv_init();
--
1.4.4.2
-------------------------------------------------------------------------
This SF.net email is sponsored by: Microsoft
Defy all challenges. Microsoft(R) Visual Studio 2005.
http://clk.atdmt.com/MRT/go/vse0120000070mrt/direct/01/
^ permalink raw reply related [flat|nested] 6+ messages in thread
* Re: [PATCH] remove duplicate code
[not found] ` <11913571011888-git-send-email-gcosta-H+wXaHxf7aLQT0dZR+AlfA@public.gmane.org>
@ 2007-10-02 23:21 ` Glauber de Oliveira Costa
0 siblings, 0 replies; 6+ messages in thread
From: Glauber de Oliveira Costa @ 2007-10-02 23:21 UTC (permalink / raw)
To: Glauber de Oliveira Costa
Cc: kvm-devel-5NWGOfrQmneRv+LV9MX5uipxlwaOVQ5f,
avi-atKUWr5tajBWk0Htik3J/w
On 10/2/07, Glauber de Oliveira Costa <gcosta-H+wXaHxf7aLQT0dZR+AlfA@public.gmane.org> wrote:
> @@ -8246,7 +8246,7 @@ int main(int argc, char **argv)
> help(1);
> if (ram_size > PHYS_RAM_MAX_SIZE) {
> fprintf(stderr, "qemu: at most %d MB RAM can be simulated\n",
> - PHYS_RAM_MAX_SIZE / (1024 * 1024));
> + (int)PHYS_RAM_MAX_SIZE / (1024 * 1024));
> exit(1);
> }
> break;
Ok, this is the wrong version. The above diff is bogus.
I'll resend a new one.
--
Glauber de Oliveira Costa.
"Free as in Freedom"
http://glommer.net
"The less confident you are, the more serious you have to act."
-------------------------------------------------------------------------
This SF.net email is sponsored by: Microsoft
Defy all challenges. Microsoft(R) Visual Studio 2005.
http://clk.atdmt.com/MRT/go/vse0120000070mrt/direct/01/
^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: [PATCH] remove duplicate code
[not found] ` <11913574143708-git-send-email-gcosta-H+wXaHxf7aLQT0dZR+AlfA@public.gmane.org>
@ 2007-10-07 11:46 ` Avi Kivity
0 siblings, 0 replies; 6+ messages in thread
From: Avi Kivity @ 2007-10-07 11:46 UTC (permalink / raw)
To: Glauber de Oliveira Costa; +Cc: kvm-devel-5NWGOfrQmneRv+LV9MX5uipxlwaOVQ5f
Glauber de Oliveira Costa wrote:
> This patch removes duplicate code at vl.c. Once the KVM-only
> part defines how much physicall memory it wants, the rest should
> be the same for everybody.
>
> Signed-off-by: Glauber de Oliveira Costa <gcosta-H+wXaHxf7aLQT0dZR+AlfA@public.gmane.org>
> ---
> qemu/vl.c | 23 +++++++++--------------
> 1 files changed, 9 insertions(+), 14 deletions(-)
>
> diff --git a/qemu/vl.c b/qemu/vl.c
> index fe49d2c..4f8cf51 100644
> --- a/qemu/vl.c
> +++ b/qemu/vl.c
> @@ -8657,20 +8657,15 @@ int main(int argc, char **argv)
> fprintf(stderr, "Could not create KVM context\n");
> exit(1);
> }
> - } else {
> - phys_ram_base = qemu_vmalloc(phys_ram_size);
> - if (!phys_ram_base) {
> - fprintf(stderr, "Could not allocate physical memory\n");
> - exit(1);
> - }
> - }
> -#else
> - phys_ram_base = qemu_vmalloc(phys_ram_size);
> - if (!phys_ram_base) {
> - fprintf(stderr, "Could not allocate physical memory\n");
> - exit(1);
> - }
> + } else
> #endif
> + {
> + phys_ram_base = qemu_vmalloc(phys_ram_size);
> + if (!phys_ram_base) {
> + fprintf(stderr, "Could not allocate physical memory\n");
> + exit(1);
> + }
> + }
>
> /* we always create the cdrom drive, even if no disk is there */
> bdrv_init();
>
This touches original qemu lines, which is likely to cause me pain on
the next merge. Maybe a goto after the kvm allocation code can remove
the need to touch that code.
In any case this code is being worked on to be much more similar to
regular qemu.
--
Any sufficiently difficult bug is indistinguishable from a feature.
-------------------------------------------------------------------------
This SF.net email is sponsored by: Splunk Inc.
Still grepping through log files to find problems? Stop.
Now Search log events and configuration files using AJAX and a browser.
Download your FREE copy of Splunk now >> http://get.splunk.com/
^ permalink raw reply [flat|nested] 6+ messages in thread
* [PATCH] remove duplicate code
@ 2009-03-22 10:37 Gleb Natapov
2009-03-22 11:11 ` Avi Kivity
0 siblings, 1 reply; 6+ messages in thread
From: Gleb Natapov @ 2009-03-22 10:37 UTC (permalink / raw)
To: avi; +Cc: kvm
svm_do_inject_vector() reimplements pop_irq().
Signed-off-by: Gleb Natapov <gleb@redhat.com>
diff --git a/arch/x86/kvm/svm.c b/arch/x86/kvm/svm.c
index 1821c20..da23fd3 100644
--- a/arch/x86/kvm/svm.c
+++ b/arch/x86/kvm/svm.c
@@ -2344,15 +2344,7 @@ static void kvm_reput_irq(struct vcpu_svm *svm)
static void svm_do_inject_vector(struct vcpu_svm *svm)
{
- struct kvm_vcpu *vcpu = &svm->vcpu;
- int word_index = __ffs(vcpu->arch.irq_summary);
- int bit_index = __ffs(vcpu->arch.irq_pending[word_index]);
- int irq = word_index * BITS_PER_LONG + bit_index;
-
- clear_bit(bit_index, &vcpu->arch.irq_pending[word_index]);
- if (!vcpu->arch.irq_pending[word_index])
- clear_bit(word_index, &vcpu->arch.irq_summary);
- svm_inject_irq(svm, irq);
+ svm_inject_irq(svm, pop_irq(&svm->vcpu));
}
static void do_interrupt_requests(struct kvm_vcpu *vcpu,
--
Gleb.
^ permalink raw reply related [flat|nested] 6+ messages in thread
* Re: [PATCH] remove duplicate code
2009-03-22 10:37 [PATCH] remove duplicate code Gleb Natapov
@ 2009-03-22 11:11 ` Avi Kivity
0 siblings, 0 replies; 6+ messages in thread
From: Avi Kivity @ 2009-03-22 11:11 UTC (permalink / raw)
To: Gleb Natapov; +Cc: kvm
Gleb Natapov wrote:
> svm_do_inject_vector() reimplements pop_irq().
>
Applied, thanks.
--
error compiling committee.c: too many arguments to function
^ permalink raw reply [flat|nested] 6+ messages in thread
end of thread, other threads:[~2009-03-22 11:11 UTC | newest]
Thread overview: 6+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2009-03-22 10:37 [PATCH] remove duplicate code Gleb Natapov
2009-03-22 11:11 ` Avi Kivity
-- strict thread matches above, loose matches on Subject: below --
2007-10-02 20:36 Glauber de Oliveira Costa
[not found] ` <11913574143708-git-send-email-gcosta-H+wXaHxf7aLQT0dZR+AlfA@public.gmane.org>
2007-10-07 11:46 ` Avi Kivity
2007-10-02 20:31 Glauber de Oliveira Costa
[not found] ` <11913571011888-git-send-email-gcosta-H+wXaHxf7aLQT0dZR+AlfA@public.gmane.org>
2007-10-02 23:21 ` Glauber de Oliveira Costa
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox