Received: by 2002:a05:6358:d09b:b0:dc:cd0c:909e with SMTP id jc27csp1506384rwb; Mon, 7 Nov 2022 02:23:42 -0800 (PST) X-Google-Smtp-Source: AMsMyM6AuA5Y8+TmOBqRf0VNrilItYtf+PX2GGtvnmhaOeqaHGhFF94pfrSaHZT//JgwseaclRru X-Received: by 2002:aa7:d710:0:b0:463:bd7b:2b44 with SMTP id t16-20020aa7d710000000b00463bd7b2b44mr33463188edq.385.1667816622156; Mon, 07 Nov 2022 02:23:42 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1667816622; cv=none; d=google.com; s=arc-20160816; b=wm2FkaoIP6XyN3WDAHM9rxihdNp1RMApHCroHRNZplqw8qK025UCz4CcSCFEbcoFOd 7GWX3VGRTp4XzN9SkTQBHqPOAW4QpIP+TRdp+5bt8Xa2cnoyJVGTT4wckmI35/8/wUcy DXDmzplEXiHzRnJRAxpbMekDTiTg/d+IHMrzPGmjOOS9LoWGoa7nRmVYSxmI4ydLeLQw BG8XCfxgZykcobnulMQXvEQx593KUajSxvw0a2ipqMihXQYLgj7U1vEx5R6MvrJP5/Q5 9Dh3S1GsMfM3FS72txzBjtKwuqPJkcFwAl/NkW4oEEQXk/ynQ1MgIr8UtYmwJuPBf3UO AdVA== 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:subject :from:content-language:references:cc:to:user-agent:mime-version:date :message-id:dkim-signature:dkim-signature; bh=ZLvhz3ELkFvg4pJU2+R5NKKqsKnBAtaL/3kPZVxAp30=; b=kwT1953fW9ZHDKbGPZgl4uRZNGRSLExHSOXGOl0Y74Om9ZDvNEUChErDciaS7WnBm1 UdPm4dmyB8OiJ5JZGvU4hdcdyhg66sbE9QZcs7kd59NYpkELj2vTRgqf7ibeTciqldD5 zv+giug6mv/fPLBo/J+usj8PE7LrLYlmguBghsNQ0Hy9YPs9MS+8vEbvyu3bzj5lIXNx QuwxKhKgLCH6uksf9QVyYJNMc/HiBupMDQiefx2bzKJC/R8Bs/ExpkqtXOAaswiCfrVT wvZ62FHPSvrxjSYJq+MFG9Zv/3ZuGtx8J+Ag48apBbxlTcwSbkvH1PtQqTIENssHpH8o f8rA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@suse.de header.s=susede2_rsa header.b=lAZxXxps; dkim=neutral (no key) header.i=@suse.de header.s=susede2_ed25519; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=suse.de Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id b18-20020a056402351200b00460346c1763si9488677edd.449.2022.11.07.02.23.19; Mon, 07 Nov 2022 02:23:42 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@suse.de header.s=susede2_rsa header.b=lAZxXxps; dkim=neutral (no key) header.i=@suse.de header.s=susede2_ed25519; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=suse.de Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S231214AbiKGKM6 (ORCPT + 94 others); Mon, 7 Nov 2022 05:12:58 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:57914 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229530AbiKGKM4 (ORCPT ); Mon, 7 Nov 2022 05:12:56 -0500 Received: from smtp-out2.suse.de (smtp-out2.suse.de [195.135.220.29]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 8A9FA2BC; Mon, 7 Nov 2022 02:12:54 -0800 (PST) Received: from imap2.suse-dmz.suse.de (imap2.suse-dmz.suse.de [192.168.254.74]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature ECDSA (P-521) server-digest SHA512) (No client certificate requested) by smtp-out2.suse.de (Postfix) with ESMTPS id 2C2A91F88B; Mon, 7 Nov 2022 10:12:53 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=suse.de; s=susede2_rsa; t=1667815973; h=from:from:reply-to:date:date:message-id:message-id:to:to:cc:cc: mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=ZLvhz3ELkFvg4pJU2+R5NKKqsKnBAtaL/3kPZVxAp30=; b=lAZxXxpsoLLorzuWwUADkrbbozhkMX93mi/tu9UJmE4RyoSuNlvP4mbuaykdDu8nsucBHb YnlBXjz5jYwNiTgcA4LXU6BmT+axQS8QJUwLx4FRNOUy68c6SIXNI5Muao+cbTxyGdSxoY r+kMIm1k/3m/VxecoaMVgPc//CJ0Xbw= DKIM-Signature: v=1; a=ed25519-sha256; c=relaxed/relaxed; d=suse.de; s=susede2_ed25519; t=1667815973; h=from:from:reply-to:date:date:message-id:message-id:to:to:cc:cc: mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=ZLvhz3ELkFvg4pJU2+R5NKKqsKnBAtaL/3kPZVxAp30=; b=7Nlzvt3donEftG338hrtk0FQhvnN4c8wrDJPI2neGsIZX/lwoqKHfBOdnIKEzXDQRkavdu PVBiAUrk/YQbAmDQ== Received: from imap2.suse-dmz.suse.de (imap2.suse-dmz.suse.de [192.168.254.74]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature ECDSA (P-521) server-digest SHA512) (No client certificate requested) by imap2.suse-dmz.suse.de (Postfix) with ESMTPS id EF16913AC7; Mon, 7 Nov 2022 10:12:52 +0000 (UTC) Received: from dovecot-director2.suse.de ([192.168.254.65]) by imap2.suse-dmz.suse.de with ESMTPSA id ZVccOiTaaGOgZwAAMHmgww (envelope-from ); Mon, 07 Nov 2022 10:12:52 +0000 Message-ID: <75aea0e8-4fa4-593c-0024-3c39ac3882f3@suse.de> Date: Mon, 7 Nov 2022 11:12:52 +0100 MIME-Version: 1.0 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:102.0) Gecko/20100101 Thunderbird/102.4.0 To: Damien Le Moal , John Garry , John Garry , jejb@linux.ibm.com, martin.petersen@oracle.com, bvanassche@acm.org, hch@lst.de, ming.lei@redhat.com, niklas.cassel@wdc.com Cc: axboe@kernel.dk, jinpu.wang@cloud.ionos.com, linux-block@vger.kernel.org, linux-kernel@vger.kernel.org, linux-ide@vger.kernel.org, linux-scsi@vger.kernel.org, linuxarm@huawei.com, john.garry2@mail.dcu.ie References: <1666693976-181094-1-git-send-email-john.garry@huawei.com> <1666693976-181094-3-git-send-email-john.garry@huawei.com> <08fdb698-0df3-7bc8-e6af-7d13cc96acfa@opensource.wdc.com> <83d9dc82-ea37-4a3c-7e67-1c097f777767@huawei.com> <9a2f30cc-d0e9-b454-d7cd-1b0bd3cf0bb9@opensource.wdc.com> <0e60fab5-8a76-9b7e-08cf-fb791e01ae08@huawei.com> <71b56949-e4d7-fd94-c44a-867080b7a4fa@opensource.wdc.com> <0e4994f7-f131-39b0-c876-f447b71566cd@opensource.wdc.com> <05cf6d61-987b-025d-b694-a58981226b97@oracle.com> <39f9afc5-9aab-6f7c-b67a-e74e694543d4@suse.de> <0de1c3fd-4be7-1690-0780-720505c3692b@opensource.wdc.com> Content-Language: en-US From: Hannes Reinecke Subject: Re: [PATCH RFC v3 2/7] ata: libata-scsi: Add ata_internal_queuecommand() In-Reply-To: <0de1c3fd-4be7-1690-0780-720505c3692b@opensource.wdc.com> Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 8bit X-Spam-Status: No, score=-4.4 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,NICE_REPLY_A,RCVD_IN_DNSWL_MED, SPF_HELO_NONE,SPF_PASS autolearn=ham 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 11/2/22 12:25, Damien Le Moal wrote: > On 11/2/22 20:12, Hannes Reinecke wrote: >> On 11/2/22 11:07, Damien Le Moal wrote: >>> On 11/2/22 18:52, John Garry wrote: >>>> Hi Damien, >>>> >> [ .. ] >> So we only need to find a way of 're-using' that tag, then we won't have >> to set aside a reserved tag and everything would be dandy... > > I tried that. It is very ugly... Problem is that integration with EH in > case a real NCQ error happens when all that read-log-complete dance is > happening is hard. And don't get me started with the need to save/restore > the scsi command context of the command we are reusing the tag from. > > And given that the code is changing to use regular submission path for > internal commands, right now, we need a reserved tag. Or a way to "borrow" > the tag from a request that we need to check. Which means we need some > additional api to not always try to allocate a tag. > >> >> Maybe we can stop processing when we receive an error (should be doing >> that anyway as otherwise the log might be overwritten), then we should >> be having a pretty good chance of getting that tag. > > Hmmm.... that would be no better than using EH which does stop processing > until the internal house keeping is done. > >> Or, precisely, getting _any_ tag as at least one tag is free at that point. >> Hmm? > > See above. Not free, but usable as far as the device is concerned since we > have at least on command we need to check completed at the device level > (but not yet completed from scsi/block layer point of view). > So, having had an entire weekend pondering this issue why don't we allocate an _additional_ set of requests? After all, we had been very generous with allocating queues and requests (what with us doing a full provisioning of the requests for all queues already for the non-shared tag case). Idea would be to keep the single tag bitmap, but add eg a new rq state MQ_RQ_ERROR. Once that flag is set we'll fetch the error request instead of the normal one: @@ -761,6 +763,8 @@ static inline struct request *blk_mq_tag_to_rq(struct blk_mq_tags *tags, { if (tag < tags->nr_tags) { prefetch(tags->rqs[tag]); + if (unlikely(blk_mq_request_error(tags->rqs[tag]))) + return tags->error_rqs[tag]; return tags->rqs[tag]; } and, of course, we would need to provision the error request first. Rationale here is that this will be primarily for devices with a low number of tags, so doubling the number of request isn't much of an overhead (as we'll be doing it essentially anyway in the error case as we'll have to save the original request _somewhere_), and that it would remove quite some cruft from the subsystem; look at SCSI EH trying to store the original request contents and then after EH restoring them again. Hmm? Cheers, Hannes -- Dr. Hannes Reinecke Kernel Storage Architect hare@suse.de +49 911 74053 688 SUSE Software Solutions Germany GmbH, Maxfeldstr. 5, 90409 Nürnberg HRB 36809 (AG Nürnberg), GF: Felix Imendörffer