mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Hans de Goede <hdegoede@redhat.com>
To: Mike Travis <mike.travis@hpe.com>,
	Justin Ernst <justin.ernst@hpe.com>,
	Mark Gross <mgross@linux.intel.com>,
	Thomas Gleixner <tglx@linutronix.de>,
	Ingo Molnar <mingo@redhat.com>, Borislav Petkov <bp@alien8.de>,
	x86@kernel.org, Steve Wahl <steve.wahl@hpe.com>
Cc: Dimitri Sivanich <dimitri.sivanich@hpe.com>,
	Russ Anderson <russ.anderson@hpe.com>,
	"H. Peter Anvin" <hpa@zytor.com>,
	Mauro Carvalho Chehab <mchehab+huawei@kernel.org>,
	Suzuki K Poulose <suzuki.poulose@arm.com>,
	Ilya Dryomov <idryomov@gmail.com>,
	linux-kernel@vger.kernel.org,
	platform-driver-x86@vger.kernel.org
Subject: Re: [PATCH 4/5] x86/platform/uv: Add deprecated messages to /proc info leaves
Date: Fri, 27 Nov 2020 19:06:12 +0100	[thread overview]
Message-ID: <3bc4d491-e4c9-132e-97ce-8acfbe9dc509@redhat.com> (raw)
In-Reply-To: <ebd8451a-5910-1da5-4792-2a3d2f59b348@hpe.com>

Hi,

On 11/27/20 3:58 PM, Mike Travis wrote:
> 
> 
> On 11/26/2020 2:45 AM, Hans de Goede wrote:
>> Hi,
>>
>> On 11/25/20 6:29 PM, Mike Travis wrote:
>>> Add "deprecated" message to any access to old /proc/sgi_uv/* leaves.
>>>
>>> Signed-off-by: Mike Travis <mike.travis@hpe.com>
>>> Reviewed-by: Steve Wahl <steve.wahl@hpe.com>
>>> ---
>>>   arch/x86/kernel/apic/x2apic_uv_x.c | 26 +++++++++++++++++++++++++-
>>>   1 file changed, 25 insertions(+), 1 deletion(-)
>>>
>>> diff --git a/arch/x86/kernel/apic/x2apic_uv_x.c b/arch/x86/kernel/apic/x2apic_uv_x.c
>>> index 48746031b39a..bfd77a00c2a1 100644
>>> --- a/arch/x86/kernel/apic/x2apic_uv_x.c
>>> +++ b/arch/x86/kernel/apic/x2apic_uv_x.c
>>> @@ -1615,21 +1615,45 @@ static void check_efi_reboot(void)
>>>           reboot_type = BOOT_ACPI;
>>>   }
>>>   -/* Setup user proc fs files */
>>> +/*
>>> + * User proc fs file handling now deprecated.
>>> + * Recommend using /sys/firmware/sgi_uv/... instead.
>>> + */
>>> +static void proc_print_msg(int *flag, char *what, char *which)
>>> +{
>>> +    if (*flag)
>>> +        return;
>>> +
>>> +    pr_notice(
>>> +        "%s: using deprecated /proc/sgi_uv/%s, use /sys/firmware/sgi_uv/%s\n",
>>> +        current->comm, what, which ? which : what);
>>> +
>>> +    *flag = 1;
>>> +}
>>> +
>>
>> You have just re-invented pr_notice_once, please just use pr_notice_once
>> directly in the _show functions.
> 
> I tried it both ways (actually with rate limiting as well).  The problem with using a static check in the error print function it will only print the first instance it encounters, not all of the references.
> 
> If I move it to the final output I need to replicate the verbiage of the format for every instance as you can't seem to combine the KERN_* level of printing and the pr_fmt reference of the format string.  I tried a few ways including just putting everything into a format character list.  But what used to work (indirect format pointer) doesn't any more.  Or I didn't hit on the correct combination of KERN_* level and indirect format string.
> 
> The last combination was no print limiting which caused of course the error message to be output on every occurrence.  (NASA has 35,000 customers for their big systems, that's a lot of potential console messages.)  This really annoys them and we would get calls from those that don't have any means of changing this so they ask us.
> 
> So I just chose this method of accomplishing all goals, except of course using the higher level of print function (pr_notice_once).  But if you think method two ("use pr_notice_once directly in the _show function") is most favorable I will switch to that.

Yeah I think using that is much better then reinventing it, you can simply just write
out the 3 different messages which you are "formatting" now as static strings so you get:

	pr_notice_once("%s: using deprecated /proc/sgi_uv/hubbed, use /sys/firmware/sgi_uv/hub_type\n", current->comm);

	pr_notice_once("%s: using deprecated /proc/sgi_uv/hubless, use /sys/firmware/sgi_uv/hubless\n", current->comm);

	pr_notice_once("%s: using deprecated /proc/sgi_uv/archtype, use /sys/firmware/sgi_uv/archtype\n", current->comm);

Regards,

Hans




> 
>>
>> Regards,
>>
>> Hans
>>
>>
>>
>>
>>>   static int __maybe_unused proc_hubbed_show(struct seq_file *file, void *data)
>>>   {
>>> +    static int flag;
>>> +
>>> +    proc_print_msg(&flag, "hubbed", "hub_type");
>>>       seq_printf(file, "0x%x\n", uv_hubbed_system);
>>>       return 0;
>>>   }
>>>     static int __maybe_unused proc_hubless_show(struct seq_file *file, void *data)
>>>   {
>>> +    static int flag;
>>> +
>>> +    proc_print_msg(&flag, "hubless", NULL);
>>>       seq_printf(file, "0x%x\n", uv_hubless_system);
>>>       return 0;
>>>   }
>>>     static int __maybe_unused proc_archtype_show(struct seq_file *file, void *data)
>>>   {
>>> +    static int flag;
>>> +
>>> +    proc_print_msg(&flag, "archtype", NULL);
>>>       seq_printf(file, "%s/%s\n", uv_archtype, oem_table_id);
>>>       return 0;
>>>   }
>>>
>>
> 


  reply	other threads:[~2020-11-27 18:06 UTC|newest]

Thread overview: 11+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-11-25 17:29 [PATCH 0/5] x86/platform/uv: Move UV procfs leaves to sysfs Mike Travis
2020-11-25 17:29 ` [PATCH 1/5] x86/platform/uv: Add kernel interfaces for obtaining system info Mike Travis
2020-11-25 17:29 ` [PATCH 2/5] x86/platform/uv: Add sysfs leaves to replace those in procfs Mike Travis
2020-11-25 17:29 ` [PATCH 3/5] x86/platform/uv: Add sysfs hubless leaves Mike Travis
2020-11-25 17:29 ` [PATCH 4/5] x86/platform/uv: Add deprecated messages to /proc info leaves Mike Travis
2020-11-26 10:45   ` Hans de Goede
2020-11-27 14:58     ` Mike Travis
2020-11-27 18:06       ` Hans de Goede [this message]
2020-11-25 17:29 ` [PATCH 5/5] x86/platform/uv: Update sysfs document file Mike Travis
2020-11-26 10:44 ` [PATCH 0/5] x86/platform/uv: Move UV procfs leaves to sysfs Hans de Goede
2020-11-27 14:41   ` Mike Travis

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=3bc4d491-e4c9-132e-97ce-8acfbe9dc509@redhat.com \
    --to=hdegoede@redhat.com \
    --cc=bp@alien8.de \
    --cc=dimitri.sivanich@hpe.com \
    --cc=hpa@zytor.com \
    --cc=idryomov@gmail.com \
    --cc=justin.ernst@hpe.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=mchehab+huawei@kernel.org \
    --cc=mgross@linux.intel.com \
    --cc=mike.travis@hpe.com \
    --cc=mingo@redhat.com \
    --cc=platform-driver-x86@vger.kernel.org \
    --cc=russ.anderson@hpe.com \
    --cc=steve.wahl@hpe.com \
    --cc=suzuki.poulose@arm.com \
    --cc=tglx@linutronix.de \
    --cc=x86@kernel.org \
    /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

all inboxes | Powered by JetHome®