RE: [PATCH] hyperv: Add netpoll support
From: KY Srinivasan
Date: Tue Jul 08 2014 - 16:04:00 EST
> -----Original Message-----
> From: Richard Weinberger [mailto:richard@xxxxxx]
> Sent: Tuesday, July 8, 2014 11:39 AM
> To: KY Srinivasan; Haiyang Zhang
> Cc: devel@xxxxxxxxxxxxxxxxxxxxxx; netdev@xxxxxxxxxxxxxxx; linux-
> kernel@xxxxxxxxxxxxxxx
> Subject: Re: [PATCH] hyperv: Add netpoll support
>
> Am 08.07.2014 20:01, schrieb KY Srinivasan:
> >
> >
> >> -----Original Message-----
> >> From: Richard Weinberger [mailto:richard@xxxxxx]
> >> Sent: Tuesday, July 8, 2014 2:32 AM
> >> To: KY Srinivasan; Haiyang Zhang
> >> Cc: devel@xxxxxxxxxxxxxxxxxxxxxx; netdev@xxxxxxxxxxxxxxx; linux-
> >> kernel@xxxxxxxxxxxxxxx; Richard Weinberger
> >> Subject: [PATCH] hyperv: Add netpoll support
> >>
> >> In order to have at least a netconsole to debug kernel issues on
> >> Windows Azure this patch implements netpoll support.
> >> Sending packets is easy, netvsc_start_xmit() does already everything
> >> needed.
> >> To receive we need to trigger the channel callback which is usally
> >> called via tasklet_schedule().
> >>
> >> Signed-off-by: Richard Weinberger <richard@xxxxxx>
> >> ---
> >> drivers/net/hyperv/netvsc_drv.c | 14 ++++++++++++++
> >> 1 file changed, 14 insertions(+)
> >>
> >> diff --git a/drivers/net/hyperv/netvsc_drv.c
> >> b/drivers/net/hyperv/netvsc_drv.c index 4fd71b7..367b71e 100644
> >> --- a/drivers/net/hyperv/netvsc_drv.c
> >> +++ b/drivers/net/hyperv/netvsc_drv.c
> >> @@ -736,6 +736,17 @@ static int netvsc_set_mac_addr(struct net_device
> >> *ndev, void *p)
> >> return err;
> >> }
> >>
> >> +#ifdef CONFIG_NET_POLL_CONTROLLER
> >> +static void netvsc_poll_controller(struct net_device *net) {
> >> + struct net_device_context *net_device_ctx = netdev_priv(net);
> >> + struct hv_device *dev = net_device_ctx->device_ctx;
> >> +
> >> + local_bh_disable();
> >> + netvsc_channel_cb(dev->channel);
> >> + local_bh_enable();
> >> +}
> >> +#endif
> >
> > Each channel is bound to a specific VCPU in the guest and the channel
> > callback is expected to be delivered on the VCPU the channel is bound to.
> This code is not satisfying that requirement.
>
> But struct hv_device has only one channel attribute. How does this work with
> multiple VCPUs?
>
> Anyways, what solution to you propose?
The VCPU the channel is bound to is available in the channel state. You could use the following code
Fragment to ensure that the call is made on the "right" cpu:
smp_call_function_single(dev->channel->target_cpu,
netvsc_channel_cb, dev->channel, true);
Hope this helps.
K. Y
--
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/