Re: [PATCH 5/8] KVM: PPC: Be more informative on BUG

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On 19.04.2010, at 03:01, Jim Paris wrote:

> Alexander Graf wrote:
>> We have a condition in the ppc64 host mmu code that should never occur.
>> Unfortunately, it just did happen to me and I was rather puzzled on why,
>> because BUG_ON doesn't tell me anything useful.
>> 
>> So let's add some more debug output in case this goes wrong. Also change
>> BUG to WARN, since I don't want to reboot every time I mess something up.
>> 
>> Signed-off-by: Alexander Graf <agraf@xxxxxxx>
>> ---
>> arch/powerpc/kvm/book3s_64_mmu_host.c |    9 +++++++--
>> 1 files changed, 7 insertions(+), 2 deletions(-)
>> 
>> diff --git a/arch/powerpc/kvm/book3s_64_mmu_host.c b/arch/powerpc/kvm/book3s_64_mmu_host.c
>> index 41af12f..5bf91a7 100644
>> --- a/arch/powerpc/kvm/book3s_64_mmu_host.c
>> +++ b/arch/powerpc/kvm/book3s_64_mmu_host.c
>> @@ -231,10 +231,15 @@ int kvmppc_mmu_map_page(struct kvm_vcpu *vcpu, struct kvmppc_pte *orig_pte)
>> 	vcpu->arch.mmu.esid_to_vsid(vcpu, orig_pte->eaddr >> SID_SHIFT, &vsid);
>> 	map = find_sid_vsid(vcpu, vsid);
>> 	if (!map) {
>> -		kvmppc_mmu_map_segment(vcpu, orig_pte->eaddr);
>> +		ret = kvmppc_mmu_map_segment(vcpu, orig_pte->eaddr);
>> +		WARN_ON(ret < 0);
>> 		map = find_sid_vsid(vcpu, vsid);
>> 	}
>> -	BUG_ON(!map);
>> +	if (!map) {
>> +		printk(KERN_ERR "KVM: Segment map for 0x%llx (0x%lx) failed\n",
>> +				vsid, orig_pte->eaddr);
>> +		WARN();
> 
> Return here, otherwise dereferencing map in the next line will crash anyway...

Very true. In fact, I certainly remember me putting a return and a WARN_ON(true) because WARN() gave me a warning here. I wonder where that code went ... hrm ...
Either way, thanks for looking over this patch!


Alex

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

[Index of Archives]     [KVM ARM]     [KVM ia64]     [KVM ppc]     [Virtualization Tools]     [Spice Development]     [Libvirt]     [Libvirt Users]     [Linux USB Devel]     [Linux Audio Users]     [Yosemite Questions]     [Linux Kernel]     [Linux SCSI]     [XFree86]
  Powered by Linux