Received: by 2002:a05:6359:c8b:b0:c7:702f:21d4 with SMTP id go11csp158407rwb; Tue, 4 Oct 2022 02:03:27 -0700 (PDT) X-Google-Smtp-Source: AMsMyM43QedF9xMWp2ZKAkVB9f9ha5tSUZllNSd7XNV0XwwGb6+lovwwe/yHv/+69jsA3BXBrY92 X-Received: by 2002:a17:902:f7c3:b0:17b:6816:242d with SMTP id h3-20020a170902f7c300b0017b6816242dmr24756264plw.107.1664874207536; Tue, 04 Oct 2022 02:03:27 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1664874207; cv=none; d=google.com; s=arc-20160816; b=SvN2bP8k6vEalUU5+ke6bQJbbb3UOIxJ0zan1QYU6mUUk7SPlb9wf5E1djufz2dhKo uYKwx1Ht7EtfPTaxLVqhRBjn7o7U/umaxN8y+hbDfNQ0dN7iH8yUiMkwizqRyw/+7sJJ 6PId7Ah4fF8Iz+zBvd9zEhSwFKNmaoVk4vyGZEmN4JwjXVBLJd/EXTnQ+5WVKZnp2fIV wcGDssKiTO4aSPiLEDxCnSM94azif0bI4QJVCfH8MEgzTnNcrqUTsyZax7mgMve2XrAm pWtuI6Pd0iRFAnfmMXS3B3DGs/c7wHs25TBj67Lxt+rNUci0/9h0dug5ZgDuZJ+PnjQW Pzcg== 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:from :references:cc:to:subject:user-agent:mime-version:date:message-id; bh=T2SS7iAy4gHJwUOPXfrHQJUxz92r4GnI8p9vAj7c8v8=; b=wZeNsAZ1maf1xRw9ixlqK6o5f3yOV+gscCX0XNzpxt3pAXRmueQa7gkdh09ytEUsp5 H7BoQUPJ/NTpOh0jlMvcEX9WtY3Emmpl/EWJoypJotDY1axmmi7GGxW+kOkuIzQpeJYE 3PGcimgxkDH3tI/uzQvp+FtomVUCcOBQJYhGMYyvS8B/cygde41gUhumb/6CZRdQKN0+ Tmtk5uILXXNt4gB/8N3VC83AbyWm3K1beJdSc3AGAyv7LlJyKJdm5tvLHcoepYD/hU+w z1BfSwWMO6N8qWfLuWCsxPiiWaPXEzowsKTpquH3eAPWz9ze5T2XmBh6c/HWWh1Ez+dD KK7g== 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:20 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 out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id k13-20020a170902d58d00b0017affa7cff0si1049345plh.129.2022.10.04.02.03.09; Tue, 04 Oct 2022 02:03:27 -0700 (PDT) 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; 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=fail (p=QUARANTINE sp=QUARANTINE dis=NONE) header.from=huawei.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S229720AbiJDHhG (ORCPT + 99 others); Tue, 4 Oct 2022 03:37:06 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:33744 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229556AbiJDHhF (ORCPT ); Tue, 4 Oct 2022 03:37:05 -0400 Received: from frasgout.his.huawei.com (frasgout.his.huawei.com [185.176.79.56]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 4F75A41984; Tue, 4 Oct 2022 00:37:01 -0700 (PDT) Received: from fraeml706-chm.china.huawei.com (unknown [172.18.147.206]) by frasgout.his.huawei.com (SkyGuard) with ESMTP id 4MhTx63z1Nz67PH4; Tue, 4 Oct 2022 15:34:34 +0800 (CST) Received: from lhrpeml500003.china.huawei.com (7.191.162.67) by fraeml706-chm.china.huawei.com (10.206.15.55) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_CBC_SHA256_P256) id 15.1.2375.31; Tue, 4 Oct 2022 09:36:58 +0200 Received: from [10.48.156.84] (10.48.156.84) by lhrpeml500003.china.huawei.com (7.191.162.67) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2375.31; Tue, 4 Oct 2022 08:36:57 +0100 Message-ID: <9e405f1d-621e-d1f7-55c5-21ba5c8a85a8@huawei.com> Date: Tue, 4 Oct 2022 08:37:06 +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 Subject: Re: [PATCH v2 4/6] scsi: pm8001: Use sas_task_find_rq() for tagging To: Hannes Reinecke , , , , CC: , , , , , , References: <1664528184-162714-1-git-send-email-john.garry@huawei.com> <1664528184-162714-5-git-send-email-john.garry@huawei.com> From: John Garry In-Reply-To: Content-Type: text/plain; charset="UTF-8"; format=flowed Content-Transfer-Encoding: 8bit X-Originating-IP: [10.48.156.84] X-ClientProxiedBy: lhrpeml100006.china.huawei.com (7.191.160.224) To lhrpeml500003.china.huawei.com (7.191.162.67) X-CFilter-Loop: Reflected X-Spam-Status: No, score=-5.7 required=5.0 tests=BAYES_00,NICE_REPLY_A, RCVD_IN_DNSWL_MED,RCVD_IN_MSPIKE_H2,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 04/10/2022 06:53, Hannes Reinecke wrote: >> -    void *bitmap = pm8001_ha->tags; >> +    void *bitmap = pm8001_ha->rsvd_tags; >>       unsigned long flags; >>       unsigned int tag; >>       spin_lock_irqsave(&pm8001_ha->bitmap_lock, flags); >> -    tag = find_first_zero_bit(bitmap, pm8001_ha->tags_num); >> -    if (tag >= pm8001_ha->tags_num) { >> +    tag = find_first_zero_bit(bitmap, PM8001_RESERVE_SLOT); >> +    if (tag >= PM8001_RESERVE_SLOT) { >>           spin_unlock_irqrestore(&pm8001_ha->bitmap_lock, flags); >>           return -SAS_QUEUE_FULL; >>       } >>       __set_bit(tag, bitmap); >>       spin_unlock_irqrestore(&pm8001_ha->bitmap_lock, flags); >> + >> +    /* reserved tags are in the upper region of the tagset */ >> +    tag += pm8001_ha->shost->can_queue; >>       *tag_out = tag; >>       return 0; >>   } > Can you move the reserved tags to the _lower_ region of the tagset? > That way the tag allocation scheme matches with what the block-layer > does, and the eventual conversion to reserved tags becomes easier. Yeah, I agree that having a scheme which matches the block layer would be good for consistency and I will make that change, but I am not sure how it helps conversion to reserved tags. Thanks, John