Received: by 2002:a25:8b91:0:0:0:0:0 with SMTP id j17csp538379ybl; Fri, 13 Dec 2019 00:06:30 -0800 (PST) X-Google-Smtp-Source: APXvYqxwWsfr7oVQiareEK/x3FYQOhaMCsV8z/MkQk5ijUuefv4DfrVxOxA0bLylF2ibXDyLOlUu X-Received: by 2002:a9d:12ea:: with SMTP id g97mr13627171otg.105.1576224390537; Fri, 13 Dec 2019 00:06:30 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1576224390; cv=none; d=google.com; s=arc-20160816; b=e4sIfxwSUDzs9ocVgoXuqqW8IH4JO8IQPn2xzxd/99qamrccgqRihj6gWFkDpz+8CO VyIVTP/GsovrnNlVyucyrOuBbrSoBezmW1pEoQXAm2U3N5xacu5JVXgOhAXjbabG9dCC swDd5ZP28i+nCOKm5/eKnOkRnYTeJPYoiOB1vgg4nhvKAQq9WofvV9ZVDTw4nEaG3xhq tuFKV/KjNLJYxOYDE2T+bjAahdcyaxqrfwE6Kp//2N0N9fOfqPPDO9JXNnt/DPnKy5DA P71RWVF5DmNgb4km3Pjmfg4FbV/7ojQcZyqJA5OsupegYxVi8Cz9vDAT0RNEL6//BnfV rp0g== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:user-agent:in-reply-to :content-disposition:mime-version:references:message-id:subject:cc :to:from:date; bh=AJVohk0Qr5gFkpYgGeBFIaNLfnH8yGgNbbcA4gRNeMs=; b=oYcnB6Jmc16eYp4cmGfRXfFU7Hhj+O1BFErTGtkZVF/D7G2M4YxmWtI1aNw0N2vcmT 1UqhjibaDImT4K73z1Nlvd5s4dJmD9xEITql1ql+8m+7GmAyK+pJf2AFYM6tp2W+KsX5 8ef6X+dLH3JMhVWkqUqRCqvFt58zugdj8VeQflKv0hKdJHr8QYTOX1oOAQElaJFTDFjR uVXDW4jkVkC0fBLrFe4ZEs8SEz8tZGoSk1OFbfQrEVXAay2L42eH/E+flgGWn9XuNgol 5embARJE4PqTGNntoCRp9r8BKBFKjFh/kNMQXb3lmbLc1wEcNweV0iOppVViLBBveVVi hKfg== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id r65si4726519oig.69.2019.12.13.00.06.18; Fri, 13 Dec 2019 00:06:30 -0800 (PST) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726492AbfLMIFL (ORCPT + 99 others); Fri, 13 Dec 2019 03:05:11 -0500 Received: from metis.ext.pengutronix.de ([85.220.165.71]:36751 "EHLO metis.ext.pengutronix.de" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1725890AbfLMIFK (ORCPT ); Fri, 13 Dec 2019 03:05:10 -0500 Received: from ptx.hi.pengutronix.de ([2001:67c:670:100:1d::c0]) by metis.ext.pengutronix.de with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1iffwj-0002Dt-9O; Fri, 13 Dec 2019 09:05:09 +0100 Received: from sha by ptx.hi.pengutronix.de with local (Exim 4.89) (envelope-from ) id 1iffwi-0008Gn-Vs; Fri, 13 Dec 2019 09:05:08 +0100 Date: Fri, 13 Dec 2019 09:05:08 +0100 From: Sascha Hauer To: linux-ide@vger.kernel.org Cc: Jens Axboe , linux-kernel@vger.kernel.org, kernel@pengutronix.de Subject: Re: [PATCH] libata: Fix retrieving of active qcs Message-ID: <20191213080508.if5yxhtyl27nej5z@pengutronix.de> References: <20191213080334.26922-1-s.hauer@pengutronix.de> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20191213080334.26922-1-s.hauer@pengutronix.de> X-Sent-From: Pengutronix Hildesheim X-URL: http://www.pengutronix.de/ X-IRC: #ptxdist @freenode X-Accept-Language: de,en X-Accept-Content-Type: text/plain X-Uptime: 09:04:26 up 158 days, 14:14, 54 users, load average: 0.26, 0.30, 0.18 User-Agent: NeoMutt/20170113 (1.7.2) X-SA-Exim-Connect-IP: 2001:67c:670:100:1d::c0 X-SA-Exim-Mail-From: sha@pengutronix.de X-SA-Exim-Scanned: No (on metis.ext.pengutronix.de); SAEximRunCond expanded to false X-PTX-Original-Recipient: linux-kernel@vger.kernel.org Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Fri, Dec 13, 2019 at 09:03:34AM +0100, 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. > > Fixes: 28361c403683 ("libata: add extra internal command") > Signed-off-by: Sascha Hauer > --- Ignore this, it lacks the v2 tag :-/ Sascha -- Pengutronix e.K. | | Steuerwalder Str. 21 | http://www.pengutronix.de/ | 31137 Hildesheim, Germany | Phone: +49-5121-206917-0 | Amtsgericht Hildesheim, HRA 2686 | Fax: +49-5121-206917-5555 |