Received: by 2002:ad5:474a:0:0:0:0:0 with SMTP id i10csp4585479imu; Fri, 30 Nov 2018 21:45:48 -0800 (PST) X-Google-Smtp-Source: AFSGD/VYwPFvkDe/Y+lfSqdsBfed74V6ZUtCPiGspHm588MOzcPT33TdD1EtJYNtcDZnU6fReBWe X-Received: by 2002:a63:580a:: with SMTP id m10mr6969066pgb.332.1543643148906; Fri, 30 Nov 2018 21:45:48 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1543643148; cv=none; d=google.com; s=arc-20160816; b=w2WZXRcrIPSnk3SNwwYaD2m4mKG+h1Gjp6PbQeFDHY/C4BqgOnbkhYUxBQwsnndEdG HyrM60hAwHQPnmNP1ZPgMyr5YgbdpKgcL+w7zL6hh+wknJoD7hu1g9/vWhc+J/6z8i4p Ug9YgE5osFa0aGiv93yY8+AV8Xa0Iiju4FrTePAepoSJQQgjMQzYrdreSyHQjj8vnY9C jBd0SQn+5sCIQRIEVUYGhnIqyCO69l1IM9UgR1L+mPL5NB3ZRydyVHTo/uKQIimcy2jP 1eRgUvbxTc07bI+Y10DgurJebohy9TB8qO70GGYU5Q87HvzHQdxm20qhMUUwKVcqAmrm ig0g== 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 :organization:references:in-reply-to:message-id:subject:cc:to:from :date; bh=lwoIak5KVYqegTare3UFr3LoUEwEHE8Eoq9kk5kXLGY=; b=HdD5P59JZQ5ccz748SnkqoSso52juRlHtWSrdA1hUqgPOFvkgEqgYgOTlrL7fUpWcs ZOIkUJJq+7AOiDFi4/fA0CYMgNxe9Kerl01oUusw39xlT8f3z5ZKznAQfxRhLVfomLvp /MJ4GunSySFbLrRdC0i2YJ4dlUWEz6TQilTH/VZXsWyCGygoR/9AZKtzfq1nKaO8eJ6b Z/kyqv63AE1Wg+TdW9xKGMtcGJRD7oOCH5MEqgftIHENpb8nZuFteLLWT/ZGvsxrhXiM T9M96gLvFdufa1GgMltjgvKT1lGX6XmJwOJ0qRiZzADtwUg2MD/BeHOnkSd7bzh086Ic QbCQ== 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; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=intel.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id b26si6887257pgl.539.2018.11.30.21.44.53; Fri, 30 Nov 2018 21:45:48 -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; 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=fail (p=NONE sp=NONE dis=NONE) header.from=intel.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726204AbeLAQyh (ORCPT + 99 others); Sat, 1 Dec 2018 11:54:37 -0500 Received: from mga05.intel.com ([192.55.52.43]:11234 "EHLO mga05.intel.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1725758AbeLAQyh (ORCPT ); Sat, 1 Dec 2018 11:54:37 -0500 X-Amp-Result: SKIPPED(no attachment in message) X-Amp-File-Uploaded: False Received: from orsmga007.jf.intel.com ([10.7.209.58]) by fmsmga105.fm.intel.com with ESMTP/TLS/DHE-RSA-AES256-GCM-SHA384; 30 Nov 2018 21:42:54 -0800 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.56,300,1539673200"; d="scan'208";a="94925306" Received: from rma4-mobl1.ccr.corp.intel.com (HELO xdu1-mobl) ([10.254.212.29]) by orsmga007.jf.intel.com with ESMTP; 30 Nov 2018 21:42:53 -0800 Date: Sat, 1 Dec 2018 13:42:51 +0800 From: "Du, Alek" To: Adrian Hunter Cc: , , Subject: Re: [PATCH] sdhci: fix the fake timeout bug Message-ID: <20181201134251.26573207@xdu1-mobl> In-Reply-To: References: <20181130150028.732896d8@xdu1-mobl> <81ba3745-8277-d16e-3aad-48324f51dc8a@intel.com> <20181130221300.4ef2956c@xdu1-mobl> Organization: Intel APAC R&D X-Mailer: Claws Mail 3.16.0 (GTK+ 2.24.32; x86_64-pc-linux-gnu) MIME-Version: 1.0 Content-Type: text/plain; charset=US-ASCII Content-Transfer-Encoding: 7bit Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Fri, 30 Nov 2018 16:40:04 +0200 Adrian Hunter wrote: > So you are saying this only happens under virtualization? > Yes, I saw the issue under ACRN virtualization Service OS (4.19 kernel). But theoretically it can happen in other case when scheduling is not that good. (due to bad driver or other high priority task) > > > > Please look at the sdhci_enable_clk() below, there is a window in > > clock stabilization check. The first check is to check status > > register, the second check is to check if time passed. That's why I > > can capture a case that after time passed, the actually clock > > control register indicated that clock is stable. So the error > > handling is wrong... > > Sure, but "Internal clock never stabilised." is not one of the > errors you listed. Sorry my bad not listing all the error log: Case 1. clock stabilization timeout: (the below clock control dump shows clock is good) [159525.255629] mmc1: Internal clock never stabilised. [159525.255818] mmc1: sdhci: ============ SDHCI REGISTER DUMP =========== [159525.256049] mmc1: sdhci: Sys addr: 0x00000000 | Version: 0x00001002 [159525.256277] mmc1: sdhci: Blk size: 0x00000000 | Blk cnt: 0x00000000 [159525.256523] mmc1: sdhci: Argument: 0x00000000 | Trn mode: 0x00000000 [159525.256752] mmc1: sdhci: Present: 0x1fff0000 | Host ctl: 0x00000000 [159525.256979] mmc1: sdhci: Power: 0x0000000b | Blk gap: 0x00000080 [159525.257205] mmc1: sdhci: Wake-up: 0x00000000 | Clock: 0x0000fa03 Case 2. Reset timeout: (the same check window in sdhci_reset()) [ 7639.968613] mmc1: Reset 0x4 never completed. Case 3. Hardware interrupt timeout [ 1049.561728] mmc1: Timeout waiting for hardware interrupt. > > > > > Also the sdhci_send_command commands is not in spin lock There is a > > windows between mod_timer and real command send... > > What code path does not have a spin lock? Ouch my bad, the sdhci_send_command are called either from spinlock or IRQ handler, so this part is good ... I'll send a new patch to cover case 1 and case 2 if you agree. Thanks, Alek