Received: by 2002:a05:7412:d8a:b0:e2:908c:2ebd with SMTP id b10csp2939055rdg; Mon, 16 Oct 2023 22:21:15 -0700 (PDT) X-Google-Smtp-Source: AGHT+IFrAkrR5NjohTCKn8gCJofKi5ldbw8CROWLEGvJw1U0k80o8Ymqzf4ubYs3S+rd5t0wtfJp X-Received: by 2002:a0d:fd01:0:b0:59f:4f56:59bc with SMTP id n1-20020a0dfd01000000b0059f4f5659bcmr1365262ywf.42.1697520075360; Mon, 16 Oct 2023 22:21:15 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1697520075; cv=none; d=google.com; s=arc-20160816; b=Qsjfm6gkHlgsK64kVG6Ovev5HiI8USO7xBTthGzpadAOll4hU4KX+TZ/GzCt4wZGLv TtanR2Kof3xGmzZX9FPFJGXdMuUzEMCGx+BfTwHeaBjIJu6yc/8wRiVzsOcSqClUciUb L/6+GwrBB0/M8bsxKlBXzweJG4rkE1IZ4I76o6snSeATcHxO6cM7DCtP3X/KPAGQpPtN 5UJAiS8SpcKqjJCEwHt3IZ9zlpI3RYhMopl7AgcCPJXnFKYWFMexXD4sXPotoQW7u+3f VTEh4hHdlYkucpghmTYoApDl1tC8RKHNaUIepIZg85ei7/t6ZIRHTrshOveseRy1ZMyg xuLQ== 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=wmo5j5Kddwuva79VAAA3wjzLeRHLPB3smX0BfzNdJTs=; fh=M3xOZZ4FDlzWCdBD++yc0vwsqC/bYpa6cHYVdm60yNs=; b=GndGHisV7cO1nghtFg/+FkygDCMaVcij4ONhFLtzMGUQlk10ZVc5UO5Z5R3DEk+eU9 Mue5SJLLNLKa7RwIjvyQ9Dl2DdEelwYi8tNRhMAl0WSQQR7qN6T3HoPgm8aXPJBz9ldc mzXS0xO0zsfwsAcJh4dQxRvnbnZBDunu5qdEwZ9yH2xudbitj0FqWsyVUlhWrm8L4CBt X1GHmswXvCxgRsSFRJ+VDKoFq7JixqlNIyhmIq3W3ostHutg+lHTt3rOWZ2t+bJ9AZUy KpeiZcTDNfbqGWerpxpH3HakdH/xWMR4zwVnBoOQzSLHA6upjn5j78H2YH38rW+eqxC0 AAnQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@intel.com header.s=Intel header.b=bPcsKFCC; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:3 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 lipwig.vger.email (lipwig.vger.email. [2620:137:e000::3:3]) by mx.google.com with ESMTPS id ng9-20020a17090b1a8900b0027db9371d09si1020234pjb.107.2023.10.16.22.21.14 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 16 Oct 2023 22:21:15 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:3 as permitted sender) client-ip=2620:137:e000::3:3; Authentication-Results: mx.google.com; dkim=pass header.i=@intel.com header.s=Intel header.b=bPcsKFCC; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:3 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 lipwig.vger.email (Postfix) with ESMTP id 46EFD8032EDE; Mon, 16 Oct 2023 22:21:13 -0700 (PDT) X-Virus-Status: Clean X-Virus-Scanned: clamav-milter 0.103.10 at lipwig.vger.email Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S234361AbjJQFVD (ORCPT + 99 others); Tue, 17 Oct 2023 01:21:03 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:36302 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229452AbjJQFVC (ORCPT ); Tue, 17 Oct 2023 01:21:02 -0400 Received: from mgamail.intel.com (mgamail.intel.com [134.134.136.126]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 6ED639E; Mon, 16 Oct 2023 22:21:01 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1697520061; x=1729056061; h=from:to:cc:subject:in-reply-to:references:date: message-id:mime-version; bh=0ljYECpynZJuwW/CzHhX9ZRRExV5kXxxKaS9D40UqLM=; b=bPcsKFCCnSO8bwW2wqkVc9UACV1lz3ash7OAjQqXpOdggL1aTvVKhdrN ofHgCvbFIm41q5H9yo2U8hpCHlOwYmPPAuxPTO536+6LjKHP8Us4WzLLQ he9PV/eX+ZTsE1gf5/MaHAPvK8sCPcAdWBs8izIvTP1dC9mxYpZQq/lhW SZj4sTmj3vwVogHfE98cQqeWrHMnFjEwZNb2jXiiDITD4gJbTJ11pVH4b bEZyYcmQ1v8RuAnafL4BbZZvcUfFV2QbuGX4hbLWY5WkqXwEkNIK7zCrY A7mo4QRLnsBkN71QKXyAZ7Ua2aNDkUtu3tP9I6Xw6Q8GTRBd5vHR0F/qG Q==; X-IronPort-AV: E=McAfee;i="6600,9927,10865"; a="370771752" X-IronPort-AV: E=Sophos;i="6.03,231,1694761200"; d="scan'208";a="370771752" Received: from fmsmga003.fm.intel.com ([10.253.24.29]) by orsmga106.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 16 Oct 2023 22:21:00 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=McAfee;i="6600,9927,10865"; a="846685324" X-IronPort-AV: E=Sophos;i="6.03,231,1694761200"; d="scan'208";a="846685324" Received: from yhuang6-desk2.sh.intel.com (HELO yhuang6-desk2.ccr.corp.intel.com) ([10.238.208.55]) by fmsmga003-auth.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 16 Oct 2023 22:20:56 -0700 From: "Huang, Ying" To: "Verma, Vishal L" Cc: "Williams, Dan J" , "Jiang, Dave" , "osalvador@suse.de" , "david@redhat.com" , "akpm@linux-foundation.org" , "dave.hansen@linux.intel.com" , "linux-mm@kvack.org" , "aneesh.kumar@linux.ibm.com" , "linux-kernel@vger.kernel.org" , "linux-cxl@vger.kernel.org" , "Hocko, Michal" , "nvdimm@lists.linux.dev" , "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: <923d65270ad08d47adae0d82ab4b508d01e9cc00.camel@intel.com> (Vishal L. Verma's message of "Tue, 17 Oct 2023 08:31:04 +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> Date: Tue, 17 Oct 2023 13:18:56 +0800 Message-ID: <87edhtaksf.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 lipwig.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 (lipwig.vger.email [0.0.0.0]); Mon, 16 Oct 2023 22:21:13 -0700 (PDT) "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? -- Best Regards, Huang, Ying >> >> > + device_unlock(dax_region->dev); >> > + return -ENXIO; >> [snip]