lists.openwall.net | lists / announce owl-users owl-dev john-users john-dev passwdqc-users yescrypt popa3d-users / oss-security kernel-hardening musl sabotage tlsify passwords / crypt-dev xvendor / Bugtraq Full-Disclosure linux-kernel linux-netdev linux-ext4 linux-hardening linux-cve-announce PHC | |
Open Source and information security mailing list archives
| ||
|
Message-ID: <20190328124205.42f5f337@shemminger-XPS-13-9360> Date: Thu, 28 Mar 2019 12:42:05 -0700 From: Stephen Hemminger <stephen@...workplumber.org> To: Haiyang Zhang <haiyangz@...rosoft.com> Cc: Haiyang Zhang <haiyangz@...uxonhyperv.com>, "sashal@...nel.org" <sashal@...nel.org>, "linux-hyperv@...r.kernel.org" <linux-hyperv@...r.kernel.org>, KY Srinivasan <kys@...rosoft.com>, Stephen Hemminger <sthemmin@...rosoft.com>, "olaf@...fle.de" <olaf@...fle.de>, vkuznets <vkuznets@...hat.com>, "davem@...emloft.net" <davem@...emloft.net>, "netdev@...r.kernel.org" <netdev@...r.kernel.org>, "linux-kernel@...r.kernel.org" <linux-kernel@...r.kernel.org> Subject: Re: [PATCH hyperv-fixes] hv_netvsc: Fix unwanted wakeup after tx_disable On Thu, 28 Mar 2019 19:00:18 +0000 Haiyang Zhang <haiyangz@...rosoft.com> wrote: > > -----Original Message----- > > From: Stephen Hemminger <stephen@...workplumber.org> > > Sent: Thursday, March 28, 2019 2:38 PM > > To: Haiyang Zhang <haiyangz@...uxonhyperv.com> > > Cc: sashal@...nel.org; linux-hyperv@...r.kernel.org; Haiyang Zhang > > <haiyangz@...rosoft.com>; KY Srinivasan <kys@...rosoft.com>; Stephen > > Hemminger <sthemmin@...rosoft.com>; olaf@...fle.de; vkuznets > > <vkuznets@...hat.com>; davem@...emloft.net; netdev@...r.kernel.org; > > linux-kernel@...r.kernel.org > > Subject: Re: [PATCH hyperv-fixes] hv_netvsc: Fix unwanted wakeup after > > tx_disable > > > > On Thu, 28 Mar 2019 17:48:45 +0000 > > Haiyang Zhang <haiyangz@...uxonhyperv.com> wrote: > > > > > +static inline void netvsc_tx_enable(struct netvsc_device *nvscdev, > > > + struct net_device *ndev) > > > +{ > > > + nvscdev->tx_disable = false; > > > + mb(); /* ensure queue wake up mechanism is on */ > > > + > > > + netif_tx_wake_all_queues(ndev); > > > +} > > > > You don't need a full mb(). virt_wmb() should be sufficient. > > I will make this change. > > > Could I suggest an alternative approach. > > You don't need to introduce a local tx_disable flag, the only place where a > > wakeup could cause problems is after a send_completion was processed > > during detach state. > > > > Instead, just avoid wakeup in that place. > > In netvsc_detach(), after netif_tx_disable(), we call netvsc_wait_until_empty(nvdev); > TX patch should not be waken up again while waiting for in/out ring to becomes empty. > > In my tests before this patch, there are wakeup happens before netif_device_detach(), > so netif_device_present(ndev) is still true at that time. > > In other places, like netvsc_close(), link_change(), we also don't want wakeup after tx_disable. > > Thanks. > - Haiyang > > > > > --- a/drivers/net/hyperv/netvsc.c > > +++ b/drivers/net/hyperv/netvsc.c > > @@ -720,6 +720,7 @@ static void netvsc_send_tx_complete(struct > > net_device *ndev, > > struct netdev_queue *txq = netdev_get_tx_queue(ndev, q_idx); > > > > if (netif_tx_queue_stopped(txq) && > > + netif_device_present(ndev) && > > (hv_get_avail_to_write_percent(&channel->outbound) > > > RING_AVAIL_PERCENT_HIWATER || queue_sends < 1)) { > > netif_tx_wake_queue(txq); Then what about doing netif_detach earlier in netvsc_detach. The state management is already (too) complex in netvsc and adding another boolean flag just makes it harder to understand.
Powered by blists - more mailing lists