Re: [PATCH v2] libata: Fix retrieving of active qcs
From: Jens Axboe
Date: Wed Dec 25 2019 - 19:07:26 EST
On 12/25/19 11:36 AM, Pali RohÃr wrote:
> On Wednesday 25 December 2019 11:26:47 Jens Axboe wrote:
>> On 12/25/19 11:18 AM, Pali RohÃr wrote:
>>> Hello Sascha!
>>>
>>> On Friday 13 December 2019 09:04:08 Sascha Hauer wrote:
>>>> ata_qc_complete_multiple() is called with a mask of the still active
>>>> tags.
>>>>
>>>> mv_sata doesn't have this information directly and instead calculates
>>>> the still active tags from the started tags (ap->qc_active) and the
>>>> finished tags as (ap->qc_active ^ done_mask)
>>>>
>>>> Since 28361c40368 the hw_tag and tag are no longer the same and the
>>>> equation is no longer valid. In ata_exec_internal_sg() ap->qc_active is
>>>> initialized as 1ULL << ATA_TAG_INTERNAL, but in hardware tag 0 is
>>>> started and this will be in done_mask on completion. ap->qc_active ^
>>>> done_mask becomes 0x100000000 ^ 0x1 = 0x100000001 and thus tag 0 used as
>>>> the internal tag will never be reported as completed.
>>>>
>>>> This is fixed by introducing ata_qc_get_active() which returns the
>>>> active hardware tags and calling it where appropriate.
>>>>
>>>> This is tested on mv_sata, but sata_fsl and sata_nv suffer from the same
>>>> problem. There is another case in sata_nv that most likely needs fixing
>>>> as well, but this looks a little different, so I wasn't confident enough
>>>> to change that.
>>>
>>> I can confirm that sata_nv.ko does not work in 4.18 (and new) kernel
>>> version correctly. More details are in email:
>>>
>>> 20191225180824.bql2o5whougii4ch@pali/T/">https://lore.kernel.org/linux-ide/20191225180824.bql2o5whougii4ch@pali/T/
>>>
>>> I tried this patch and it fixed above problems with sata_nv.ko. It just
>>> needs small modification (see below).
>>>
>>> So you can add my:
>>>
>>> Tested-by: Pali RohÃr <pali.rohar@xxxxxxxxx>
>>>
>>> And I hope that patch would be backported to 4.18 and 4.19 stable
>>> branches soon as distributions kernels are broken for machines with
>>> these nvidia sata controllers.
>>>
>>> Anyway, what is that another case in sata_nv which needs to be fixed
>>> too?
>>
>> Thanks for testing, I've applied this for 5.5 and marked it for stable.
>
> It is this one?
> https://git.kernel.dk/cgit/linux-block/commit/?h=libata-5.5&id=d80f359d0ebddb3ab3e9cc3fe96f244827ae7b09
>
> Because there is missing EXPORT_SYMBOL_GPL for ata_qc_get_active()
> function as I wrote in previous email.
I missed that, I'll add it. Thanks!
--
Jens Axboe