diff mbox

Query about SPE operation fault in e500v2 KVM. thanks.

Message ID 9CFE1FE9-E0A8-489A-A536-80EDA0E6D413@suse.de
State New, archived
Headers show

Commit Message

Alexander Graf Jan. 31, 2013, 12:30 p.m. UTC
On 31.01.2013, at 13:17, Gao Guanhua-B22826 wrote:

> Hello all,
> 
> I met a problem of SPE operation in PowerPC e500v2 KVM, could anyone help to check or provide some suggestions? Thank you.
> 
> Test platform: P1024RDB (e500v2)
> Kernel version: Linux p1024rdb 3.0.51-rt75
> Test case description:
> Use SPE to handle data that not aligned in guest. When I execute the case, host will report call_trace and guest will be hung.
> 
> Test log:
> 
> Host:
> root@p1024rdb:/media/ram# qemu-system-ppc -enable-kvm -nographic -M ppce500v2 -kernel uImage.ppce500v2-kvm -initrd /media/ram/fsl-image-core-p1024rdb.ext2.gz -append "root=/dev/ram rw console=ttyS0,115200" -serial tcp::4444,server,telnet -dtb /usr/share/qemu/ppce500v2.dtb -m 256 -net nic,macaddr=52:54:00:12:34:66 -net tap,script=qemu-ifup -monitor /dev/null & [1] 2264 Created kernel irqchip root@p1024rdb:/media/ram# test for existing bridge br0 BusyBox v1.19.4 (2013-01-26 00:01:45 CST) multi-call binary.
> 
> Usage: brctl COMMAND [BRIDGE [INTERFACE]]
> 
> need to create bridge br0
> br0: port 1(eth0) entering forwarding state
> brctl: bridge br0: File exists
> br0: port 1(eth0) entering forwarding state
> br0: port 1(eth0) entering forwarding state
> brctl: bridge br0: Device or resource busy created bridge br0
> bridge name     bridge id               STP enabled     interfaces
> br0             8000.00e00c00de00       no              eth0
> device tap0 entered promiscuous mode
> br0: port 2(tap0) entering forwarding state
> br0: port 2(tap0) entering forwarding state QEMU waiting for connection on: telnet:0.0.0.0:4444,server
> PHY: mdio@ffe24000:02 - Link is Up - 1000/Full
> eth0: no IPv6 routers present
> tap0: no IPv6 routers present
> br0: port 1(eth0) entering forwarding state
> br0: port 2(tap0) entering forwarding state
> 
> root@p1024rdb:/media/ram# exit_nr 5
> ------------[ cut here ]------------
> kernel BUG at arch/powerpc/kvm/booke.c:1273!

That means we don't handle ALIGNMENT exits. Could you please check whether the below (completely untested) patch makes this work?


Alex


--
To unsubscribe from this list: send the line "unsubscribe kvm-ppc" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html

Comments

Gao Guanhua Jan. 31, 2013, 12:36 p.m. UTC | #1
Thank you, Alex :)
I will have a try.

> -----Original Message-----
> From: Alexander Graf [mailto:agraf@suse.de]
> Sent: Thursday, January 31, 2013 8:30 PM
> To: Gao Guanhua-B22826
> Cc: kvm-ppc@vger.kernel.org
> Subject: Re: Query about SPE operation fault in e500v2 KVM. thanks.
> 
> 
> On 31.01.2013, at 13:17, Gao Guanhua-B22826 wrote:
> 
> > Hello all,
> >
> > I met a problem of SPE operation in PowerPC e500v2 KVM, could anyone
> help to check or provide some suggestions? Thank you.
> >
> > Test platform: P1024RDB (e500v2)
> > Kernel version: Linux p1024rdb 3.0.51-rt75 Test case description:
> > Use SPE to handle data that not aligned in guest. When I execute the
> case, host will report call_trace and guest will be hung.
> >
> > Test log:
> >
> > Host:
> > root@p1024rdb:/media/ram# qemu-system-ppc -enable-kvm -nographic -M
> ppce500v2 -kernel uImage.ppce500v2-kvm -initrd /media/ram/fsl-image-core-
> p1024rdb.ext2.gz -append "root=/dev/ram rw console=ttyS0,115200" -serial
> tcp::4444,server,telnet -dtb /usr/share/qemu/ppce500v2.dtb -m 256 -net
> nic,macaddr=52:54:00:12:34:66 -net tap,script=qemu-ifup -monitor
> /dev/null & [1] 2264 Created kernel irqchip root@p1024rdb:/media/ram#
> test for existing bridge br0 BusyBox v1.19.4 (2013-01-26 00:01:45 CST)
> multi-call binary.
> >
> > Usage: brctl COMMAND [BRIDGE [INTERFACE]]
> >
> > need to create bridge br0
> > br0: port 1(eth0) entering forwarding state
> > brctl: bridge br0: File exists
> > br0: port 1(eth0) entering forwarding state
> > br0: port 1(eth0) entering forwarding state
> > brctl: bridge br0: Device or resource busy created bridge br0
> > bridge name     bridge id               STP enabled     interfaces
> > br0             8000.00e00c00de00       no              eth0
> > device tap0 entered promiscuous mode
> > br0: port 2(tap0) entering forwarding state
> > br0: port 2(tap0) entering forwarding state QEMU waiting for
> > connection on: telnet:0.0.0.0:4444,server
> > PHY: mdio@ffe24000:02 - Link is Up - 1000/Full
> > eth0: no IPv6 routers present
> > tap0: no IPv6 routers present
> > br0: port 1(eth0) entering forwarding state
> > br0: port 2(tap0) entering forwarding state
> >
> > root@p1024rdb:/media/ram# exit_nr 5
> > ------------[ cut here ]------------
> > kernel BUG at arch/powerpc/kvm/booke.c:1273!
> 
> That means we don't handle ALIGNMENT exits. Could you please check
> whether the below (completely untested) patch makes this work?
> 
> 
> Alex
> 
> diff --git a/arch/powerpc/kvm/booke.c b/arch/powerpc/kvm/booke.c index
> d2f502d..38a62ef 100644
> --- a/arch/powerpc/kvm/booke.c
> +++ b/arch/powerpc/kvm/booke.c
> @@ -182,6 +182,14 @@ static void kvmppc_core_queue_inst_storage(struct
> kvm_vcpu *vcpu,
>  	kvmppc_booke_queue_irqprio(vcpu, BOOKE_IRQPRIO_INST_STORAGE);  }
> 
> +static void kvmppc_core_queue_alignment(struct kvm_vcpu *vcpu, ulong
> dear_flags,
> +					ulong esr_flags)
> +{
> +	vcpu->arch.queued_dear = dear_flags;
> +	vcpu->arch.queued_esr = esr_flags;
> +	kvmppc_booke_queue_irqprio(vcpu, BOOKE_IRQPRIO_ALIGNMENT); }
> +
>  void kvmppc_core_queue_program(struct kvm_vcpu *vcpu, ulong esr_flags)
> {
>  	vcpu->arch.queued_esr = esr_flags;
> @@ -971,6 +979,12 @@ int kvmppc_handle_exit(struct kvm_run *run, struct
> kvm_vcpu *vcpu,
>  		r = RESUME_GUEST;
>  		break;
> 
> +	case BOOKE_INTERRUPT_ALIGNMENT:
> +		kvmppc_core_queue_alignment(vcpu, vcpu->arch.fault_dear,
> +		                            vcpu->arch.fault_esr);
> +		r = RESUME_GUEST;
> +		break;
> +
>  #ifdef CONFIG_KVM_BOOKE_HV
>  	case BOOKE_INTERRUPT_HV_SYSCALL:
>  		if (!(vcpu->arch.shared->msr & MSR_PR)) {
> 


--
To unsubscribe from this list: send the line "unsubscribe kvm-ppc" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Gao Guanhua Feb. 1, 2013, 6:09 a.m. UTC | #2
Hi Alex,

The guest will not be hung after applying the patch, but the test result is still wrong.

root@model:/media/ram# ./spe_align_e500v2
high in 0x1 out 0xaaaaaaaa
low in 0x1 out 0xbbbbbbbb
spe test failed!
Segmentation fault

Then we made some more modifications, the test result is right finally.

In arch/powerpc/kvm/booke.c  kvmppc_booke_irqprio_deliver:
        case BOOKE_IRQPRIO_ALIGNMENT:
                update_dear = true;
                allowed = 1;
                msr_mask = MSR_CE | MSR_ME | MSR_DE;
                int_class = INT_CLASS_NONCRIT;
                break;
In arch/powerpc/kvm/booke_interrupts.S
#define NEED_DEAR_MASK ((1<<BOOKE_INTERRUPT_DATA_STORAGE) | \
                        (1<<BOOKE_INTERRUPT_DTLB_MISS) | \
                        (1<<BOOKE_INTERRUPT_ALIGNMENT))

Test result:
root@model:/media/ram# ./spe_align_e500v2
high in 0x64 out 0x64
low in 0x64 out 0x64


regards,
guanhua


> -----Original Message-----
> From: Alexander Graf [mailto:agraf@suse.de]
> Sent: Thursday, January 31, 2013 8:30 PM
> To: Gao Guanhua-B22826
> Cc: kvm-ppc@vger.kernel.org
> Subject: Re: Query about SPE operation fault in e500v2 KVM. thanks.
> 
> 
> On 31.01.2013, at 13:17, Gao Guanhua-B22826 wrote:
> 
> > Hello all,
> >
> > I met a problem of SPE operation in PowerPC e500v2 KVM, could anyone
> help to check or provide some suggestions? Thank you.
> >
> > Test platform: P1024RDB (e500v2)
> > Kernel version: Linux p1024rdb 3.0.51-rt75 Test case description:
> > Use SPE to handle data that not aligned in guest. When I execute the
> case, host will report call_trace and guest will be hung.
> >
> > Test log:
> >
> > Host:
> > root@p1024rdb:/media/ram# qemu-system-ppc -enable-kvm -nographic -M
> ppce500v2 -kernel uImage.ppce500v2-kvm -initrd /media/ram/fsl-image-core-
> p1024rdb.ext2.gz -append "root=/dev/ram rw console=ttyS0,115200" -serial
> tcp::4444,server,telnet -dtb /usr/share/qemu/ppce500v2.dtb -m 256 -net
> nic,macaddr=52:54:00:12:34:66 -net tap,script=qemu-ifup -monitor
> /dev/null & [1] 2264 Created kernel irqchip root@p1024rdb:/media/ram#
> test for existing bridge br0 BusyBox v1.19.4 (2013-01-26 00:01:45 CST)
> multi-call binary.
> >
> > Usage: brctl COMMAND [BRIDGE [INTERFACE]]
> >
> > need to create bridge br0
> > br0: port 1(eth0) entering forwarding state
> > brctl: bridge br0: File exists
> > br0: port 1(eth0) entering forwarding state
> > br0: port 1(eth0) entering forwarding state
> > brctl: bridge br0: Device or resource busy created bridge br0
> > bridge name     bridge id               STP enabled     interfaces
> > br0             8000.00e00c00de00       no              eth0
> > device tap0 entered promiscuous mode
> > br0: port 2(tap0) entering forwarding state
> > br0: port 2(tap0) entering forwarding state QEMU waiting for
> > connection on: telnet:0.0.0.0:4444,server
> > PHY: mdio@ffe24000:02 - Link is Up - 1000/Full
> > eth0: no IPv6 routers present
> > tap0: no IPv6 routers present
> > br0: port 1(eth0) entering forwarding state
> > br0: port 2(tap0) entering forwarding state
> >
> > root@p1024rdb:/media/ram# exit_nr 5
> > ------------[ cut here ]------------
> > kernel BUG at arch/powerpc/kvm/booke.c:1273!
> 
> That means we don't handle ALIGNMENT exits. Could you please check
> whether the below (completely untested) patch makes this work?
> 
> 
> Alex
> 
> diff --git a/arch/powerpc/kvm/booke.c b/arch/powerpc/kvm/booke.c index
> d2f502d..38a62ef 100644
> --- a/arch/powerpc/kvm/booke.c
> +++ b/arch/powerpc/kvm/booke.c
> @@ -182,6 +182,14 @@ static void kvmppc_core_queue_inst_storage(struct
> kvm_vcpu *vcpu,
>  	kvmppc_booke_queue_irqprio(vcpu, BOOKE_IRQPRIO_INST_STORAGE);  }
> 
> +static void kvmppc_core_queue_alignment(struct kvm_vcpu *vcpu, ulong
> dear_flags,
> +					ulong esr_flags)
> +{
> +	vcpu->arch.queued_dear = dear_flags;
> +	vcpu->arch.queued_esr = esr_flags;
> +	kvmppc_booke_queue_irqprio(vcpu, BOOKE_IRQPRIO_ALIGNMENT); }
> +
>  void kvmppc_core_queue_program(struct kvm_vcpu *vcpu, ulong esr_flags)
> {
>  	vcpu->arch.queued_esr = esr_flags;
> @@ -971,6 +979,12 @@ int kvmppc_handle_exit(struct kvm_run *run, struct
> kvm_vcpu *vcpu,
>  		r = RESUME_GUEST;
>  		break;
> 
> +	case BOOKE_INTERRUPT_ALIGNMENT:
> +		kvmppc_core_queue_alignment(vcpu, vcpu->arch.fault_dear,
> +		                            vcpu->arch.fault_esr);
> +		r = RESUME_GUEST;
> +		break;
> +
>  #ifdef CONFIG_KVM_BOOKE_HV
>  	case BOOKE_INTERRUPT_HV_SYSCALL:
>  		if (!(vcpu->arch.shared->msr & MSR_PR)) {
> 


--
To unsubscribe from this list: send the line "unsubscribe kvm-ppc" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Alexander Graf Feb. 1, 2013, 8:14 a.m. UTC | #3
On 01.02.2013, at 07:09, Gao Guanhua-B22826 wrote:

> Hi Alex,
> 
> The guest will not be hung after applying the patch, but the test result is still wrong.
> 
> root@model:/media/ram# ./spe_align_e500v2
> high in 0x1 out 0xaaaaaaaa
> low in 0x1 out 0xbbbbbbbb
> spe test failed!
> Segmentation fault
> 
> Then we made some more modifications, the test result is right finally.
> 
> In arch/powerpc/kvm/booke.c  kvmppc_booke_irqprio_deliver:
>        case BOOKE_IRQPRIO_ALIGNMENT:
>                update_dear = true;
>                allowed = 1;
>                msr_mask = MSR_CE | MSR_ME | MSR_DE;
>                int_class = INT_CLASS_NONCRIT;
>                break;
> In arch/powerpc/kvm/booke_interrupts.S
> #define NEED_DEAR_MASK ((1<<BOOKE_INTERRUPT_DATA_STORAGE) | \
>                        (1<<BOOKE_INTERRUPT_DTLB_MISS) | \
>                        (1<<BOOKE_INTERRUPT_ALIGNMENT))
> 
> Test result:
> root@model:/media/ram# ./spe_align_e500v2
> high in 0x64 out 0x64
> low in 0x64 out 0x64

Thanks a lot for testing and fixing this one :). I'm glad it works for you. I've written up a patch that does this slightly differently and also takes EPR into account. Could you please check whether that one works as well?


Thanks,

Alex

--
To unsubscribe from this list: send the line "unsubscribe kvm-ppc" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Gao Guanhua Feb. 1, 2013, 8:45 a.m. UTC | #4
Hi Alex,

The new patch works well.


Regards,
Guanhua

> -----Original Message-----
> From: Alexander Graf [mailto:agraf@suse.de]
> Sent: Friday, February 01, 2013 4:15 PM
> To: Gao Guanhua-B22826
> Cc: kvm-ppc@vger.kernel.org
> Subject: Re: Query about SPE operation fault in e500v2 KVM. thanks.
> 
> On 01.02.2013, at 07:09, Gao Guanhua-B22826 wrote:
> 
> > Hi Alex,
> >
> > The guest will not be hung after applying the patch, but the test
> result is still wrong.
> >
> > root@model:/media/ram# ./spe_align_e500v2 high in 0x1 out 0xaaaaaaaa
> > low in 0x1 out 0xbbbbbbbb spe test failed!
> > Segmentation fault
> >
> > Then we made some more modifications, the test result is right finally.
> >
> > In arch/powerpc/kvm/booke.c  kvmppc_booke_irqprio_deliver:
> >        case BOOKE_IRQPRIO_ALIGNMENT:
> >                update_dear = true;
> >                allowed = 1;
> >                msr_mask = MSR_CE | MSR_ME | MSR_DE;
> >                int_class = INT_CLASS_NONCRIT;
> >                break;
> > In arch/powerpc/kvm/booke_interrupts.S
> > #define NEED_DEAR_MASK ((1<<BOOKE_INTERRUPT_DATA_STORAGE) | \
> >                        (1<<BOOKE_INTERRUPT_DTLB_MISS) | \
> >                        (1<<BOOKE_INTERRUPT_ALIGNMENT))
> >
> > Test result:
> > root@model:/media/ram# ./spe_align_e500v2 high in 0x64 out 0x64 low in
> > 0x64 out 0x64
> 
> Thanks a lot for testing and fixing this one :). I'm glad it works for
> you. I've written up a patch that does this slightly differently and also
> takes EPR into account. Could you please check whether that one works as
> well?
> 
> 
> Thanks,
> 
> Alex
> 


--
To unsubscribe from this list: send the line "unsubscribe kvm-ppc" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
diff mbox

Patch

diff --git a/arch/powerpc/kvm/booke.c b/arch/powerpc/kvm/booke.c
index d2f502d..38a62ef 100644
--- a/arch/powerpc/kvm/booke.c
+++ b/arch/powerpc/kvm/booke.c
@@ -182,6 +182,14 @@  static void kvmppc_core_queue_inst_storage(struct kvm_vcpu *vcpu,
 	kvmppc_booke_queue_irqprio(vcpu, BOOKE_IRQPRIO_INST_STORAGE);
 }
 
+static void kvmppc_core_queue_alignment(struct kvm_vcpu *vcpu, ulong dear_flags,
+					ulong esr_flags)
+{
+	vcpu->arch.queued_dear = dear_flags;
+	vcpu->arch.queued_esr = esr_flags;
+	kvmppc_booke_queue_irqprio(vcpu, BOOKE_IRQPRIO_ALIGNMENT);
+}
+
 void kvmppc_core_queue_program(struct kvm_vcpu *vcpu, ulong esr_flags)
 {
 	vcpu->arch.queued_esr = esr_flags;
@@ -971,6 +979,12 @@  int kvmppc_handle_exit(struct kvm_run *run, struct kvm_vcpu *vcpu,
 		r = RESUME_GUEST;
 		break;
 
+	case BOOKE_INTERRUPT_ALIGNMENT:
+		kvmppc_core_queue_alignment(vcpu, vcpu->arch.fault_dear,
+		                            vcpu->arch.fault_esr);
+		r = RESUME_GUEST;
+		break;
+
 #ifdef CONFIG_KVM_BOOKE_HV
 	case BOOKE_INTERRUPT_HV_SYSCALL:
 		if (!(vcpu->arch.shared->msr & MSR_PR)) {