RE: [PANIC, hyperv] BUG: unable to handle kernel paging request at ffff880077800004 (hv_ringbuffer_write)

From: KY Srinivasan
Date: Wed Aug 27 2014 - 14:46:04 EST




> -----Original Message-----
> From: Sitsofe Wheeler [mailto:sitsofe@xxxxxxxxx]
> Sent: Wednesday, August 27, 2014 9:19 AM
> To: Dexuan Cui
> Cc: KY Srinivasan; Greg Kroah-Hartman; Haiyang Zhang;
> devel@xxxxxxxxxxxxxxxxxxxxxx; linux-kernel@xxxxxxxxxxxxxxx
> Subject: Re: [PANIC, hyperv] BUG: unable to handle kernel paging request at
> ffff880077800004 (hv_ringbuffer_write)
>
> On Wed, Aug 27, 2014 at 02:14:02PM +0000, Dexuan Cui wrote:
> > > -----Original Message-----
> > > From: Sitsofe Wheeler
> > > Sent: Wednesday, August 27, 2014 20:16 PM
> >
> > > > I'm making a patch for this.
> > Please see the end of the mail for the inline patch and try it.
> > (the patch hasn't been rebased against KY's patchset)
>
> <snip>
>
> > BTW, with the patch below, hyperv_fb can work now, BUT,
> > *occasionally*,
> > storvsc_probe() -> ... -> vmbus_open() -> can fail due to
> > HV_STATUS_INVALID_ALIGNMENT...
>
> I applied your new patch on top of KY's pieces (it applied cleanly) and while it
> doesn't blow up, one warning is printed out and the UP boot seemed to stall
> after input: TPPS/2 message (but pressing ctrl-alt-delete allows the system to
> reboot cleanly).

First let me thank you guys for looking into this issue. Looking at your dmesg, it looked like storvsc probe failed as Dexuan had seen. Since the failure appears to be alignment related, perhaps we could test with allocating a page all the time (and getting rid of the kmalloc). Sitsofe, here is a patch based on Dexuan's patch. If this works, I will probably minimize failure cases by pre-allocating per-cpu pages for this.:

diff --git a/drivers/hv/hv.c b/drivers/hv/hv.c
index edfc848..0ca0cba 100644
--- a/drivers/hv/hv.c
+++ b/drivers/hv/hv.c
@@ -217,25 +217,17 @@ int hv_post_message(union hv_connection_id connection_id,
enum hv_message_type message_type,
void *payload, size_t payload_size)
{
- struct aligned_input {
- u64 alignment8;
- struct hv_input_post_message msg;
- };

struct hv_input_post_message *aligned_msg;
u16 status;
- unsigned long addr;

if (payload_size > HV_MESSAGE_PAYLOAD_BYTE_COUNT)
return -EMSGSIZE;

- addr = (unsigned long)kmalloc(sizeof(struct aligned_input), GFP_ATOMIC);
- if (!addr)
+ aligned_msg = (struct hv_input_post_message *)get_zeroed_page(GFP_ATOMIC);
+ if (!aligned_msg)
return -ENOMEM;

- aligned_msg = (struct hv_input_post_message *)
- (ALIGN(addr, HV_HYPERCALL_PARAM_ALIGN));
-
aligned_msg->connectionid = connection_id;
aligned_msg->message_type = message_type;
aligned_msg->payload_size = payload_size;
@@ -244,7 +236,7 @@ int hv_post_message(union hv_connection_id connection_id,
status = do_hypercall(HVCALL_POST_MESSAGE, aligned_msg, NULL)
& 0xFFFF;

- kfree((void *)addr);
+ free_page((unsigned long)aligned_msg);

return status;
}
--
1.7.4.1

--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/