Received: by 10.223.164.221 with SMTP id h29csp2329065wrb; Thu, 2 Nov 2017 09:13:12 -0700 (PDT) X-Google-Smtp-Source: ABhQp+QP3q99TUvM8pD2JSsNbaUE9Lbh3Ati9PQjVKFWBs3E9yZuct3CaucoIHvQOqzkeK1lkYKN X-Received: by 10.84.233.66 with SMTP id k2mr3789603plt.45.1509639192452; Thu, 02 Nov 2017 09:13:12 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1509639192; cv=none; d=google.com; s=arc-20160816; b=OlVm1wkxPyzWnsJh9oj0xyoYvpbl6WOv0tTsCNMlP8JdxcvIBVOk58EVv1uJ+WdfhQ w/N3YAbD/oVew+1dUPvoYB+rHjwvR7V0i6o4BTdRdNBoQWrbWe7s0Oq3daW3PB+eKF61 3hnMU7wTwp5dvC5DqznXchfIlIR/X4KZs+xW7Qqn/VDib2hftTDxZvuqp1uYF72F0pcw OZZTgB7hwoDu6RiVxGeSyHThr9bnON7MnIwByoFb1KFm1WopSCg8lW80CvOObhFJijIg 47mS5O05knCHENqnf02Oh7rYKXkDWW+1qJWJ+VTyMxfxhmlm19aAPSdcj9m70Kem0sIA 7TjA== 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:message-id:subject:cc:to:from:date :arc-authentication-results; bh=0s21RNsYVSLgKeXUP749saZyfQPQtGG8Zkcd6tvLuEY=; b=R6QOlOR4+3KkDgRaVGgDt2KyJhjOT7yAzJptGMtD99RRqiyIzkOtyPUR8bobwFYdZs zGWEyb2fIFhXiFb5xNFcfkdL8g/B9dVUJCVR50lMwhnTr927p2bJKfHfGeF9bbKE5620 42U6CPxyv+4ydWthzVPZl2rXt23ZaIGQrme/TQXIIV5Gg8twoIXz6AzEmRSS8knTTYeD D1+y6bs+zcePbALcv1OtUxcyxUr52E2/gtufbMb45qSBcmH4F4X610g6p3vFaTBiSvb+ LpcAENLwAYuBJM/JXIiPhLg/A0mlXoS+B09yQiGmwf+MtA05P3DvRuliQg5QfcI3JZaN w/lA== 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 b35si2633654plh.621.2017.11.02.09.12.58; Thu, 02 Nov 2017 09:13:12 -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 S934102AbdKBQMR (ORCPT + 97 others); Thu, 2 Nov 2017 12:12:17 -0400 Received: from mail.free-electrons.com ([62.4.15.54]:40922 "EHLO mail.free-electrons.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S933941AbdKBQMP (ORCPT ); Thu, 2 Nov 2017 12:12:15 -0400 Received: by mail.free-electrons.com (Postfix, from userid 110) id F2A0021D67; Thu, 2 Nov 2017 17:12:13 +0100 (CET) X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on mail.free-electrons.com X-Spam-Level: X-Spam-Status: No, score=-1.0 required=5.0 tests=ALL_TRUSTED,SHORTCIRCUIT, URIBL_BLOCKED shortcircuit=ham autolearn=disabled version=3.4.0 Received: from bbrezillon (unknown [91.160.177.164]) by mail.free-electrons.com (Postfix) with ESMTPSA id 8AC06212A2; Thu, 2 Nov 2017 17:12:13 +0100 (CET) Date: Thu, 2 Nov 2017 17:12:13 +0100 From: Boris Brezillon To: Baruch Siach Cc: Marc Gonzalez , Mark Rutland , Alan Cox , Russell King , Jonathan Austin , Arnd Bergmann , Mason , Peter Zijlstra , Will Deacon , Michael Turquette , Nicolas Pitre , Stephen Boyd , LKML , Steven Rostedt , Douglas Anderson , Kevin Hilman , John Stultz , linux-mtd@lists.infradead.org, Thomas Gleixner , Linus Torvalds , Ingo Molnar , Linux ARM Subject: Re: [RFC] Improving udelay/ndelay on platforms where that is possible Message-ID: <20171102171213.6449268c@bbrezillon> In-Reply-To: <20171101194822.hd76z7zjazlqbsmy@tarshish> References: <20171101175325.2557ce85@alans-desktop> <4b707ce0-6067-ab36-e167-1acf348d26bf@free.fr> <20171101194822.hd76z7zjazlqbsmy@tarshish> X-Mailer: Claws Mail 3.14.1 (GTK+ 2.24.31; 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 Wed, 1 Nov 2017 21:48:22 +0200 Baruch Siach wrote: > Hi Marc, > > On Wed, Nov 01, 2017 at 08:03:20PM +0100, Marc Gonzalez wrote: > > On 01/11/2017 18:53, Alan Cox wrote: > > > For that matter given the bad blocks don't randomly change why not cache > > > them ? > > > > That's a good question, I'll ask the NAND framework maintainer. > > Store them where, by the way? On the NAND chip itself? > > Yes. In the bad block table (bbt). See drivers/mtd/nand/nand_bbt.c. Yes, you can cache this information in a bad block table stored on the flash. But still, the ndelay()/udelay() problem remains: reading the out-of-band area of each eraseblock to re-create the bad block table is just one use case. This ndelay() is something you can have on all kind of read/write operations. As Thomas Gleixner stated, this is not really needed on modern NAND controllers which take care of various timing constraints internally, but still, we have some controllers that are not that smart, and we have to support them. I'm not concerned about performances here, and if I'm told that we should turn all ndelay() calls into usleep_range() ones, then I'm perfectly fine with that, but I need a guarantee that when I say "I want to wait at least X ns/us", the function does not return before that time has expired. Not sure if that would work, but maybe we could create a wrapper like void nand_ndelay(unsigned long nanoseconds) { ktime_t end = ktime_add_ns(ktime_get(), nanoseconds); do { ndelay(nanoseconds); } while (ktime_before(ktime_get(), end)); } From 1582897135854030906@xxx Wed Nov 01 20:32:23 +0000 2017 X-GM-THRID: 1582790467810046578 X-Gmail-Labels: Inbox,Category Forums