Received: by 2002:a25:6193:0:0:0:0:0 with SMTP id v141csp986881ybb; Fri, 20 Mar 2020 11:22:23 -0700 (PDT) X-Google-Smtp-Source: ADFU+vs2FtM5LMnqr3dbupmbpfrJqpaHSeLqmj/Jb5adjwcqkPh1bdKKO3t4TFAlmpk45sFmjWzQ X-Received: by 2002:a05:6830:1e06:: with SMTP id s6mr8266721otr.28.1584728543115; Fri, 20 Mar 2020 11:22:23 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1584728543; cv=none; d=google.com; s=arc-20160816; b=Tv5VwOzdNUb12KTmMvMWOWrCv+JjBssIPVpJHRlUd/aAn4IGqg1Iyup3u62yZdO8ZU kYAFntqpf0A00Pqt9bFTSjgTucrVw95M2hP/w0PO3fTOWXco3Zi0M8xanP9s9E5JGNZ+ DJAzn8KtAovI7G5LbbTkaP2D/G4WFsby1/k3vv4kF8Q96dddEn6f+d1mesPPNJ/CfAIh Kzd29P8X1cjfi6aPN7PATU6hV9EQPDBwEdGNTaN/UK+d+pZ/lJCqcpM+b2qB8FKyNRxL 4RL7FoXcy1RySwXOhk4DUU0/OHv2GdM9AqT9Q4IVUjWFKzGlz2eBLxUSBCctSvAB4wgz BmXQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:in-reply-to:content-disposition :mime-version:references:message-id:subject:cc:to:from:date :dkim-signature; bh=RVSRfcV+K0pn1zszQCXh+F75MQYeICFTBaMdga96uY8=; b=HxZttqlwNE/qxqva5Yr62xFz5k/S+TSd+Yy3IQmWNUyQmGSNfe7jLSWBwbeLf+84P1 W3kwf3s6PyKq39Ece9WqS63WOWF9LDcULZ9R87Dvogt9s3Yog5j0cVpTgyT/xkUaVpNq tBE5nMNWmeBR05wHyszFY85+JJ5xWKlqKTVXifuS1c/47Y4L++JwRa6KgeaSlv9pTT9g hFJxqgbRuvevyBmpRvXpyyblXjdc0k6gI7onZ24ZvJKSzPjdOTxbPE3VcomVKqMhxUBS hYdJEjNlmyM+BVxeAgv+HTfmRz5C2aRS98Saw1cwUZrlijoaPDYMfW7oDj2pKZE5nV3n orfA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@chromium.org header.s=google header.b=ROF8fL4c; 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=chromium.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id c131si3044849oif.43.2020.03.20.11.22.08; Fri, 20 Mar 2020 11:22:23 -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; dkim=pass header.i=@chromium.org header.s=google header.b=ROF8fL4c; 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=chromium.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726986AbgCTSU0 (ORCPT + 99 others); Fri, 20 Mar 2020 14:20:26 -0400 Received: from mail-pl1-f193.google.com ([209.85.214.193]:33443 "EHLO mail-pl1-f193.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726789AbgCTSU0 (ORCPT ); Fri, 20 Mar 2020 14:20:26 -0400 Received: by mail-pl1-f193.google.com with SMTP id g18so2868113plq.0 for ; Fri, 20 Mar 2020 11:20:25 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=chromium.org; s=google; h=date:from:to:cc:subject:message-id:references:mime-version :content-disposition:in-reply-to; bh=RVSRfcV+K0pn1zszQCXh+F75MQYeICFTBaMdga96uY8=; b=ROF8fL4cRZOKjexdiQjvRriYL5aMB2v6UG48zv2w65UIZVXk7AuVFSi6y696oOXNgd OvVHFsVQNRrgCH99H9N1yvFIVrPS6ys9mIlNNMSdcv+QWT7LmYHbymhkONJJ4Iind7wU XawwvMxLzn/ahDIsk46CsBzOvZd50S7qX5rI8= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:date:from:to:cc:subject:message-id:references :mime-version:content-disposition:in-reply-to; bh=RVSRfcV+K0pn1zszQCXh+F75MQYeICFTBaMdga96uY8=; b=NtOlxtQc/aEXKreEovN71zotVw+UPPTu6IlBjdLP5GIq3i4bd7Cx9nK/gqT/VwzwWG LeqX4YnJ1bYqJxruU0ucwlgeooYI/CW6gtJ4PH6btv93V3F/1PrYXardIC0HvzLITf0+ yMKOBQDFjtVbsM/EkNlZzQ+eoU/8DaNuqFf73SPUixgJorexcQeoVGidd5uoyjpknu37 jzGM8GmKbEf+GL1UUlSEjLNek8GryWhZhbnEWtUVyLy2psk0HXy7PxsPYzE0Q5zXIq0/ mSSj/cg1nkweu2ikPkj/VocDUr4GXB1fTj0TDdHF0eocdYtIA3VjxkfQVRS+CaOTOaeN YR0g== X-Gm-Message-State: ANhLgQ2Sof79UEPf4o7CUi1uzdhwPyh4RAiGXoreae39yjBxvkDkHuBl lArHRA1PnCYp6pEerj1z5PoBwQ== X-Received: by 2002:a17:902:8348:: with SMTP id z8mr8998254pln.342.1584728424639; Fri, 20 Mar 2020 11:20:24 -0700 (PDT) Received: from www.outflux.net (smtp.outflux.net. [198.145.64.163]) by smtp.gmail.com with ESMTPSA id g9sm6093642pfi.37.2020.03.20.11.20.22 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 20 Mar 2020 11:20:23 -0700 (PDT) Date: Fri, 20 Mar 2020 11:20:22 -0700 From: Kees Cook To: WeiXiong Liao Cc: Anton Vorontsov , Colin Cross , Tony Luck , Jonathan Corbet , Miquel Raynal , Richard Weinberger , Vignesh Raghavendra , Mauro Carvalho Chehab , "David S. Miller" , Rob Herring , Greg Kroah-Hartman , Jonathan Cameron , linux-doc@vger.kernel.org, linux-kernel@vger.kernel.org, linux-mtd@lists.infradead.org Subject: Re: [PATCH v2 01/11] pstore/blk: new support logger for block devices Message-ID: <202003201111.BE5EAB9A@keescook> References: <1581078355-19647-1-git-send-email-liaoweixiong@allwinnertech.com> <1581078355-19647-2-git-send-email-liaoweixiong@allwinnertech.com> <202002251626.63FE3E7C6@keescook> <5fd540be-6ed9-a1c7-4932-e67194dddca8@allwinnertech.com> <202003180944.3B36871@keescook> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Fri, Mar 20, 2020 at 09:50:36AM +0800, WeiXiong Liao wrote: > On 2020/3/19 AM 1:23, Kees Cook wrote: > > On Thu, Feb 27, 2020 at 04:21:51PM +0800, liaoweixiong wrote: > >> On 2020/2/26 AM 8:52, Kees Cook wrote: > >>> On Fri, Feb 07, 2020 at 08:25:45PM +0800, WeiXiong Liao wrote: > >>>> +obj-$(CONFIG_PSTORE_BLK) += pstore_blk.o > >>>> +pstore_blk-y += blkzone.o > >>> > >>> Why this dance with files? I would just expect: > >>> > >>> obj-$(CONFIG_PSTORE_BLK) += blkzone.o > >>> > >> > >> This makes the built module named blkzone.ko rather than > >> pstore_blk.ko. > > > > You can just do a regular build rule: > > > > obj-$(CONFIG_PSTORE_BLK) += blkzone.o > > > > I don't get it. If make it as your words, the built module will be > blkzone.ko. > The module is named pstore/blk, however it built out blkzone.ko. I think > it's confusing. I mean just pick whatever filename you want it to be named. The Makefile case for ramoops was that ramoops got renamed but we wanted to keep the old API name. So, if you want it named pstore-blk.ko, just rename blkzone.c to pstore-blk.c. > >>> If you're expecting concurrent writers (use of atomic_set(), I would > >>> expect the whole write to be locked instead. (i.e. what happens if > >>> multiple callers call blkz_zone_write()?) > >>> > >> > >> I don't agree with it. The datalen will be updated everywhere. It's useless > >> to lock here. > > > > But there could be multiple writers; locking should be needed. > > > > All the recorders such as dmesg, pmsg, console and ftrace have been > locked on > pstore and upper layers. So, a recorder will not write in parallel and > different > recorders operate privately zone. They don't have any influence on each > other. Yes, sorry, I was confusing myself about pmsg, and I forgot it had a global lock. Each are locked or split by CPU. > The only parallel case I think is that recorder writes while dirty-flush > thread is > working. And the dirty-flusher will flush the whole zone rather than > part of it, so, > it is OK to call in parallel. Okay, thanks for clarifying. > Based on these reasons, I don't think locking should be needed. Agreed. -- Kees Cook