Received: by 2002:ac0:8c9a:0:0:0:0:0 with SMTP id r26csp2500659ima; Sun, 3 Feb 2019 00:37:32 -0800 (PST) X-Google-Smtp-Source: ALg8bN7xI0ErcJHZaaGkrBvjck7oawTrJJfzjI1Od0mAQ0eIRxvu3VzufXZ+A5nJ8pYxeKFKUEzz X-Received: by 2002:a62:cf84:: with SMTP id b126mr45980225pfg.98.1549183052612; Sun, 03 Feb 2019 00:37:32 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1549183052; cv=none; d=google.com; s=arc-20160816; b=FJ94m8en7BflSvvl+1ltJ8T0rJXncs5kRiZYzOd0ejjNRoXAfcEYponCaoC+Z8xRV9 vmLM9dZWsVTnl11LFPS4FeWTIqrRJKbu0KGAN426NvMpTskudTuud2EcK6pcpewhIf74 oVbHxPeXZXFRuffj5q7pqDrw5SJUkc+5qqdUvPbespU5i/+fYGJsUr8Rx0XnJowUXlYj peLqrTdJEAwfnIxhscRVqhEcuc/DdZESB+UuCFYeHh+2HUePkGUgGU4q6ffz4bJc78cN E4uMD2dtdqQlL3K7KEYYg9tyIcJj5NVs2l3Mz0YDCWo0jkLkrB8OysOJnU3fl2JKKRx4 TcMw== 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 :dkim-signature; bh=qn5vxilFwAf/KIfhnI4ZZTl8YIyw7+PdOEujlbgWzcY=; b=mx8jETbI5qAWesmKmv17WsjGOR/bDztl9cUAfDXUunNB/1Eey2Acb/07NDAKlwGIuG YYA3IlUo+XLK0Koll4dD62grxaqkWuKLQi0m+QK7oTLxFSdFC82XhtM1ZcahHInJF2Iv 3uU+xGFTD9iHz1rseSLkLo/bL9FT/1cLkTSU0ne0RHYj/Sb3Lq/En4uzEtCn50fjk+3G bSocMZe3Ntg/QvEmGCfT7BzG5pGxWspoP7VkKv83Io1qvHwUdV/LKdOcSv/uqA9zmc4q G1Fcpe0ZnkoAHyvvsUsPVQP+bHl0dKetw8WBkwskEF9/CVlVQZXQvvOylw36RS4jtMjH 6NOg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b=FDHpiiy2; 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=NONE dis=NONE) header.from=kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id g11si8211340pgn.32.2019.02.03.00.37.15; Sun, 03 Feb 2019 00:37:32 -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=@kernel.org header.s=default header.b=FDHpiiy2; 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=NONE dis=NONE) header.from=kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1727289AbfBCIfV (ORCPT + 99 others); Sun, 3 Feb 2019 03:35:21 -0500 Received: from mail.kernel.org ([198.145.29.99]:58082 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726807AbfBCIfV (ORCPT ); Sun, 3 Feb 2019 03:35:21 -0500 Received: from bbrezillon (91-160-177-164.subs.proxad.net [91.160.177.164]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPSA id 253652082F; Sun, 3 Feb 2019 08:35:15 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1549182920; bh=vRWB5RhHRTXvGL85gHEuG5jXta4dJ+fDhuM9kZ/+Xys=; h=Date:From:To:Cc:Subject:In-Reply-To:References:From; b=FDHpiiy2+Wga/FXzcgrJt6t40Z0XLG60xXqGedfvg/8sWzC3LZQQTFgWdpm2HMtac dlLIQQXZRJv39RtqNZzA6D9Mi/YSMFmRv537UcMNqQB0y1KzN8n2X6qRKi/AGUwsuW rxqfTo3AG94cW6sgAbGvNhjZaqgB6uheOVNB1Ntk= Date: Sun, 3 Feb 2019 09:35:09 +0100 From: Boris Brezillon To: Liu Jian , Cc: , , , , , , , , Przemyslaw Sobon Subject: Re: [PATCH] cfi: fix deadloop in cfi_cmdset_0002.c do_write_buffer Message-ID: <20190203093509.269bf1e1@bbrezillon> In-Reply-To: <20190203092645.18d1495b@bbrezillon> References: <1548977439-318904-1-git-send-email-liujian56@huawei.com> <20190203092645.18d1495b@bbrezillon> 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 Sun, 3 Feb 2019 09:26:45 +0100 Boris Brezillon wrote: > +Przemyslaw > > On Fri, 1 Feb 2019 07:30:39 +0800 > Liu Jian wrote: > > > In function do_write_buffer(), in the for loop, there is a case > > chip_ready() returns 1 while chip_good() returns 0, so it never > > break the loop. > > To fix this, chip_good() is enough and it should timeout if it stay > > bad for a while. > > Looks like Przemyslaw reported and fixed the same problem. > > > > > Fixes: dfeae1073583(mtd: cfi_cmdset_0002: Change write buffer to check > > correct value) > > Can you put the Fixes tag on a single, and the format is > > Fixes: ("message") > > > Signed-off-by: Yi Huaijie > > Signed-off-by: Liu Jian > > [1]http://patchwork.ozlabs.org/patch/1025566/ > > > --- > > drivers/mtd/chips/cfi_cmdset_0002.c | 6 +++--- > > 1 file changed, 3 insertions(+), 3 deletions(-) > > > > diff --git a/drivers/mtd/chips/cfi_cmdset_0002.c b/drivers/mtd/chips/cfi_cmdset_0002.c > > index 72428b6..818e94b 100644 > > --- a/drivers/mtd/chips/cfi_cmdset_0002.c > > +++ b/drivers/mtd/chips/cfi_cmdset_0002.c > > @@ -1876,14 +1876,14 @@ static int __xipram do_write_buffer(struct map_info *map, struct flchip *chip, > > continue; > > } > > > > - if (time_after(jiffies, timeo) && !chip_ready(map, adr)) > > - break; > > - > > if (chip_good(map, adr, datum)) { > > xip_enable(map, chip, adr); > > goto op_done; > > } > > > > + if (time_after(jiffies, timeo)) > > + break; > > + > > /* Latency issues. Drop the lock, wait a while and retry */ > > UDELAY(map, chip, adr, 1); > > } > BTW, the patch itself looks good to me. Ikegami, can you confirm it does the right thing? Thanks, Boris