Received: by 2002:a05:7412:d8a:b0:e2:908c:2ebd with SMTP id b10csp2950493rdg; Mon, 16 Oct 2023 22:57:07 -0700 (PDT) X-Google-Smtp-Source: AGHT+IFtWOJvt7zmInwREJbsvQc81e4euw6jtEduU7rEKP1WCo/uuCj7ANLeP1c/d1S4l+WaASwQ X-Received: by 2002:a67:cc01:0:b0:457:cd64:595a with SMTP id q1-20020a67cc01000000b00457cd64595amr1374735vsl.32.1697522226681; Mon, 16 Oct 2023 22:57:06 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1697522226; cv=none; d=google.com; s=arc-20160816; b=qH71z5QNNyrYuZJja9KEPulyns6vSBMEh7R/DN3Prt8VDz80oK4DxWnloOuAWHKi0F F4fVoBEF1t3ZdSTBquKx3n/4JW8bfSMsMyiMlMEnln2Zd61re9hLk7eXqB8TL4Oy7ubC yrs/ndEotbCmg+gc1zBPZqoNVSXji3qrD50mHi5cXLRpkLAA1hbkPuAdDV1k2m5HzhZd xBa4uVBydUdP3/pHdaTtF3GO370K5fJq5OWBfGTN4K1OnlQQ9jhXQYjbmjUOJ5XkxCfU ObJVksFA1QXOEg9G071wPINM7z9y0VIB8UmCjgS9At8EHCAP7aGIB0CE842zXEMBlux8 TAvg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:mime-version:user-agent:message-id:date :references:in-reply-to:subject:cc:to:from:dkim-signature; bh=14AddXzDw+P6+ePdNaxRA2p+tMwqUMvBtiPOlup42Yk=; fh=uowxGOGHOe20Q5MsLrqehyYPjOkgMR9Wb0gq0sGHlUc=; b=atmeiU2uVpn2KLDSsSBhmQ2ArrB/3yCJtwwy4NRDhjHrymlB8S3G0A6rTtVYQOR31i M33LEni2cibMvY2lWjusbuWLRpvvVue+RvpVbCAnNW+CYWpTy2WQpbnG30wuSLGEFMFC QRtuetpBffD328IELAMwJhJM7VmPTl5VGvwdq6bTzRLSyeiSz6doEUmjyJ18Bv1bFY7E 3NR1nKUZk5roIjD02+4w1oce4aEoPIN0N3T4jP47bexg7or85qmeSx26DfJJd9S0XZW3 2UvNMijW8qNh91qkQj0T8C6ZUY/uacdTjhXzXq1263xbc7RCx6qBPuOKUjm30ob3IoYK LDfw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@intel.com header.s=Intel header.b=mGOukdYi; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.36 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=intel.com Return-Path: Received: from pete.vger.email (pete.vger.email. [23.128.96.36]) by mx.google.com with ESMTPS id w29-20020aa79a1d000000b006bcde830350si877769pfj.290.2023.10.16.22.57.06 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 16 Oct 2023 22:57:06 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.36 as permitted sender) client-ip=23.128.96.36; Authentication-Results: mx.google.com; dkim=pass header.i=@intel.com header.s=Intel header.b=mGOukdYi; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.36 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=intel.com Received: from out1.vger.email (depot.vger.email [IPv6:2620:137:e000::3:0]) by pete.vger.email (Postfix) with ESMTP id 8D1AD805D2B0; Mon, 16 Oct 2023 22:57:04 -0700 (PDT) X-Virus-Status: Clean X-Virus-Scanned: clamav-milter 0.103.10 at pete.vger.email Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S234464AbjJQF46 (ORCPT + 99 others); Tue, 17 Oct 2023 01:56:58 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:42510 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S230343AbjJQF45 (ORCPT ); Tue, 17 Oct 2023 01:56:57 -0400 Received: from mgamail.intel.com (mgamail.intel.com [134.134.136.126]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id A21529E; Mon, 16 Oct 2023 22:56:55 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1697522215; x=1729058215; h=from:to:cc:subject:in-reply-to:references:date: message-id:mime-version; bh=aigizliSGfQOt/MVN5mwaZASQEdSNMmajEsIVyXWVes=; b=mGOukdYiSi2caSzQGxGBxt8o4mLedzzcj2gpQP3xKtLYBfGQSU22bRPe cextzfNrtkdLVjJPu2FVuCyAehbRv390K99MvfVPJPnH7c1z+h13pxVOr IJuBDsvrZY5ltYWok832/1SnjjNjgwpEciVw77Zs4px0NknAqmHq1xxxh Dfkr+e6RjuJmhRj9NlhwrPajXFw9N6/tnW3eEibGoXpg7Pj7EIERuxvnu N6yyv9KYJnHIQE9vbyGktUdR0UFsfFzSMwaLpNTKLPEpDej3KfrY4ainO 4hDkonhhyc4JDhfc4IbC7cmuqj+b9BSsW7D+6ctc1fP4+T8nTP1FvD+L2 g==; X-IronPort-AV: E=McAfee;i="6600,9927,10865"; a="370775611" X-IronPort-AV: E=Sophos;i="6.03,231,1694761200"; d="scan'208";a="370775611" Received: from orsmga008.jf.intel.com ([10.7.209.65]) by orsmga106.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 16 Oct 2023 22:56:55 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=McAfee;i="6600,9927,10865"; a="785370099" X-IronPort-AV: E=Sophos;i="6.03,231,1694761200"; d="scan'208";a="785370099" Received: from yhuang6-desk2.sh.intel.com (HELO yhuang6-desk2.ccr.corp.intel.com) ([10.238.208.55]) by orsmga008-auth.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 16 Oct 2023 22:56:51 -0700 From: "Huang, Ying" To: "Verma, Vishal L" Cc: "david@redhat.com" , "Hocko, Michal" , "Jiang, Dave" , "linux-mm@kvack.org" , "osalvador@suse.de" , "aneesh.kumar@linux.ibm.com" , "linux-kernel@vger.kernel.org" , "Williams, Dan J" , "akpm@linux-foundation.org" , "linux-cxl@vger.kernel.org" , "nvdimm@lists.linux.dev" , "dave.hansen@linux.intel.com" , "jmoyer@redhat.com" , "Jonathan.Cameron@huawei.com" Subject: Re: [PATCH v5 2/2] dax/kmem: allow kmem to add memory with memmap_on_memory In-Reply-To: <7a29c85bda2543a0f31d575ced3e57eb93063fc3.camel@intel.com> (Vishal L. Verma's message of "Tue, 17 Oct 2023 13:44:27 +0800") References: <20231005-vv-kmem_memmap-v5-0-a54d1981f0a3@intel.com> <20231005-vv-kmem_memmap-v5-2-a54d1981f0a3@intel.com> <651f27b728fef_ae7e7294b3@dwillia2-xfh.jf.intel.com.notmuch> <923d65270ad08d47adae0d82ab4b508d01e9cc00.camel@intel.com> <87edhtaksf.fsf@yhuang6-desk2.ccr.corp.intel.com> <7a29c85bda2543a0f31d575ced3e57eb93063fc3.camel@intel.com> Date: Tue, 17 Oct 2023 13:54:50 +0800 Message-ID: <874jip94k5.fsf@yhuang6-desk2.ccr.corp.intel.com> User-Agent: Gnus/5.13 (Gnus v5.13) MIME-Version: 1.0 Content-Type: text/plain; charset=ascii X-Spam-Status: No, score=-0.9 required=5.0 tests=DKIMWL_WL_HIGH,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,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 pete.vger.email 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 (pete.vger.email [0.0.0.0]); Mon, 16 Oct 2023 22:57:04 -0700 (PDT) "Verma, Vishal L" writes: > On Tue, 2023-10-17 at 13:18 +0800, Huang, Ying wrote: >> "Verma, Vishal L" writes: >> >> > On Thu, 2023-10-05 at 14:16 -0700, Dan Williams wrote: >> > > Vishal Verma wrote: >> > > > >> > <..> >> > >> > > > + >> > > > + rc = kstrtobool(buf, &val); >> > > > + if (rc) >> > > > + return rc; >> > > >> > > Perhaps: >> > > >> > > if (dev_dax->memmap_on_memory == val) >> > > return len; >> > > >> > > ...and skip the check below when it is going to be a nop >> > > >> > > > + >> > > > + device_lock(dax_region->dev); >> > > > + if (!dax_region->dev->driver) { >> > > >> > > Is the polarity backwards here? I.e. if the device is already >> > > attached to >> > > the kmem driver it is too late to modify memmap_on_memory policy. >> > >> > Hm this sounded logical until I tried it. After a reconfigure- >> > device to >> > devdax (i.e. detach kmem), I get the -EBUSY if I invert this check. >> >> Can you try to unbind the device via sysfs by hand and retry? >> > I think what is happening maybe is while kmem gets detached, the device > goes back to another dax driver (hmem in my tests). So either way, the > check for if (driver) or if (!driver) won't distinguish between kmem > vs. something else. > > Maybe we just remove this check? Or add an explicit kmem check somehow? I think it's good to check kmem explicitly here. -- Best Regards, Huang, Ying