Received: by 10.192.165.156 with SMTP id m28csp1501646imm; Wed, 18 Apr 2018 10:37:20 -0700 (PDT) X-Google-Smtp-Source: AIpwx4+h1eq1oFhjwvabNatKEwhkmIVWloyQozQiUqPOduMsGy1DAoknr7ExkGliCfVf9pQM3loz X-Received: by 10.101.71.193 with SMTP id f1mr2510506pgs.216.1524073040378; Wed, 18 Apr 2018 10:37:20 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1524073040; cv=none; d=google.com; s=arc-20160816; b=WRnu7cTQsZxrVRo8S0aSPNrwkPIwLFHUhLXMIRzs+Fl3yQVcw4BdkZ28ehVFPAVpG+ rXbc6T8o7UuVIU6AZl/naQxv0ErLPGGJIKBX0cFyBmXV3NDIjTx0V7G0HggIqwRC+fG5 LCmsT3kPEAD1+XLHZxMwi5DjMQDEb7V2iozbSgMZ4eEBK5QMfRg7vM4S4n2an+cffeIc QFA+RSkPWNpCdKcFNBM2aX1OfcUVivKG6sGknbVkSz4SRUZO9UNvgTckfs4hWQGcKxui BNk9+P/G6X1AGjEIji3osOx+Fyi17rbUwGTHlRczb09PTG0vsQnSQ1a/WazeE9FbbI2x ghpg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:content-transfer-encoding:mime-version :references:in-reply-to:from:subject:cc:to:message-id:date :arc-authentication-results; bh=5AfPHLPcJBh1AQYDpMzgMHqF+f+31Xc30XDeZqAWEfE=; b=oYlMl1U34xBpENaU+pjv/PMvarc6tO8tirYUEtd6ILQ6NcHV32hhBJ7yhKXjJXoTI4 S4f7CSfpfkPUPlYg07Ew7qE/DriLAvAxhPiOAvJIKX4WS27IOgmsfXQ/Sqr5HApCRajh YUGXki2hW3RWR+Mxis0fgYB0KrqBNLexFsL884fSOvBTEThINLOCIUjJLA9rMWuJiaa2 eI49ZyGZ3PthDdvilsDSscbAg4JZLlkeYF1mQVz02VmBliiEcz6nqs/FQGLRHhIuM0rY haFRLhPxd/T4zF5P5og0cp5ANlHA4VYm73RGIz305KZyPY0QMOxFS1vLGSppQr6MVnUm u3Mw== ARC-Authentication-Results: i=1; mx.google.com; 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 Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id t10si1456260pgr.548.2018.04.18.10.37.04; Wed, 18 Apr 2018 10:37:20 -0700 (PDT) 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; 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 Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1752532AbeDRRfm (ORCPT + 99 others); Wed, 18 Apr 2018 13:35:42 -0400 Received: from shards.monkeyblade.net ([184.105.139.130]:45894 "EHLO shards.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1752280AbeDRRfk (ORCPT ); Wed, 18 Apr 2018 13:35:40 -0400 Received: from localhost (67.110.78.66.ptr.us.xo.net [67.110.78.66]) (using TLSv1 with cipher AES256-SHA (256/256 bits)) (Client did not present a certificate) (Authenticated sender: davem-davemloft) by shards.monkeyblade.net (Postfix) with ESMTPSA id 520A114386338; Wed, 18 Apr 2018 10:35:40 -0700 (PDT) Date: Wed, 18 Apr 2018 13:35:39 -0400 (EDT) Message-Id: <20180418.133539.1514284482902646647.davem@davemloft.net> To: liuxiang_1999@126.com Cc: liu.xiang6@zte.com.cn, netdev@vger.kernel.org, linux-kernel@vger.kernel.org Subject: Re: [PATCH v3] net: davicom: dm9000: Avoid spinlock recursion during dm9000_timeout routine From: David Miller In-Reply-To: <72770aae.bb31.162d9036874.Coremail.liuxiang_1999@126.com> References: <1523695834-6261-1-git-send-email-liu.xiang6@zte.com.cn> <20180416.110501.92472500114183248.davem@davemloft.net> <72770aae.bb31.162d9036874.Coremail.liuxiang_1999@126.com> X-Mailer: Mew version 6.7 on Emacs 25.3 / Mule 6.0 (HANACHIRUSATO) Mime-Version: 1.0 Content-Type: Text/Plain; charset=us-ascii Content-Transfer-Encoding: 7bit X-Greylist: Sender succeeded SMTP AUTH, not delayed by milter-greylist-4.5.12 (shards.monkeyblade.net [149.20.54.216]); Wed, 18 Apr 2018 10:35:40 -0700 (PDT) Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org From: liuxiang Date: Wed, 18 Apr 2018 21:48:22 +0800 (CST) > Because the timeout task gets the main spinlock and disable the > current cpu's irq, there is no other task on the same cpu can run, > and tasks on the other cpus can not enter the dm9000_timeout() > again. So in the whole dm9000_timeout() routine, db->timeout_cpu can > not be changed by other tasks. Although smp_processor_id() may > change after preempt_enable(), these tasks always get the false > result when call dm9000_current_in_timeout. Only the timeout task > get the true result. And if there is no timeout, all the tasks that > want to do asynchronous phy operation get the false result. So I > think this can avoid racy. This is a very shaky foundation upon which to base the correctness of your driver's synchronization in my opinion.