Received: by 2002:a05:6a10:2785:0:0:0:0 with SMTP id ia5csp57198pxb; Fri, 15 Jan 2021 05:48:24 -0800 (PST) X-Google-Smtp-Source: ABdhPJy6kIzNzk7ORlEooyh97S9Ec8EhwodLAqSp7Fbn3ph7A4cNbmvmOWAcsrMP4DuswRUxvNQ+ X-Received: by 2002:a05:6402:3510:: with SMTP id b16mr9271283edd.242.1610718503934; Fri, 15 Jan 2021 05:48:23 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1610718503; cv=none; d=google.com; s=arc-20160816; b=HGkzYxRcyI8yFuYSv/zhuF8/6gFqspCAAbhFA154+SWc0TdjHBzmAcEmrdKDHt83ow dWzCyCfzMwPRxsi3aJWWreDkVj+qUjId6WloI7qcpk2z3crohox5wBJwsB1gg1lBynvc kmVS8WOCGZ/M7UDUGwfxhD06dOciVKRghQqsj8+2eCXhgANL/rwVYoM49eq0UNE50gRr YtRy/CAZ/9/YdJf7G5rZV5mnptujGn9YABOq7C58UpfF9rLuWeYBmxLXIFu45saDDcAj GF5fKzajFBsyr4iXlWOGRf50pWSI/JIYtXLLvXQN1Ek48CI2BQnMUAoil/IYYYiqRpK4 rEmw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:in-reply-to:content-disposition:mime-version :references:message-id:subject:cc:to:from:date:dkim-signature; bh=mRJXIb1OHP/GVfTLwAQi41UD9/iijg3W1GXxicEtJ8c=; b=z666o5Bu9E1oN5Lfa4dtDtNafgHMg6ckf4EbRas56NQPHz4jkwW/hNkyuVz83aicxg HjH/0HYeeNz+gFo4OZ7yRaZ18xrWN2Yio5rq+PjsbEyNyW6w52S3L9U48+Y8z5BitorK deK1lt5D0HAEQ7em03mGFHytH7i6HzIriJB+m60l7pb+rFprgaKkCqK8/NOYzJeSdxFC jiS4PzZtSf2h7zSP3YWfQ8kU40nWymKOR3wEFNvbUm8yLk9FRkzJ71EDDb5YWD5bZN5f TqHuHXzSI6OuatuRiB+Ar14WTAVbxX2fJeK2Lkw1iDEycVWAJg20JXGTScLL0gg3GJ6j ghTQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=kZWz4240; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id p1si2822389eds.205.2021.01.15.05.48.00; Fri, 15 Jan 2021 05:48:23 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=kZWz4240; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1731264AbhAONqg (ORCPT + 99 others); Fri, 15 Jan 2021 08:46:36 -0500 Received: from mail.kernel.org ([198.145.29.99]:45936 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1727357AbhAONqf (ORCPT ); Fri, 15 Jan 2021 08:46:35 -0500 Received: by mail.kernel.org (Postfix) with ESMTPSA id 8CBF423370; Fri, 15 Jan 2021 13:45:54 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1610718355; bh=ZdRtthMW7ijR/zuyWuxPrJJBCybYnyfzAS3LSCbVKdQ=; h=Date:From:To:Cc:Subject:References:In-Reply-To:From; b=kZWz4240R3FrkR2Dv1555wL1sF+vbcrKAEIQcxaqTRMNrNnCrKEGg8jsg74cxl3BC XOGh0S9dRHp0Bc+gMLMgzVVKT9TvNCTeozO6m7Oi/+EEFmgFCFSdXxrDNhicJz+CN2 uL8Cl1ea7keO34K3DagW7/Gf/pye0BoFHvZ0L3VQ= Date: Fri, 15 Jan 2021 14:45:52 +0100 From: Greg KH To: Alexander Potapenko Cc: linux-kernel@vger.kernel.org, akpm@linux-foundation.org, andreyknvl@google.com, dvyukov@google.com, mingo@redhat.com, elver@google.com, pmladek@suse.com, rostedt@goodmis.org, sergey.senozhatsky@gmail.com, linux-mm@kvack.org Subject: Re: [PATCH v2 3/5] docs: ABI: add /sys/kernel/error_report/ documentation Message-ID: References: <20210115130336.2520663-1-glider@google.com> <20210115130336.2520663-4-glider@google.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20210115130336.2520663-4-glider@google.com> Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Fri, Jan 15, 2021 at 02:03:34PM +0100, Alexander Potapenko wrote: > Add ABI documentation for files in /sys/kernel/error_report/ > > Requested-by: Andrew Morton > Cc: Andrew Morton > Cc: Andrey Konovalov > Cc: Dmitry Vyukov > Cc: Ingo Molnar > Cc: Marco Elver > Cc: Petr Mladek > Cc: Steven Rostedt > Cc: Sergey Senozhatsky > Cc: linux-mm@kvack.org > Signed-off-by: Alexander Potapenko > --- > .../ABI/testing/sysfs-kernel-error_report | 41 +++++++++++++++++++ > 1 file changed, 41 insertions(+) > create mode 100644 Documentation/ABI/testing/sysfs-kernel-error_report > > diff --git a/Documentation/ABI/testing/sysfs-kernel-error_report b/Documentation/ABI/testing/sysfs-kernel-error_report > new file mode 100644 > index 000000000000..666d039f93a9 > --- /dev/null > +++ b/Documentation/ABI/testing/sysfs-kernel-error_report > @@ -0,0 +1,41 @@ > +What: /sys/kernel/error_report/ > +Date: January 2021 > +Contact: Alexander Potapenko , > + Marco Elver > +Description: > + /sys/kernel/error_report/ contains two files: "report_count" > + and "last_report". These files are used to notify userspace > + about error reports from the enrolled kernel subsystems (those > + that use error_report_start/error_report_end tracepoints). > + > + "report_count" contains the current number of reported errors. > + This number is incremented every time the error_report_end > + trace event occurs in the kernel. > + > + "last_report" contains the most recent error report; concurrent > + report generation results in collection of any one report > + ("last_report" may not be the last shown on the console). > + A "report" is everything the task had printed to the console > + between issuing the error_report_start and error_report_end > + trace events. > + > + Due to sysfs limitations, the report size is truncated at > + PAGE_SIZE. To save space, the leading info in square brackets > + printed by CONFIG_PRINTK_TIME and CONFIG_PRINTK_CALLER is > + trimmed from the output lines. > + > + Both files use sysfs_notify() to notify userspace about > + changes. Userspace programs can use poll() to block until an > + error is reported: > + > + pfd.fd = fd; > + pfd.events = POLLPRI; > + while (1) { > + lseek(pfd.fd, 0, SEEK_SET); > + poll(&pfd, 1, -1); > + read(pfd.fd, buffer, PAGE_SIZE); > + /* Process the report in @buffer. */ > + } > + > + Files in /sys/kernel/error_report/ are available when > + CONFIG_ERROR_REPORT_NOTIFY is enabled. sysfs is "one value per file", please put something like this in tracefs, as there is no such rules there. Or debugfs, but please, not sysfs. Also, any reason you didn't cc: the sysfs maintainers? thanks, greg k-h