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 X-Spam-Level: X-Spam-Status: No, score=-2.2 required=3.0 tests=DKIM_SIGNED,DKIM_VALID, HEADER_FROM_DIFFERENT_DOMAINS,MAILING_LIST_MULTI,SPF_HELO_NONE,SPF_PASS, USER_AGENT_SANE_1 autolearn=no autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 76BF9C2D0C8 for ; Wed, 25 Dec 2019 18:26:51 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id 4A2962072A for ; Wed, 25 Dec 2019 18:26:51 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (2048-bit key) header.d=kernel-dk.20150623.gappssmtp.com header.i=@kernel-dk.20150623.gappssmtp.com header.b="ky9gPXYe" Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726353AbfLYS0u (ORCPT ); Wed, 25 Dec 2019 13:26:50 -0500 Received: from mail-pj1-f68.google.com ([209.85.216.68]:35778 "EHLO mail-pj1-f68.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726399AbfLYS0u (ORCPT ); Wed, 25 Dec 2019 13:26:50 -0500 Received: by mail-pj1-f68.google.com with SMTP id s7so2558531pjc.0 for ; Wed, 25 Dec 2019 10:26:50 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=kernel-dk.20150623.gappssmtp.com; s=20150623; h=subject:to:cc:references:from:message-id:date:user-agent :mime-version:in-reply-to:content-language:content-transfer-encoding; bh=cJYp9ftX998bOD2V8Vxk7qy7RjelI9Sr1IIEWlQTCXQ=; b=ky9gPXYeEpV+D3g7hOpEEvUPYTARCflLE+a5L1hDI3yIVTtN168Dcea1lIZf2xFI5R WK0UExCzY5Iay0lfVz9dRmMnYY4JMTRUrybskWcQ5UgQLlg+zNiHBRL9fTsgSt6hL2Tg ZZGaR2LaJFs0GVsNc10fSCvjpYZwxUc13UMu7lTubusA0o5/+ZDK/xGiNTdRvBc+sZ2V r8u2q/O8CF/UbNI2fSwTyl+AQhV8WNhuBJGusFjknPV8hN2kngHl3yodff5OS71xNGt4 RflsCZcI4neH3y1guWJ9C/HgdOjly1EeDWZTasbJabNYZuhvLmVqA9sh+lm6esuhM2Kd w4Eg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:subject:to:cc:references:from:message-id:date :user-agent:mime-version:in-reply-to:content-language :content-transfer-encoding; bh=cJYp9ftX998bOD2V8Vxk7qy7RjelI9Sr1IIEWlQTCXQ=; b=YPupw5NARxjV8hm7HY+a8nIv8BrxsUthVIUhdUHQpkSPZwHaFZeh84UFchxsFFwBan qI+V/KnDZVCo8ifpCZRwgJqtAhpW7VWLCEgt5Nl/Ux0Yq7zdEf6mnxPzQZFwaSn14N0k Ii8zl3bKgJPgfvPetyMYusgbkKFXNrszNB2B9bCG57t9mAeWQTYt5orwsULg1ymllVpl /wluHIupXP/KBHhwb2EVaAbvGmqgZ8ghH0p9lJes6Z5PJMDpjKERm2uUcaMOT4444UIR czLy9wwpJ7CuKT+Rdlt2s153bK2UPx/N+YA6O0S8tLjLW4I2M88Nlolb2d6EsWIRbBb7 BqzQ== X-Gm-Message-State: APjAAAX+fpP3KytSB0vyqgjyWgUUvcfqm7peSX1um/a94Cc+ssbFSdhy gvi4FaBZ4YfFi20hg60sFInOcg== X-Google-Smtp-Source: APXvYqzijgi1D01D1/dSwpZ9J8vTDYBdT1hbIGKMwddZwSbvzIQB32QEQRokAuC8+dyI74K6J6t4Ug== X-Received: by 2002:a17:90a:ad48:: with SMTP id w8mr14422989pjv.19.1577298409752; Wed, 25 Dec 2019 10:26:49 -0800 (PST) Received: from [192.168.1.188] ([66.219.217.145]) by smtp.gmail.com with ESMTPSA id i23sm12227476pfo.11.2019.12.25.10.26.48 (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Wed, 25 Dec 2019 10:26:49 -0800 (PST) Subject: Re: [PATCH v2] libata: Fix retrieving of active qcs To: =?UTF-8?Q?Pali_Roh=c3=a1r?= , Sascha Hauer Cc: linux-ide@vger.kernel.org, linux-kernel@vger.kernel.org, kernel@pengutronix.de References: <20191213080408.27032-1-s.hauer@pengutronix.de> <20191225181840.ooo6mw5rffghbmu2@pali> From: Jens Axboe Message-ID: Date: Wed, 25 Dec 2019 11:26:47 -0700 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:68.0) Gecko/20100101 Thunderbird/68.2.2 MIME-Version: 1.0 In-Reply-To: <20191225181840.ooo6mw5rffghbmu2@pali> Content-Type: text/plain; charset=utf-8 Content-Language: en-US Content-Transfer-Encoding: 8bit Sender: linux-ide-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-ide@vger.kernel.org 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: > > 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 > > 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. -- Jens Axboe