Received: by 2002:ad5:474a:0:0:0:0:0 with SMTP id i10csp2099487imu; Fri, 23 Nov 2018 04:41:41 -0800 (PST) X-Google-Smtp-Source: AFSGD/Xq/pSWF2LajAhWUVk1sVd/M52f6DDDmh5EtrQToFGmpPBrmq3ldidyYIc+FjAD9zwOxx9S X-Received: by 2002:a63:d157:: with SMTP id c23mr13855865pgj.170.1542976901851; Fri, 23 Nov 2018 04:41:41 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1542976901; cv=none; d=google.com; s=arc-20160816; b=TaO9ZNJFbTNlmnzgOvRWEn95tK+i4SbiZa7/rREjTuDx/0E0d/YP7uPgZQopTyHHi7 DavFDBEv3jvRoy6Ac+G0LqlwQIMYCeHAR09pHzHaD+4/E1iOEEEJlrzaB1MZ1QZDnMJW e1JGXdkrJ6Yre66+SYYR+jtm8Q/N6yKDNlsG4z1fyiT1ReaupSTfGb8NOS1Y/yC/tgmx xZUNA1xdMmEiHnqjt6tofhdBf4dT2MB1NlbaHUGEqC52Qu/3QRLoYgOkoJqFBY+hMKtG +2yKTAQmEdgUsjARBzHPJErK0kI7D8JCx8j+cMhMahwI35Rdhr6fBbI1sJ/dSZ+M6KC9 t9WQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:user-agent:in-reply-to :content-disposition:mime-version:references:message-id:subject:cc :to:from:date:dkim-signature; bh=ROd/pGaND2P9uXkbRcg/qY/JpF1kIfG/8xLYEuZ1o2Y=; b=k+hftrVUIKHN0pBo0ru+z18xHvgg9gtObQywsH/kDke8SFKT1aHSjcMbjpXe9ssKdE aL5dEAnQQOV1IDNSImtwuaVcJXSHSjlxDhPn/mCH31b0JhJ3kOyXKpZCT6jc9KwvV94J ilG6aqfUJEw6rM1TcJrv9k4WKDxaNKrq8hijuYWtgtFbr2cUO6lEeNaD+CcQNotBV+3Q 7tn1hazSaxeWejLabJiTJxHIwSnYtwDGdeRbGVeNpqyzxaKgkL0+cyKgXtqZ+N8wZTGe t4pVm/PUIX7hlXvCQUozMv12DWdFvmzLJyECBucpnWTC0C6nAOQLQmEZ3d7Rz4uPqO7a sTZw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b=ywJemyRo; 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 r22si22447132pgl.537.2018.11.23.04.40.45; Fri, 23 Nov 2018 04:41:41 -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=ywJemyRo; 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 S2394714AbeKVWFp (ORCPT + 99 others); Thu, 22 Nov 2018 17:05:45 -0500 Received: from mail.kernel.org ([198.145.29.99]:52352 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S2394706AbeKVWFo (ORCPT ); Thu, 22 Nov 2018 17:05:44 -0500 Received: from localhost (5356596B.cm-6-7b.dynamic.ziggo.nl [83.86.89.107]) (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 ECF002081C; Thu, 22 Nov 2018 11:26:46 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1542886007; bh=pU1qPP1/AKTwSHQ/U082dtbWU8c1fm3+mclqzstKDFc=; h=Date:From:To:Cc:Subject:References:In-Reply-To:From; b=ywJemyRoNSSMwbEpt1bknXoGFGjlDdoiyyt9A6si1Z7fn6GheD0SER00+6vyd9GpY ZVzY0k55dLk2Ndu/6BneCqO2QtFptD30dAxKQ0JtulgcXBbXd9/4kaCNeD6C/gRjGG RmebiTljTUSQWBisFM1cHQ+DNRd+U2Wad+hAgwH4= Date: Thu, 22 Nov 2018 12:26:45 +0100 From: Greg Kroah-Hartman To: Gao Xiang Cc: devel@driverdev.osuosl.org, linux-erofs@lists.ozlabs.org, Chao Yu , LKML , weidu.du@huawei.com, Miao Xie Subject: Re: [PATCH 07/10] staging: erofs: separate into init_once / always Message-ID: <20181122112645.GA7527@kroah.com> References: <20181120143425.43637-1-gaoxiang25@huawei.com> <20181120143425.43637-8-gaoxiang25@huawei.com> <20181122102339.GG3189@kroah.com> <66b90226-5d0e-7344-5220-908aa243b014@huawei.com> <20181122110500.GC5287@kroah.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: User-Agent: Mutt/1.10.1 (2018-07-13) Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Thu, Nov 22, 2018 at 07:11:08PM +0800, Gao Xiang wrote: > Hi Greg, > > On 2018/11/22 19:05, Greg Kroah-Hartman wrote: > > On Thu, Nov 22, 2018 at 06:34:10PM +0800, Gao Xiang wrote: > >> Hi Greg, > >> > >> On 2018/11/22 18:23, Greg Kroah-Hartman wrote: > >>>> + > >>>> + DBG_BUGON(work->nr_pages); > >>>> + DBG_BUGON(work->vcnt); > >>> How can these ever be triggered? I understand the need for debugging > >>> code when you are writing code, but at this point it shouldn't be needed > >>> anymore, right? > >> > >> I need to avoid some fields is not 0 when the new workgroup is created (because > >> work->nr_pages and work->vcnt == 0 usually after the previous workgroup is freed). > >> But that is not obvious, it is promised by the current logic. > > > > Then delete these lines if they can never happen :) > > I don't know how to observe such a race in our beta test and community users. /* * Let developers know something went really wrong with their * initialization code */ if (!work->nr_pages) { pr_err("nr_pages == NULL!"); WARN_ON(1); } if (!work->vcnt) { pr_err("vcnt == NULL!"); WARN_ON(1); } or something like that. Don't make people rebuild your code with different options for debugging. That will never work in the 'real world' when people start using the code. You need to have things enabled for people all the time, which is why we have dynamic debugging in the kernel now, and not a zillion different "DRIVER_DEBUG" build options anymore. > Because if the kernel is crashed, we could collect the whole kernel dump to observe the memory > and all registers, if we only have some warning, it will be not easy to get the state as early as possible. When the kernel crashes, geting a dump is hard on almost all hardware. It is only rare systems that you can get a kernel dump. thanks, greg k-h