From: Damien Le Moal <dlemoal@kernel.org>
To: Geert Uytterhoeven <geert@linux-m68k.org>
Cc: linux-ide@vger.kernel.org, linux-renesas-soc@vger.kernel.org,
Niklas Cassel <cassel@kernel.org>
Subject: Re: [PATCH v6 04/11] ata: libata: Print quirks applied to devices
Date: Thu, 1 Aug 2024 18:25:35 +0900 [thread overview]
Message-ID: <0f9d26c0-e79e-4913-862a-3df642177415@kernel.org> (raw)
In-Reply-To: <CAMuHMdVbkeeQy_WBcBhKhOzWv=MsCUjsVEBDrEi0b+g_-RKCOQ@mail.gmail.com>
On 8/1/24 6:07 PM, Geert Uytterhoeven wrote:
> Hi Damien,
>
> On Wed, Jul 31, 2024 at 11:08 AM Damien Le Moal <dlemoal@kernel.org> wrote:
>> On 7/31/24 16:27, Geert Uytterhoeven wrote:
>>> On Wed, Jul 31, 2024 at 1:39 AM Damien Le Moal <dlemoal@kernel.org> wrote:
>>>> On 7/30/24 19:09, Geert Uytterhoeven wrote:
>>>>> On Fri, 26 Jul 2024, Damien Le Moal wrote:
>>>>>> Introduce the function ata_dev_print_quirks() to print the quirk flags
>>>>>> that will be applied to a scanned device. This new function is called
>>>>>> from ata_dev_quirks() when a match on a device model or device model
>>>>>> and revision is found for a device in the __ata_dev_quirks array.
>>>>>>
>>>>>> To implement this function, the ATA_QUIRK_ flags are redefined using
>>>>>> the new enum ata_quirk which defines the bit shift for each quirk
>>>>>> flag. The array of strings ata_quirk_names is used to define the name
>>>>>> of each flag, which are printed by ata_dev_print_quirks().
>>>>>>
>>>>>> Example output for a device listed in the __ata_dev_quirks array and
>>>>>> which has the ATA_QUIRK_DISABLE flag applied:
>>>>>>
>>>>>> [10193.461270] ata1: SATA link up 6.0 Gbps (SStatus 133 SControl 300)
>>>>>> [10193.469190] ata1.00: Model 'ASMT109x- Config', rev '2143 5', applying quirks: disable
>>>>>> [10193.469195] ata1.00: unsupported device, disabling
>>>>>> [10193.481564] ata1.00: disable device
>>>>>>
>>>>>> enum ata_quirk also defines the __ATA_QUIRK_MAX value as one plus the
>>>>>> last quirk flag defined. This value is used in ata_dev_quirks() to add a
>>>>>> build time check that all quirk flags fit within the unsigned int
>>>>>> (32-bits) quirks field of struct ata_device.
>>>>>>
>>>>>> Signed-off-by: Damien Le Moal <dlemoal@kernel.org>
>>>>>> Reviewed-by: Igor Pylypiv <ipylypiv@google.com>
>>>>>
>>>>> Thanks for your patch, which is now commit 58157d607aecb4e0 ("ata:
>>>>> libata: Print quirks applied to devices") in libata/for-next.
>>>>>
>>>>> During boot-up on Salvator-XS (using rcar-sata), the quirk info is
>>>>> printed not once, but four times. Is that intentional?
>>>>
>>>> Not at all. I tested on x86 with AHCI and see this message only once. So it
>>>> could be that different drivers may need some tweaks to avoid this spamming.
>>>> Though it is strange that the initialization or resume path takes this path 4
>>>> times, meaning that the quirks are applied 4 times. Need to look into that.
>>>> What is the driver for rcar-sata ? Compatible string for it would be fine.
>>>
>>> drivers/ata/sata_rcar.c, using renesas,rcar-gen3-sata.
>>>
>>> I added a WARN() to ata_dev_quirks() to show backtraces:
>>>
>>> Call trace:
>>> ata_dev_quirks+0x98/0x19c
>>> ata_dev_configure+0x74/0x12d8
>>> ata_eh_recover+0x8d8/0xd08
>>> ata_do_eh+0x50/0xa8
>>> ata_sff_error_handler+0xd0/0xec
>>> ata_bmdma_error_handler+0x7c/0x12c
>>> ata_scsi_port_error_handler+0xc8/0x5f8
>>> ata_scsi_error+0x90/0xcc
>>> scsi_error_handler+0x148/0x308
>>> kthread+0xe4/0xf4
>>> ret_from_fork+0x10/0x20
>>
>> OK. So it is ata_dev_configure() being called many times from EH. Weird.
>> But I have not a lot of experience with the bmdma drivers.
>> Need to look into that.
>>
>> In the meantime, can you try this ?
>>
>> --- a/drivers/ata/libata-core.c
>> +++ b/drivers/ata/libata-core.c
>
>> @@ -4087,7 +4087,7 @@ static void ata_dev_print_quirks(const struct ata_device *dev,
>> size_t sz;
>> char *str;
>>
>> - if (!quirks)
>> + if (!ata_dev_print_info(dev) || !quirks)
>> return;
>>
>> sz = 64 + ARRAY_SIZE(ata_quirk_names) * 16;
>
> Thanks, that reduces the number of quirk prints from 4 to 2 during
> boot-up, and from 4 to 0 when resuming from s2idle/s2ram.
2 times on boot... Hmm.. So that means that you are seeing all the probe
messages twice (and not just the quirk message), right ?
Note that I prepared a better patch for this:
commit bc021024de6034a31a818103e4a9845390ba0c47
Author: Damien Le Moal <dlemoal@kernel.org>
Date: Thu Aug 1 18:04:22 2024 +0900
ata: libata: Print device quirks only once
In ata_dev_print_quirks(), return early if ata_dev_print_info() returns
false to avoid printing a device quirks multiple times (that is, each
time ata_dev_revalidate() is called).
Reported-by: Geert Uytterhoeven <geert@linux-m68k.org>
Fixes: 58157d607aec ("ata: libata: Print quirks applied to devices")
Signed-off-by: Damien Le Moal <dlemoal@kernel.org>
diff --git a/drivers/ata/libata-core.c b/drivers/ata/libata-core.c
index b4fdb78579c8..3fc9a68d4f45 100644
--- a/drivers/ata/libata-core.c
+++ b/drivers/ata/libata-core.c
@@ -160,7 +160,7 @@ MODULE_DESCRIPTION("Library module for ATA devices");
MODULE_LICENSE("GPL");
MODULE_VERSION(DRV_VERSION);
-static inline bool ata_dev_print_info(struct ata_device *dev)
+static inline bool ata_dev_print_info(const struct ata_device *dev)
{
struct ata_eh_context *ehc = &dev->link->eh_context;
@@ -4029,7 +4029,7 @@ static void ata_dev_print_quirks(const struct ata_device
*dev,
size_t sz;
char *str;
- if (!quirks)
+ if (!ata_dev_print_info(dev) || !quirks)
return;
sz = 64 + ARRAY_SIZE(ata_quirk_names) * 16;
But if you prefer to see the quirk message only once, then I will need to
change this and use a flag to remember that quirk info has been printed
already. But in your case, I suspect you see all probe messages twice, no ?
--
Damien Le Moal
Western Digital Research
next prev parent reply other threads:[~2024-08-01 9:25 UTC|newest]
Thread overview: 39+ messages / expand[flat|nested] mbox.gz Atom feed top
2024-07-26 3:19 [PATCH v6 0/4] Some cleanup, renaming and horkage improvements Damien Le Moal
2024-07-26 3:19 ` [PATCH v6 01/11] ata: libata: Change ata_dev_knobble() to return a bool Damien Le Moal
2024-07-26 3:19 ` [PATCH v6 02/11] ata: libata: Rename ata_dma_blacklisted() Damien Le Moal
2024-07-26 3:19 ` [PATCH v6 03/11] ata: libata: Use QUIRK instead of HORKAGE Damien Le Moal
2024-07-26 10:27 ` Niklas Cassel
2024-07-29 18:41 ` Igor Pylypiv
2024-07-26 3:19 ` [PATCH v6 04/11] ata: libata: Print quirks applied to devices Damien Le Moal
2024-07-26 10:47 ` Niklas Cassel
2024-07-30 10:09 ` Geert Uytterhoeven
2024-07-30 23:39 ` Damien Le Moal
2024-07-31 7:27 ` Geert Uytterhoeven
2024-07-31 9:08 ` Damien Le Moal
2024-08-01 9:07 ` Geert Uytterhoeven
2024-08-01 9:25 ` Damien Le Moal [this message]
2024-08-01 10:05 ` Geert Uytterhoeven
2024-08-01 10:08 ` Damien Le Moal
2024-08-01 10:42 ` Damien Le Moal
2024-08-01 15:04 ` Geert Uytterhoeven
2024-07-26 3:19 ` [PATCH v6 05/11] ata: pata_serverworks: Do not use the term blacklist Damien Le Moal
2024-07-26 11:12 ` Niklas Cassel
2024-07-29 18:43 ` Igor Pylypiv
2024-07-26 3:19 ` [PATCH v6 06/11] ata: ahci: Rephrase comment to " Damien Le Moal
2024-07-26 10:57 ` Niklas Cassel
2024-07-29 18:43 ` Igor Pylypiv
2024-07-26 3:19 ` [PATCH v6 07/11] ata: sata_sil: Rename sil_blacklist to sil_quirks Damien Le Moal
2024-07-26 11:13 ` Niklas Cassel
2024-07-29 18:44 ` Igor Pylypiv
2024-07-26 3:19 ` [PATCH v6 08/11] ata: ata_piix: Remove useless comment in piix_init_sidpr() Damien Le Moal
2024-07-26 11:13 ` Niklas Cassel
2024-07-29 18:45 ` Igor Pylypiv
2024-07-26 3:19 ` [PATCH v6 09/11] ata: pata_cs5520: Rephrase file header comment Damien Le Moal
2024-07-26 11:13 ` Niklas Cassel
2024-07-29 18:45 ` Igor Pylypiv
2024-07-26 3:19 ` [PATCH v6 10/11] ata: pata_hpt366: Rename hpt_dma_blacklisted() Damien Le Moal
2024-07-26 11:13 ` Niklas Cassel
2024-07-29 18:46 ` Igor Pylypiv
2024-07-26 3:19 ` [PATCH v6 11/11] ata: pata_hpt37x: " Damien Le Moal
2024-07-26 11:13 ` Niklas Cassel
2024-07-29 18:47 ` Igor Pylypiv
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=0f9d26c0-e79e-4913-862a-3df642177415@kernel.org \
--to=dlemoal@kernel.org \
--cc=cassel@kernel.org \
--cc=geert@linux-m68k.org \
--cc=linux-ide@vger.kernel.org \
--cc=linux-renesas-soc@vger.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;
as well as URLs for NNTP newsgroup(s).