From: WeiXiong Liao <liaoweixiong@allwinnertech.com>
To: Kees Cook <keescook@chromium.org>
Cc: Anton Vorontsov <anton@enomsg.org>,
Colin Cross <ccross@android.com>, Tony Luck <tony.luck@intel.com>,
Jonathan Corbet <corbet@lwn.net>,
Miquel Raynal <miquel.raynal@bootlin.com>,
Richard Weinberger <richard@nod.at>,
Vignesh Raghavendra <vigneshr@ti.com>,
Rob Herring <robh@kernel.org>,
linux-doc@vger.kernel.org, linux-kernel@vger.kernel.org,
linux-mtd@lists.infradead.org
Subject: Re: [PATCH v8 01/11] pstore/zone: Introduce common layer to manage storage zones
Date: Tue, 12 May 2020 13:47:56 +0800 [thread overview]
Message-ID: <57efa2b5-d598-a600-5f74-8fd81299fc58@allwinnertech.com> (raw)
In-Reply-To: <202005112212.2E75B83@keescook>
hi Kees Cook,
On 2020/5/12 PM 1:15, Kees Cook wrote:
> On Tue, May 12, 2020 at 11:55:20AM +0800, WeiXiong Liao wrote:
>> On 2020/5/12 AM 7:32, Kees Cook wrote:
>>> [...]
>>> +struct psz_context {
>>> + struct pstore_zone **kpszs;
>>> + unsigned int kmsg_max_cnt;
>>> + unsigned int kmsg_read_cnt;
>>> + unsigned int kmsg_write_cnt;
>>> + /*
>>> + * These counters should be calculated during recovery.
>>> + * It records the oops/panic times after crashes rather than boots.
>>> + */
>>> + unsigned int oops_counter;
>>> + unsigned int panic_counter;
>>
>> oops/panic_counter is designed to count the crash times since the
>> linux kernel was installed. pstore/zone lookup the max counter from all
>> valid kmsg zones when recovery and saves them to oops/panic_counter.
>> However, they are unable to get real number if we remove files. It's
>> not serious, we can fix it after this series.
>
> Since the kernel was installed? I don't see a kernel version check in
> here? Or do you mean "since ever", in that it's a rolling count?
>
Yes, "since ever".
>> And since pstore supports "max_reason", should pstore/zone count for
>> other reason?
>
> For now, no. I opted to try to keep this as simple as possible a port
> from dump_oops to max_reason for now.
>
OK.
>>> +static inline int psz_kmsg_erase(struct psz_context *cxt,
>>> + struct pstore_zone *zone, struct pstore_record *record)
>>> +{
>>> + struct psz_buffer *buffer = zone->buffer;
>>> + struct psz_kmsg_header *hdr =
>>> + (struct psz_kmsg_header *)buffer->data;
>>> +
>>> + if (unlikely(!psz_ok(zone)))
>>> + return 0;
>>> + /* this zone is already updated, no need to erase */
>>> + if (record->count != hdr->counter)
>>> + return 0;
>>
>> These codes is to fix bug that user remove files on pstore filesystem
>> but kmsg zone is already updated and pstore/zone should not erase
>> zone. It work for oops and panic because the count number is increasing.
>> However, it's useless for other reason of kmsg. We can fix it after this
>> series.
>
> Okay, sounds good.
>
--
WeiXiong Liao
next prev parent reply other threads:[~2020-05-12 5:47 UTC|newest]
Thread overview: 18+ messages / expand[flat|nested] mbox.gz Atom feed top
2020-05-11 23:32 [PATCH v8 00/11] pstore: mtd: support crash log to block and mtd device Kees Cook
2020-05-11 23:32 ` [PATCH v8 01/11] pstore/zone: Introduce common layer to manage storage zones Kees Cook
2020-05-12 3:55 ` WeiXiong Liao
2020-05-12 5:15 ` Kees Cook
2020-05-12 5:47 ` WeiXiong Liao [this message]
2020-05-11 23:32 ` [PATCH v8 02/11] pstore/blk: Introduce backend for block devices Kees Cook
2020-05-11 23:32 ` [PATCH v8 03/11] pstore/zone,blk: Add support for pmsg frontend Kees Cook
2020-05-11 23:32 ` [PATCH v8 04/11] pstore/zone,blk: Add console frontend support Kees Cook
2020-05-11 23:32 ` [PATCH v8 05/11] pstore/zone,blk: Add ftrace " Kees Cook
2020-05-11 23:32 ` [PATCH v8 06/11] Documentation: Add details for pstore/blk Kees Cook
2020-05-11 23:32 ` [PATCH v8 07/11] pstore/zone: Provide way to skip "broken" zone for MTD devices Kees Cook
2020-05-11 23:32 ` [PATCH v8 08/11] pstore/blk: Provide way to query pstore configuration Kees Cook
2020-05-11 23:32 ` [PATCH v8 09/11] pstore/blk: Support non-block storage devices Kees Cook
2020-05-11 23:32 ` [PATCH v8 10/11] mtd: Support kmsg dumper based on pstore/blk Kees Cook
2020-05-12 3:12 ` WeiXiong Liao
2020-05-12 5:12 ` Kees Cook
2020-05-12 5:56 ` WeiXiong Liao
2020-05-11 23:32 ` [PATCH v8 11/11] pstore/blk: Introduce "best_effort" mode Kees Cook
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=57efa2b5-d598-a600-5f74-8fd81299fc58@allwinnertech.com \
--to=liaoweixiong@allwinnertech.com \
--cc=anton@enomsg.org \
--cc=ccross@android.com \
--cc=corbet@lwn.net \
--cc=keescook@chromium.org \
--cc=linux-doc@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-mtd@lists.infradead.org \
--cc=miquel.raynal@bootlin.com \
--cc=richard@nod.at \
--cc=robh@kernel.org \
--cc=tony.luck@intel.com \
--cc=vigneshr@ti.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).