Received: by 2002:a05:7412:31a9:b0:e2:908c:2ebd with SMTP id et41csp2716281rdb; Tue, 12 Sep 2023 09:55:18 -0700 (PDT) X-Google-Smtp-Source: AGHT+IGQ4PjK2dWkmkMIcNoM+pKwP68YXB1Yd5yldMxYqtaDMSsZUkFOm8U7oT/R6dTI7Nknn4zA X-Received: by 2002:a17:902:b60f:b0:1bd:f401:e68e with SMTP id b15-20020a170902b60f00b001bdf401e68emr393280pls.3.1694537718538; Tue, 12 Sep 2023 09:55:18 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1694537718; cv=none; d=google.com; s=arc-20160816; b=HZWuZ1GlMFCB2rHJNoexJ4CnM6eB/QV5BThJL9HnzWmWOVXgwhZJ1E7FSGwV91dpxt f1J9+x4tc/ztV9CjYRygKDpS+WfxpODMCvnNRnPUqkBnEI0WNpBoZuABcHT2ia+gXXGu LTJ9pFPFethuVBcwlLM7DBZ12mThfay2LkLklWtMFec4rYhF/COY/9ZNmihKhZjtQw5Q 4SM1smmppdFbNWwbR5ujbq7Te2Sm1aMBZTE6x8+Qi8FHZNAKxaXUb0Q5j15nAFDa2akv kMqNTLbZ9vEQ53S3fAkIOsVf8Ufo5Esj6xrrNSNZ0wpFT3CS+FLh930tP74Pcvl26Yzb h6+Q== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :organization:references:in-reply-to:message-id:subject:cc:to:from :date; bh=Iy5nGlQZ9/71Z/fWzlWPxz7NITd2kJngdis/dTpBjEc=; fh=i79Tt2ipKvh8/GSsRZ1MTlY1CHFCCpnrQST/0VLOGd8=; b=eaB5EI+2R+ldTyvE52wL3FcbLBRBdzOznVqaJ2+Er4pnbfx7J8KwndeVvlFSfkkchT a9OlPOgu3gImxz2Tzc8QGfbiqowQprb9onMe6KIHs0pLgiyB5yPMjaPxVwiwLc/80JnG lfkcu1/krZYFTDjBrhib976IBAZzI62CgfXvzXZznh0otrg2C8SKz80fpeCOvGD5vLZm Q13RvZArnw32NqR1pwqueWCz0YxJ4e/CK4OM1ELBkhmEZ9aD8EtlrxRDNfbMyHaCsjll UuXfjaSytOXGTJxYsTTqUB1uKRpbmS+zrb/lLo1I4U/o0lPmK2+UghRudt80HM+hBcpW 7KJw== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:8 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 fry.vger.email (fry.vger.email. [2620:137:e000::3:8]) by mx.google.com with ESMTPS id o24-20020a637318000000b005774c8b658dsi5438252pgc.316.2023.09.12.09.55.18 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 12 Sep 2023 09:55:18 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:8 as permitted sender) client-ip=2620:137:e000::3:8; Authentication-Results: mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:8 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 out1.vger.email (depot.vger.email [IPv6:2620:137:e000::3:0]) by fry.vger.email (Postfix) with ESMTP id 7FE818021EEF; Tue, 12 Sep 2023 09:49:14 -0700 (PDT) X-Virus-Status: Clean X-Virus-Scanned: clamav-milter 0.103.10 at fry.vger.email Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S237062AbjILQtN (ORCPT + 99 others); Tue, 12 Sep 2023 12:49:13 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:37880 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S236062AbjILQtM (ORCPT ); Tue, 12 Sep 2023 12:49:12 -0400 Received: from frasgout.his.huawei.com (frasgout.his.huawei.com [185.176.79.56]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 848C6110; Tue, 12 Sep 2023 09:49:08 -0700 (PDT) Received: from lhrpeml500005.china.huawei.com (unknown [172.18.147.206]) by frasgout.his.huawei.com (SkyGuard) with ESMTP id 4RlV034NmJz67g1D; Wed, 13 Sep 2023 00:48:35 +0800 (CST) Received: from localhost (10.202.227.76) by lhrpeml500005.china.huawei.com (7.191.163.240) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2507.31; Tue, 12 Sep 2023 17:49:05 +0100 Date: Tue, 12 Sep 2023 17:49:04 +0100 From: Jonathan Cameron To: Ira Weiny CC: Dan Williams , Navneet Singh , Fan Ni , Davidlohr Bueso , Dave Jiang , Alison Schofield , Vishal Verma , , Subject: Re: [PATCH RFC v2 14/18] dax/region: Support DAX device creation on dynamic DAX regions Message-ID: <20230912174904.00005fed@Huawei.com> In-Reply-To: <64f80177c2c21_1e8e7829487@iweiny-mobl.notmuch> References: <20230604-dcd-type2-upstream-v2-0-f740c47e7916@intel.com> <20230604-dcd-type2-upstream-v2-14-f740c47e7916@intel.com> <20230830125025.00000fea@Huawei.com> <64f80177c2c21_1e8e7829487@iweiny-mobl.notmuch> Organization: Huawei Technologies Research and Development (UK) Ltd. X-Mailer: Claws Mail 4.1.0 (GTK 3.24.33; x86_64-w64-mingw32) MIME-Version: 1.0 Content-Type: text/plain; charset="US-ASCII" Content-Transfer-Encoding: 7bit X-Originating-IP: [10.202.227.76] X-ClientProxiedBy: lhrpeml100001.china.huawei.com (7.191.160.183) To lhrpeml500005.china.huawei.com (7.191.163.240) X-CFilter-Loop: Reflected Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-Greylist: Sender passed SPF test, not delayed by milter-greylist-4.6.4 (fry.vger.email [0.0.0.0]); Tue, 12 Sep 2023 09:49:14 -0700 (PDT) X-Spam-Status: No, score=-0.8 required=5.0 tests=HEADER_FROM_DIFFERENT_DOMAINS, MAILING_LIST_MULTI,SPF_HELO_NONE,SPF_PASS autolearn=unavailable autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on fry.vger.email On Tue, 5 Sep 2023 21:35:03 -0700 Ira Weiny wrote: > Jonathan Cameron wrote: > > On Mon, 28 Aug 2023 22:21:05 -0700 > > Ira Weiny wrote: > > > > > Dynamic Capacity (DC) DAX regions have a list of extents which define > > > the memory of the region which is available. > > > > > > Now that DAX region extents are fully realized support DAX device > > > creation on dynamic regions by adjusting the allocation algorithms > > > to account for the extents. Remember also references must be held on > > > the extents until the DAX devices are done with the memory. > > > > > > Redefine the region available size to include only extent space. Reuse > > > the size allocation algorithm by defining sub-resources for each extent > > > and limiting range allocation to those extents which have space. Do not > > > support direct mapping of DAX devices on dynamic devices. > > > > > > Enhance DAX device range objects to hold references on the extents until > > > the DAX device is destroyed. > > > > > > NOTE: At this time all extents within a region are created equally. > > > However, labels are associated with extents which can be used with > > > future DAX device labels to group which extents are used. > > > > This sound like a bad place to start to me as we are enabling something > > that is probably 'wrong' in the long term as opposed to just not enabling it > > until we have appropriate support. > > I disagree. I don't think the kernel should be trying to process tags at > the lower level. > > > I'd argue better to just reject any extents with different labels for now. > > Again I disagree. This is less restrictive. The idea is that labels can > be changed such that user space can ultimately decided which extents > should be used for which devices. I have some work on that already. > (Basically it becomes quite easy to assign a label to a dax device and > have the extent search use only dax extents which match that label.) That sounds good - but if someone expects that and uses it with an old kernel I'm not sure if it is better to say 'we don't support it yet' or do something different from a newer kernel. > > > @@ -1400,8 +1507,10 @@ struct dev_dax *devm_create_dev_dax(struct dev_dax_data *data) > > > device_initialize(dev); > > > dev_set_name(dev, "dax%d.%d", dax_region->id, dev_dax->id); > > > > > > + dev_WARN_ONCE(parent, is_dynamic(dax_region) && data->size, > > > + "Dynamic DAX devices are created initially with 0 size"); > > > > dev_info() maybe more appropriate? > > Unless I'm mistaken this can happen from userspace but only if something > in the code changes later. Because the dax layer is trying to support > non-dynamic regions (which dynamic may be a bad name), I was worried that > the creation with a size might slip through... Fair enough - if strong chance userspace will control it at somepoitn then ONCE seems fine. > > > Is this common enough that we need the > > _ONCE? > > once is because it could end up spamming a log later if something got > coded up wrong. I'm not sure I care about bugs spamming the log. Only things that are userspace controlled or likely hardware failures etc.