Received: by 2002:a05:6a10:83d0:0:0:0:0 with SMTP id o16csp34549pxh; Thu, 7 Apr 2022 13:09:42 -0700 (PDT) X-Google-Smtp-Source: ABdhPJxlpqIUA42BBnjSvZOLH5ld7LDgSBxaB3eqY4AQysDPKYg0bUpEUXT3lUE+1Yxah/iHhatU X-Received: by 2002:a17:903:2309:b0:156:137b:8ba5 with SMTP id d9-20020a170903230900b00156137b8ba5mr16343493plh.84.1649362182718; Thu, 07 Apr 2022 13:09:42 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1649362182; cv=none; d=google.com; s=arc-20160816; b=ECZRJj9V1R3ZRL0DRrMFQbO6dcV8g/dsZGjJl0z/TqjjDKKWq5H4NyVoelcuPTYuO+ ColopDCj2coDCaHP4vUzb9fdbTcuk54csuS2nXVY6lFTcwoMzDTOZhuhENVsDVRYTRlM /eCrAgWdxnNVNoSJD7YXWa7IcjreQZ9vzBjQggZIM447Mzo+j2QluaJHzGUMhR6z1bTU K/vKcy/Gw+pVU6Mb91jV+v5H6IN3UoVga+xPOdJEj+z9yTDen0FaqIgXDlmOLWv76NjM 35uBrV3lunb7iGyjyPoo8aBA/Eyx80HLlX+/BB945OLkW52m+bvXL45m9L13gROPqI6O caTQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:in-reply-to:references :cc:to:subject:from:user-agent:mime-version:date:message-id; bh=8Q/YYN8adHEeYnNQQEOfB2yb18KuHXjhewuGbFXqnE4=; b=IOdIG+bBVhZuTY3ih7PVJpcRQA0L870+irH0YcoSKph+CrkHrpWKTpHJj9Yk7N5h0Y 4J2kCHuNFtEZgkssZ6WlLGJG4zVnHNPCNt7teGnRXcOFGYB2e6lNbxKXKKCU1ojM6N0q S2JfPVYEkNLL0qdaWnyvP4duOh4q0tbaA1pvhXEJnCEg58RVlKSV6/UdHCkT1kDEuyjN 0P1Zu9WaOVr8olNOEQGV3oINvxLgUgJXkWLzwYZl2TDWea1nbp7xEIPltnu/LsigQCg7 Qku8L+sNidAj1tyHxSazWVP5lQKYAxYv204AVrawjkjvlJ2KDex1PYA1YaTtvC33YArS UwkQ== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=QUARANTINE sp=QUARANTINE dis=NONE) header.from=huawei.com Return-Path: Received: from lindbergh.monkeyblade.net (lindbergh.monkeyblade.net. [2620:137:e000::1:18]) by mx.google.com with ESMTPS id s12-20020a056a00178c00b004fa744877dasi22154711pfg.39.2022.04.07.13.09.42 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 07 Apr 2022 13:09:42 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:18 as permitted sender) client-ip=2620:137:e000::1:18; Authentication-Results: mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=QUARANTINE sp=QUARANTINE dis=NONE) header.from=huawei.com Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by lindbergh.monkeyblade.net (Postfix) with ESMTP id 215712B81BC; Thu, 7 Apr 2022 12:32:40 -0700 (PDT) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1343977AbiDGOe0 (ORCPT + 99 others); Thu, 7 Apr 2022 10:34:26 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:49170 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1344006AbiDGOeW (ORCPT ); Thu, 7 Apr 2022 10:34:22 -0400 Received: from frasgout.his.huawei.com (frasgout.his.huawei.com [185.176.79.56]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 9688D198526; Thu, 7 Apr 2022 07:32:12 -0700 (PDT) Received: from fraeml707-chm.china.huawei.com (unknown [172.18.147.226]) by frasgout.his.huawei.com (SkyGuard) with ESMTP id 4KZ3gw30svz681Z4; Thu, 7 Apr 2022 22:30:20 +0800 (CST) Received: from lhreml724-chm.china.huawei.com (10.201.108.75) by fraeml707-chm.china.huawei.com (10.206.15.35) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2375.24; Thu, 7 Apr 2022 16:32:10 +0200 Received: from [10.47.80.129] (10.47.80.129) by lhreml724-chm.china.huawei.com (10.201.108.75) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2375.24; Thu, 7 Apr 2022 15:32:09 +0100 Message-ID: <3e1914a8-5f6b-8fcf-7fb3-2d1edb9766e1@huawei.com> Date: Thu, 7 Apr 2022 15:32:07 +0100 MIME-Version: 1.0 User-Agent: Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:91.0) Gecko/20100101 Thunderbird/91.6.1 From: John Garry Subject: Re: [PATCH 03/11] libata: Send internal commands through the block layer To: Christoph Hellwig CC: , , , , , , , , , , , , , References: <1647945585-197349-1-git-send-email-john.garry@huawei.com> <1647945585-197349-4-git-send-email-john.garry@huawei.com> <20220322112057.GC29270@lst.de> In-Reply-To: <20220322112057.GC29270@lst.de> Content-Type: text/plain; charset="UTF-8"; format=flowed Content-Transfer-Encoding: 7bit X-Originating-IP: [10.47.80.129] X-ClientProxiedBy: lhreml728-chm.china.huawei.com (10.201.108.79) To lhreml724-chm.china.huawei.com (10.201.108.75) X-CFilter-Loop: Reflected X-Spam-Status: No, score=-4.7 required=5.0 tests=BAYES_00, HEADER_FROM_DIFFERENT_DOMAINS,MAILING_LIST_MULTI,NICE_REPLY_A, RDNS_NONE,SPF_HELO_NONE,T_SCC_BODY_TEXT_LINE autolearn=unavailable autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On 22/03/2022 11:20, Christoph Hellwig wrote: > On Tue, Mar 22, 2022 at 06:39:37PM +0800, John Garry wrote: >> When SCSI HBA device drivers are required to process an ATA internal >> command they still need a tag for the IO. This often requires the driver >> to set aside a set of tags for these sorts of IOs and manage the tags >> themselves. >> >> If we associate a SCSI command (and request) with an ATA internal command >> then the tag is already provided, so introduce the change to send ATA >> internal commands through the block layer with a set of custom blk-mq ops. >> >> note: I think that the timeout handling needs to be fixed up. Hi Christoph, > Any reason to not just send them through an ATA_16 passthrough CDB and > just use all the normal SCSI command handling? I had a go at implementing this but I have come up against a few issues: - ATA_16 handling translates the passthrough CDB to a ATA TF. However ata_exec_internal_sg() is passed a TF already. So what to do? Change the callers to generate a ATA_16 CDB? I guess not. Otherwise we could put the already-generated TF in the SCSI cmd CDB somehow and use directly. - We may have no SCSI device (yet) for the target when issuing an internal command, but only the ATA port+dev. So need a method to pass these pointers to ATA_16 handling - we would need to change ata_scsi_translate(), ata_scsi_pass_thru() and other friends to deal with ATA_TAG_INTERNAL and its peculiarities - today it just deals with regular qc's. It still does seem a reasonable idea to use ATA_16, but it looks like significant modifications would be required.... Thanks, John