Received: by 2002:a25:c205:0:0:0:0:0 with SMTP id s5csp409354ybf; Wed, 26 Feb 2020 15:35:05 -0800 (PST) X-Google-Smtp-Source: APXvYqzY+WcKOkjbC9WDJBjgIP0cMsVo+fV7Jp8i8Kw+EmAqEFmerbFGeeQgtWYRTJDqfv483VMO X-Received: by 2002:a9d:750b:: with SMTP id r11mr1098932otk.310.1582760105756; Wed, 26 Feb 2020 15:35:05 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1582760105; cv=none; d=google.com; s=arc-20160816; b=QEVUcO51KOQsWcSx9sS+lcjQ6E0QOTqEc63xA2xBS8Gl93OMaE9kxveRhDTD8UHijq qu2hxm++TMK4lRwmgDiYIWC8YnoMTsnu2xtKno9Z1spn5JQF7S0j4EWAbtyyPiAbEWbk cpDexCOQZ/DSKAsSn04oWH158jkT7bcUtoOkJ5joVUtIZjmokNZ/vBMOKeWtXizevk3R 97KNqUsDcPKg8WMsi+Tmt4E+9ySJVPj/PB7d5XgicLlD/T4F7TZoKYmqwVEeOBSjqIkI SGlmWd1gye2vNCPm9mk1SsCdqDVI+CQnC1GCrA86axuFY2HVEidRGMleDNoa8IsSYGX3 IJeQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:content-transfer-encoding :content-language:in-reply-to:mime-version:user-agent:date :message-id:from:references:cc:to:subject; bh=E9CsIeVCqDRp047URh32XSYQmYRUen+22sX2IooW5EM=; b=IHUpjA0O4/GDbVvDR4jJiSoWY8FAr8MWu8E8LorZQYoAwYvoEi4U7M7DvcpdnIW46I XAbTnlPPd+65VRCrnuuysu6Cn0RxVlDhE85benEdaG6lTVuhS/RjC2gP3/hJ18zy3bty K5EhGCB33l9qu8ZxLoCmzXyAhpQuwYy/Y5PMYEqnZQorQKOlQBO/QfXn+zqbCqK1cDaU QaOOUraV2t7z/VItMtkCtNodzw2VrehVl3mN2GX8Buvb6EMcCz8uOtqjvUHQim3wo7uC uSPyzI4Y9Q+Hg43xSJljfjXcjDHxkIuvU4YPFaz2/FMah7z0NmzZ2Xce76UBQ/GypO2j xvrg== 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 g26si500518otk.324.2020.02.26.15.34.53; Wed, 26 Feb 2020 15:35:05 -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 S1727935AbgBZXeB (ORCPT + 99 others); Wed, 26 Feb 2020 18:34:01 -0500 Received: from mail-ot1-f67.google.com ([209.85.210.67]:42950 "EHLO mail-ot1-f67.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726413AbgBZXeA (ORCPT ); Wed, 26 Feb 2020 18:34:00 -0500 Received: by mail-ot1-f67.google.com with SMTP id 66so1163848otd.9 for ; Wed, 26 Feb 2020 15:33:59 -0800 (PST) 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=E9CsIeVCqDRp047URh32XSYQmYRUen+22sX2IooW5EM=; b=peQl7KYCk5KXyZKaoVdXm9L6355mFgI4gG676D+QMOf3YBJPeqDs/74eNuzjiuj0HR 7EJO+uG/eUUuja2K8+H8boOq8SxxKS2YWnzWdJnGU1VPX0xdoZg/BVbO5GQZfJ63QA3g Zwim5FWHb4v/Dy03uQU74dwiDR1ei9c5WhTkjy6oQGnvHkEmBk2jALqWwVHkaOmikuvg rmQ2FkOP1Hvla1PeSmhLdNhyRmvf0UBWIgvMbW1OxtVnvxwjhP2GxO6r0GoyWPuZ2DXc 3Ikh0kneCX2wtnpTX3QTQXPPXQMsHlcO07V1NxQSnNk5luEEwrdhw25R46UXLpGP9gyY adDQ== X-Gm-Message-State: APjAAAWTXDLln4jnqnMnqwvL+H3J27P08r6+1jrLCcm74NtrYxZRusIj 8b1Cg1qQe1EQ2QzOY4vca+U= X-Received: by 2002:a9d:7a96:: with SMTP id l22mr1017139otn.217.1582760038567; Wed, 26 Feb 2020 15:33:58 -0800 (PST) Received: from ?IPv6:2600:1700:65a0:78e0:514:7862:1503:8e4d? ([2600:1700:65a0:78e0:514:7862:1503:8e4d]) by smtp.gmail.com with ESMTPSA id v14sm1309886oto.16.2020.02.26.15.33.57 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Wed, 26 Feb 2020 15:33:57 -0800 (PST) Subject: Re: [PATCH v11 8/9] nvmet-passthru: Add enable/disable helpers To: Logan Gunthorpe , linux-kernel@vger.kernel.org, linux-nvme@lists.infradead.org Cc: Christoph Hellwig , Keith Busch , Jens Axboe , Chaitanya Kulkarni , Max Gurtovoy , Stephen Bates References: <20200220203652.26734-1-logang@deltatee.com> <20200220203652.26734-9-logang@deltatee.com> From: Sagi Grimberg Message-ID: <96234649-fbc1-fb56-54d8-2f73dc455ffd@grimberg.me> Date: Wed, 26 Feb 2020 15:33:56 -0800 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:60.0) Gecko/20100101 Thunderbird/60.9.0 MIME-Version: 1.0 In-Reply-To: <20200220203652.26734-9-logang@deltatee.com> Content-Type: text/plain; charset=utf-8; format=flowed Content-Language: en-US Content-Transfer-Encoding: 7bit Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org > + if (subsys->ver < NVME_VS(1, 2, 1)) { > + pr_warn("nvme controller version is too old: %d.%d.%d, advertising 1.2.1\n", > + (int)NVME_MAJOR(subsys->ver), > + (int)NVME_MINOR(subsys->ver), > + (int)NVME_TERTIARY(subsys->ver)); > + subsys->ver = NVME_VS(1, 2, 1); Umm.. is this OK? do we implement the mandatory 1.2.1 features on behalf of the passthru device? > + } > + > + mutex_unlock(&subsys->lock); > + return 0; > + > +out_put_ctrl: > + nvme_put_ctrl(ctrl); > +out_unlock: > + mutex_unlock(&subsys->lock); > + return ret; > +} > + > +static void __nvmet_passthru_ctrl_disable(struct nvmet_subsys *subsys) > +{ > + if (subsys->passthru_ctrl) { > + xa_erase(&passthru_subsystems, subsys->passthru_ctrl->cntlid); > + nvme_put_ctrl(subsys->passthru_ctrl); > + } > + subsys->passthru_ctrl = NULL; > + subsys->ver = NVMET_DEFAULT_VS; > +} Isn't it strange that a subsystem changes its version in its lifetime? > + > +void nvmet_passthru_ctrl_disable(struct nvmet_subsys *subsys) > +{ > + mutex_lock(&subsys->lock); > + __nvmet_passthru_ctrl_disable(subsys); > + mutex_unlock(&subsys->lock); > +} > + > +void nvmet_passthru_subsys_free(struct nvmet_subsys *subsys) > +{ > + mutex_lock(&subsys->lock); > + __nvmet_passthru_ctrl_disable(subsys); > + kfree(subsys->passthru_ctrl_path); > + mutex_unlock(&subsys->lock); Nit, any reason why the free is in the mutex?