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
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <20140722221606.GA16444@electric-eye.fr.zoreil.com>
Date:	Wed, 23 Jul 2014 00:16:06 +0200
From:	Francois Romieu <romieu@...zoreil.com>
To:	Sonic Zhang <sonic.adi@...il.com>
Cc:	"David S. Miller" <davem@...emloft.net>, netdev@...r.kernel.org,
	adi-buildroot-devel@...ts.sourceforge.net,
	Sonic Zhang <sonic.zhang@...log.com>,
	Eric Dumazet <eric.dumazet@...il.com>,
	David Laight <David.Laight@...lab.com>
Subject: Re: [PATCH v7] bfin_mac: convert bfin Ethernet driver to NAPI
 framework

Sonic Zhang <sonic.adi@...il.com> :
[...]
> diff --git a/drivers/net/ethernet/adi/bfin_mac.c b/drivers/net/ethernet/adi/bfin_mac.c
> index 7ae74d4..8924802 100644
> --- a/drivers/net/ethernet/adi/bfin_mac.c
> +++ b/drivers/net/ethernet/adi/bfin_mac.c
[...]
> @@ -1302,41 +1303,53 @@ out:
>  	current_rx_ptr = current_rx_ptr->next;
>  }
>  
> +static int bfin_mac_poll(struct napi_struct *napi, int budget)
> +{
> +	int i = 0;
> +	struct bfin_mac_local *lp = container_of(napi,
> +						 struct bfin_mac_local,
> +						 napi);
> +
> +	while (current_rx_ptr->status.status_word != 0 && i < budget) {
> +		bfin_mac_rx(lp, budget);
> +		i++;
> +	}
> +
> +	if (i < budget) {
> +		napi_complete(napi);
> +		if (lp->rx_irq_disabled--)
> +			if (!lp->rx_irq_disabled)
> +				enable_irq(IRQ_MAC_RX);
> +	}
[...]
>  static irqreturn_t bfin_mac_interrupt(int irq, void *dev_id)
>  {
> +	struct bfin_mac_local *lp = netdev_priv(dev_id);
> +	u32 status;
> +
> +	status = bfin_read_DMA1_IRQ_STATUS();
> +
> +	bfin_write_DMA1_IRQ_STATUS(status | DMA_DONE | DMA_ERR);
> +	if ((status & DMA_DONE) && napi_schedule_prep(&lp->napi)) {
> +		if (!lp->rx_irq_disabled++)
> +			disable_irq_nosync(IRQ_MAC_RX);
> +		__napi_schedule(&lp->napi);

If netpoll scavenges between napi_schedule_prep and lp->rx_irq_disabled++
on a different CPU, bfin_mac_interrupt may later __napi_schedule while
already napi_completed in netpoll...bfin_mac_poll(): bfin_mac_poll won't
be run in net_rx_action and IRQ_MAC_RX will stay disabled.

I don't know if something on the blackfin arch prevents the window to
widen and makes it moot.

As the bfin_mac driver requests the single non shared IRQ_MAC_RX irq,
couldn't we instead:

static irqreturn_t bfin_mac_interrupt(int irq, void *dev_id)
[...]
	if (status & DMA_DONE) {
		disable_irq_nosync(IRQ_MAC_RX);
		/* Code won't return here until a scheduled poll enables irq. */
		set_bit(BFIN_IRQ_DISABLED, &lp->flags);
		napi_schedule(&lp->napi);
	}

static int bfin_mac_poll(struct napi_struct *napi, int budget)
[...]
	if (i < budget) {
		napi_complete(napi);
		if (test_and_clear_bit(BFIN_IRQ_DISABLED, &lp->flags))
			enable_irq(IRQ_MAC_RX);
	}

Comments ?

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

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ