Received: by 2002:a25:8b91:0:0:0:0:0 with SMTP id j17csp1414726ybl; Wed, 18 Dec 2019 18:41:29 -0800 (PST) X-Google-Smtp-Source: APXvYqzT6W8mJuu5SDDTsidBivD05tgGMIFmNfChhqbzOVN9p0vUj/zO0zHtIxHuILMIyB3NLbIs X-Received: by 2002:a9d:51c1:: with SMTP id d1mr5872368oth.136.1576723289230; Wed, 18 Dec 2019 18:41:29 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1576723289; cv=none; d=google.com; s=arc-20160816; b=rw5Fxq/eYtRiRrDzlEpHoMXcrwLliLSUAJWh6mreJr6ZG3tm6DZJYWYHSCSOumdzsQ 2m5EMT7h0NLSCNQB5UNcm5AwutudZPTXoC9hpdIH8NMJuKQpsnN4lgdVLhwzil/LQhJc zbJyB6DiDk/Q8wZbVdPRr6AAtF69NEUKGZ5iXx4VmHr8HQ7WOaRwj6ER8J7rp4q+0NcA 04rtc/bvZ22VTvkH4vggX+O1Jq+u7NO2n1m/hUZ6WtK49llH/LjZlQEzuN0zrzq77ih2 ONkTd3JFVr4KcfMMpF0+WU/XZhhXpASpGs7FhBRfP5wmEcb0kxtsGCLldNNsurLyV/ZV j6sg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:content-language :content-transfer-encoding:in-reply-to:mime-version:user-agent:date :message-id:from:references:cc:to:subject:dkim-signature; bh=0RBVyIP0Ujh+br/1IluUkRXVcIUAcx75iz4VOyZAsEM=; b=RalpI3i6YF2c/dwTaE1OvdBRczkFZi9dgkeu0Y5efyzfTGlsKF12kuNj4aiR1C1k1p IduYlhWj/4LsuL7Ccr/0JW3Cd+oovcc4C56EQfr1Bs38BHp9VHuqWyv3Qedjuka0DOiC UtRuBK414NcdTQAI/Dx0H5LUbKxqvesOe0uT5TcnklOKs7/LG1TPBLrAT17ld47WeeC0 T9xujJH11ZqXqesd5lWlQE8bATEAKE1h0RAlbg/YrmGqrJJQxoQbUBn29A1hG/3ulwl5 nTbFOl/xl775xWuq0/mQkPsaJiIDIskbK6t01Gx5ZIJUXjd5hPrRsZuKfSx9xJR7a2kH mrmw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@gmail.com header.s=20161025 header.b=KwMQp5jY; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id y186si2383539oig.241.2019.12.18.18.41.17; Wed, 18 Dec 2019 18:41:29 -0800 (PST) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; dkim=pass header.i=@gmail.com header.s=20161025 header.b=KwMQp5jY; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726858AbfLSCkk (ORCPT + 99 others); Wed, 18 Dec 2019 21:40:40 -0500 Received: from mail-pj1-f66.google.com ([209.85.216.66]:34006 "EHLO mail-pj1-f66.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726463AbfLSCkk (ORCPT ); Wed, 18 Dec 2019 21:40:40 -0500 Received: by mail-pj1-f66.google.com with SMTP id s94so1961194pjc.1; Wed, 18 Dec 2019 18:40:39 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=subject:to:cc:references:from:message-id:date:user-agent :mime-version:in-reply-to:content-transfer-encoding:content-language; bh=0RBVyIP0Ujh+br/1IluUkRXVcIUAcx75iz4VOyZAsEM=; b=KwMQp5jYrub3Gax4KKL+SGhnfNHi2oLQhwCHetSJud5dK4mBgnW1PqRgZkCWmpkFSJ 6gNmVp69VlJatXBvlFUGKlTBB/qRfjIQb7nZS/GiN73f5crkOI4J43oAc76n7qsMAP4Q UF2wzSUECYKOHRPzV0uRMRtDXFGjTXuOaeTTTXCGwv0+nAuT9cRYexHPhDzLC/rOzKVQ R9xG3yUS/9gLRVdWICBjdbwIoODiPWZnJ6HjggRCa6dzrkyExth/LO9FWBin8yfdKKPy YDuwoXeZQfnylEEz22ECPYVp7KyKdycGX2EF62IApfpIGaWlZqpQaGIxhOHAAe/b4l7J WTcw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:subject:to:cc:references:from:message-id:date :user-agent:mime-version:in-reply-to:content-transfer-encoding :content-language; bh=0RBVyIP0Ujh+br/1IluUkRXVcIUAcx75iz4VOyZAsEM=; b=UkvtdWRckLeWtpwN9jnLQhhRfo5J8JPlCt+AIo0xGMFsPf5e4pNxf34/92wl8aBLB4 vZFQqy074HcPMcpEAYYntEeY5YFHAnJdpev0IBwYJRo0MNiVQcNSVxmgwf+04XGYKCJD +0rGwIeRilxugepvfLXnIylrBC0lE0TQn7u6OL6Elhw/Y8D3xh1+dghMsAikpmUrEtcy 0OfSMIcXuWbR8JgnK0n+f7ICMnsmmVjAw/FAaRIeJmdgwXqOe/Q8x6ydG4kJUoPrylxX jym5zBm1o0Fayj+D1SRhhPc+TTNkd+vaq94kU8mgnZCnTPgNtbvbiqtCbIuxDBraUqnc N2hg== X-Gm-Message-State: APjAAAUJcLN8oABnVl07/39qfG/GZYMGj9V4ZUdsRPx494rFrRPQ3yvv yF2RdF4B2pCVrGSLSonr/yhxeeWEO+c4Vw== X-Received: by 2002:a17:90a:20c4:: with SMTP id f62mr6940929pjg.70.1576723239163; Wed, 18 Dec 2019 18:40:39 -0800 (PST) Received: from ?IPv6:2402:f000:1:1501:200:5efe:166.111.139.116? ([2402:f000:1:1501:200:5efe:a66f:8b74]) by smtp.gmail.com with ESMTPSA id d13sm4321448pjx.21.2019.12.18.18.40.36 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Wed, 18 Dec 2019 18:40:38 -0800 (PST) Subject: Re: [PATCH] net: amd: xgbe: fix possible sleep-in-atomic-context bugs in xgbe_powerdown() To: David Miller Cc: thomas.lendacky@amd.com, netdev@vger.kernel.org, linux-kernel@vger.kernel.org References: <20191218140102.11579-1-baijiaju1990@gmail.com> <20191218.132601.160360469201947283.davem@davemloft.net> From: Jia-Ju Bai Message-ID: <62131c40-e69b-0664-2b2a-177a031a6f1f@gmail.com> Date: Thu, 19 Dec 2019 10:40:39 +0800 User-Agent: Mozilla/5.0 (Windows NT 10.0; WOW64; rv:60.0) Gecko/20100101 Thunderbird/60.9.1 MIME-Version: 1.0 In-Reply-To: <20191218.132601.160360469201947283.davem@davemloft.net> Content-Type: text/plain; charset=utf-8; format=flowed Content-Transfer-Encoding: 7bit Content-Language: en-US Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On 2019/12/19 5:26, David Miller wrote: > From: Jia-Ju Bai > Date: Wed, 18 Dec 2019 22:01:02 +0800 > >> @@ -1257,17 +1257,18 @@ int xgbe_powerdown(struct net_device *netdev, unsigned int caller) >> netif_tx_stop_all_queues(netdev); >> >> xgbe_stop_timers(pdata); >> - flush_workqueue(pdata->dev_workqueue); >> >> hw_if->powerdown_tx(pdata); >> hw_if->powerdown_rx(pdata); >> >> - xgbe_napi_disable(pdata, 0); >> - >> pdata->power_down = 1; >> >> spin_unlock_irqrestore(&pdata->lock, flags); >> >> + flush_workqueue(pdata->dev_workqueue); >> + >> + xgbe_napi_disable(pdata, 0); >> + > Nope, this doesn't work at all. > > You can't leave NAPI enabled, and thus packet processing, after the TX > and RX units of the chip have been powered down. Looking at the code, only xgbe_powerup() and xgbe_powerdown() use the spinlock "pdata->lock". How about change the spinlock to a mutex? Best wishes, Jia-Ju Bai