From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id B5E60C4332F for ; Mon, 17 Oct 2022 19:40:25 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S230147AbiJQTkX (ORCPT ); Mon, 17 Oct 2022 15:40:23 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:55262 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S230148AbiJQTkR (ORCPT ); Mon, 17 Oct 2022 15:40:17 -0400 Received: from mail.skyhub.de (mail.skyhub.de [5.9.137.197]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id F3A0D69199 for ; Mon, 17 Oct 2022 12:40:15 -0700 (PDT) Received: from zn.tnic (p200300ea9733e793329c23fffea6a903.dip0.t-ipconnect.de [IPv6:2003:ea:9733:e793:329c:23ff:fea6:a903]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.skyhub.de (SuperMail on ZX Spectrum 128k) with ESMTPSA id 59A401EC0531; Mon, 17 Oct 2022 21:40:10 +0200 (CEST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=alien8.de; s=dkim; t=1666035610; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:in-reply-to:in-reply-to: references:references; bh=BwDzUZUJ3Ncqn9W3MzLUnrmHphgpLYPe0ymvG0+hE2g=; b=otdJFus0QrWjMwUVuGJrSSQfbkSfAvXBEOnvl6arnKZv56FdBWW2HJJ0KYWbOKJHmntAZv hT82mvD0uWdBVTo8GvyRq7I5YMdhyWdy48xyr5EE6fvMO485O3yecctO8aJEtcudMxj5Lm wbsevnO+bczJtsQLV3n/G626r1JHdn0= Date: Mon, 17 Oct 2022 21:40:09 +0200 From: Borislav Petkov To: "Luck, Tony" Cc: "x86@kernel.org" , "linux-kernel@vger.kernel.org" Subject: Re: [PATCH v2] RAS: Fix the trace_show() function to output trace_count Message-ID: References: <20221005194644.311204-1-tony.luck@intel.com> MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Disposition: inline In-Reply-To: Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Mon, Oct 17, 2022 at 04:09:23PM +0000, Luck, Tony wrote: > Agreed. It needs user to interpret the answer. The filename would lead > them to think "1" means the daemon is active, but its actually just a count > of how many times the file is concurrently open (which includes the > "cat" process reading the file). Yap, exactly. > Should have thought of this earlier ... changing user space semantics > is hard. AFAIR, at the time we cared only about there being at least one consumer... thus the binary test, is there at least one or not: if (!ras_userspace_consumers()) { print_extlog_rcd(NULL, tmp, cpu); goto out; } > How about: > > seq_printf(m, "%d\n", atomic_read(&trace_count) - 1); > > with a comment that users reading the file only want to know if anyone > else has it open? Yeah, doesn't work either: # tail -f /sys/kernel/debug/ras/daemon_active & [1] 3019 1 tail: /sys/kernel/debug/ras/daemon_active: file truncated 1 # cat /sys/kernel/debug/ras/daemon_active 2 We really need something to say, "I really am a RAS events consumer and not some random file opener." OTOH, if one does that on ones system, then one has herself to blame when errors don't get logged and disappear. I mean, why would one even do that?! Then again, I've seen weirder stuff so... Question is, what is your goal with this? -- Regards/Gruss, Boris. https://people.kernel.org/tglx/notes-about-netiquette