Re: [bug report] amd-xgbe: Initial AMD 10GbE platform driver

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

 



Hi,

On 1/23/2024 15:25, Dan Carpenter wrote:
> Hello Lendacky, Thomas,
> 
> The patch c5aa9e3b8156: "amd-xgbe: Initial AMD 10GbE platform driver"
> from Jun 5, 2014 (linux-next), leads to the following Smatch static
> checker warning:
> 
> 	drivers/net/ethernet/amd/xgbe/xgbe-drv.c:1209 xgbe_powerdown()
> 	warn: sleeping in atomic context
> 
> drivers/net/ethernet/amd/xgbe/xgbe-drv.c
>     1181 int xgbe_powerdown(struct net_device *netdev, unsigned int caller)
>     1182 {
>     1183         struct xgbe_prv_data *pdata = netdev_priv(netdev);
>     1184         struct xgbe_hw_if *hw_if = &pdata->hw_if;
>     1185         unsigned long flags;
>     1186 
>     1187         DBGPR("-->xgbe_powerdown\n");
>     1188 
>     1189         if (!netif_running(netdev) ||
>     1190             (caller == XGMAC_IOCTL_CONTEXT && pdata->power_down)) {
>     1191                 netdev_alert(netdev, "Device is already powered down\n");
>     1192                 DBGPR("<--xgbe_powerdown\n");
>     1193                 return -EINVAL;
>     1194         }
>     1195 
>     1196         spin_lock_irqsave(&pdata->lock, flags);
>                  ^^^^^^^^^^^^^^^^^
> Preempt disabled.
> 
>     1197 
>     1198         if (caller == XGMAC_DRIVER_CONTEXT)
>     1199                 netif_device_detach(netdev);
>     1200 
>     1201         netif_tx_stop_all_queues(netdev);
>     1202 
>     1203         xgbe_stop_timers(pdata);
>     1204         flush_workqueue(pdata->dev_workqueue);
>     1205 
>     1206         hw_if->powerdown_tx(pdata);
>     1207         hw_if->powerdown_rx(pdata);
>     1208 
> --> 1209         xgbe_napi_disable(pdata, 0);
> 
> This warning is correct, but it only showed up because I messed up my
> devel version of Smatch last night to make it assume that we almost
> always enter into loops at least one time.
> 
> The napi_disable() function cannot be called while holding a spinlock.
> 
> You would need to enable DEBUG_ATOMIC_SLEEP to see these warnings at
> runtime.

Thanks for the bug report Dan. Shall send a patch to address this.

Thanks,
Shyam

> 
>     1210 
>     1211         pdata->power_down = 1;
>     1212 
>     1213         spin_unlock_irqrestore(&pdata->lock, flags);
>     1214 
>     1215         DBGPR("<--xgbe_powerdown\n");
>     1216 
>     1217         return 0;
>     1218 }
> 
> regards,
> dan carpenter




[Index of Archives]     [Kernel Development]     [Kernel Announce]     [Kernel Newbies]     [Linux Networking Development]     [Share Photos]     [IDE]     [Security]     [Git]     [Netfilter]     [Yosemite News]     [MIPS Linux]     [ARM Linux]     [Device Mapper]

  Powered by Linux