From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from mail-qk1-f180.google.com (mail-qk1-f180.google.com [209.85.222.180]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 1B579261B71 for ; Tue, 9 Jun 2026 18:19:10 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.222.180 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1781029154; cv=none; b=BTvRCN03ewB97nFTsby6c3gs+WaznxgSB4ab4AAzWCIHDtJ6vGy6xq14/5bUdNEIXifitg5pAs8ws/cfhRqeIRh1uPwbTHtBJiiCJr6AeMsIABkHXaOAM0MkksCK9DB0pYTGGAaWNdOz84C58s1WBBondRzt/l0V/jFx/ejPLU8= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1781029154; c=relaxed/simple; bh=yN4njZ8y4hk97P/ujuc+3D9afHqUiRM9TkBrBVe5vEI=; h=Date:From:To:Cc:Subject:Message-ID:References:MIME-Version: Content-Type:Content-Disposition:In-Reply-To; b=aMtw1LZ3OA3OmLl7wy9nNoZhxePHJfjJkLk4DyAY/DdGqnlEvIs+EiDae5EO4yFWeMMDG6YR9RgivaA/+WDDf2WVOer3FXR5Sl47DAIGQhz1lt89r1Bk9XenswHfbwIh051KRwpw+bIkWQ2CBDJn0TcLyxy0ecsWJCrgvR+qiQo= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=none (p=none dis=none) header.from=gourry.net; spf=pass smtp.mailfrom=gourry.net; dkim=pass (2048-bit key) header.d=gourry.net header.i=@gourry.net header.b=oCXGg9gx; arc=none smtp.client-ip=209.85.222.180 Authentication-Results: smtp.subspace.kernel.org; dmarc=none (p=none dis=none) header.from=gourry.net Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=gourry.net Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=gourry.net header.i=@gourry.net header.b="oCXGg9gx" Received: by mail-qk1-f180.google.com with SMTP id af79cd13be357-91562bf6c12so715833285a.2 for ; Tue, 09 Jun 2026 11:19:10 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gourry.net; s=google; t=1781029150; x=1781633950; darn=vger.kernel.org; h=in-reply-to:content-disposition:mime-version:references:message-id :subject:cc:to:from:date:from:to:cc:subject:date:message-id:reply-to; bh=4KqE8R583ndPf0WEv0mevB0HU+y2IabL7k8Ouzc21Xc=; b=oCXGg9gxUSxcU5GesBJnVhLKzHF4A0e2Bc8hwzKSN9CrVWmB25ESUcabVOr/JpwPte XoSrPOYZHtG7BS32cdUfzPx2Gb2Qv1G8ElmRk/Ph+ST6qug8X6KhCY7pYGjEf8fv7a44 fbeLi9nM2XbarEJbnGBrrUJ2WxYw03wZ/MMTZ84nfzAFFnXwtAK0ixBOxMRpiT2MPorb yZR7U+alB/vgodJv2u7Apy1yGRbY5d+Q5rz1EdUrBFta8I25uCS3nxmzyZT82MmbWOdP 7+u46AV8GfSTbvb33RcudVS6CLTwsHfANId0JnqwAutbzBeAC0LrZ6klL81ZRS97KzPF qJGA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20251104; t=1781029150; x=1781633950; h=in-reply-to:content-disposition:mime-version:references:message-id :subject:cc:to:from:date:x-gm-gg:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=4KqE8R583ndPf0WEv0mevB0HU+y2IabL7k8Ouzc21Xc=; b=ZXBJZLch84glZwsFOqKa+3hUeNgodRKmc1BRYjM8tFjju03GA4DJM0VPpWlEozrXjk BlNlYz5rE2HRpsGH56pr1MIkFkwjUN4tXx0r0gmenidwgxNyrvkf+rLCuIS+FUg+j5NV KXXfcjOEZTkH99JB+RE6fqV0/Z9Sx2DUGiwmbiu0cdgO+fzqPrxb0/Gv0HwbmkAyQYmB pbiwj3xAfAgZtd3F+k1iyYEPImPvl2V9WwbAf74PMYQ6UJENJd4C7wTBzEzLodTeTpTb DYsEDtYTBONPNQX41Qzzh1D5rbDdj/powarkA++NgM0fkxF9cBoXKkv1YAwMnPf3EyFb ABqA== X-Forwarded-Encrypted: i=1; AFNElJ9MjIaR0mqxGS7wBdQokf7QV1MK67VQPiFJnoAOCCL+L1wvwL/Yy8lBlSuAoA4oGMzu6XJBCwcX0AtyEsc=@vger.kernel.org X-Gm-Message-State: AOJu0YyJIrwf4O68+1IbbmbkLJgT9q49N8VLigGAOhtaZp8EtYopcUBC gQahhOiJ6dt5bO0LXzmhH136QnMDESBQDc+tq6x1hvixzcBWpGpvMCvkl2BZyMPUeoE= X-Gm-Gg: Acq92OE9GG/wtuetJrOt9A78BZHoghcIp4+uV5Z6LVqDLaP73I/vKoZjqsMKVb8WNS9 fROeISEya3ApRhxWfvkOwEpjiUr58193+10UZnsp0QNU+Qh+cEZ8pcjpZ3tUa2yUf8OUwRTJ0aW SybOqji7HVN9KHD8PGSsj2kn5zankYnjpWP2gPTYZnEoGbSuvhfiHWLZK9nJcGUS6g8FjAQvV6S OVIyxO8aq2AkEmaOrnYSlXBkGeWD6dWXUNOBPJEZ+sYNyVHx2A0Ek/5PTmW8MiUTrHKapPr7rqg 7rwNt4yz5DX924qIH1lXn83Dww1NWOFKDJdAJzaMI2OR85fYyIpJHMCrlkJK6mia+5EeFH50K2T 0JLXuggXVgv/H67EETkhoMgb81p1L+zlKMSZ9aVmRr+1LEW/JlzDNmGMuMF/gHvb8EEkeORRtOr QRw5t5NlLO2nGrVnm3xVJiAogIr78HWw4WWYxgF9fjkPd4loe9Gbmt5+7ngx82llN8qYVto/OYN QMPqt+pmJgUvKjF6g== X-Received: by 2002:a05:620a:17a6:b0:915:6758:222c with SMTP id af79cd13be357-915a9db8ab5mr3329361185a.46.1781029149586; Tue, 09 Jun 2026 11:19:09 -0700 (PDT) Received: from gourry-fedora-PF4VCD3F (pool-173-79-60-52.washdc.fios.verizon.net. [173.79.60.52]) by smtp.gmail.com with ESMTPSA id af79cd13be357-9158a402ff9sm2211734985a.45.2026.06.09.11.19.08 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 09 Jun 2026 11:19:09 -0700 (PDT) Date: Tue, 9 Jun 2026 14:19:07 -0400 From: Gregory Price To: "David Hildenbrand (Arm)" Cc: linux-mm@kvack.org, nvdimm@lists.linux.dev, linux-kernel@vger.kernel.org, kernel-team@meta.com, linux-cxl@vger.kernel.org, linux-kselftest@vger.kernel.org, djbw@kernel.org, vishal.l.verma@intel.com, dave.jiang@intel.com, akpm@linux-foundation.org, ljs@kernel.org, liam@infradead.org, vbabka@kernel.org, rppt@kernel.org, surenb@google.com, mhocko@suse.com, osalvador@suse.de, shuah@kernel.org, alison.schofield@intel.com, Smita.KoralahalliChannabasappa@amd.com, ira.weiny@intel.com, apopple@nvidia.com, Hannes Reinecke Subject: Re: [PATCH v4 8/9] dax/kmem: add sysfs interface for atomic hotplug Message-ID: References: <20260605211911.2160954-1-gourry@gourry.net> <20260605211911.2160954-9-gourry@gourry.net> <1cb0514b-c753-411e-8ff8-80fa29837441@kernel.org> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: On Tue, Jun 09, 2026 at 08:11:42PM +0200, David Hildenbrand (Arm) wrote: > On 6/9/26 17:35, Gregory Price wrote: > > On Tue, Jun 09, 2026 at 12:26:07PM +0200, David Hildenbrand (Arm) wrote: > >> On 6/5/26 23:19, Gregory Price wrote: > >> > >>> > >>> +static int dax_kmem_parse_state(const char *buf) > >>> +{ > >>> + if (sysfs_streq(buf, "unplugged")) > >>> + return DAX_KMEM_UNPLUGGED; > >>> + if (sysfs_streq(buf, "online")) > >>> + return MMOP_ONLINE; > >>> + if (sysfs_streq(buf, "online_kernel")) > >>> + return MMOP_ONLINE_KERNEL; > >>> + if (sysfs_streq(buf, "online_movable")) > >>> + return MMOP_ONLINE_MOVABLE; > >>> + return -EINVAL; > >> > >> Should we try making use of mhp_online_type_from_str()/online_type_to_str() > >> [possibly a nicer exported function for the latter] to avoid duplicating this ... > >> > > > > In patch 6 response i point out adding MMOP_UNPLUGGED > > > > If we add MMOP_UNPLUGGED as a state that is only use by callers of > > memory hotplug to represent the current state - but not as a valid input > > to memory_hotplug.c - then we can simply this as you request. > > > > Although we'll need to add a couple lines to memoryN/state parsing code > > to disallow MMOP_UNPLUGGED as a valid input (otherwise you could > > permanently unplug memory without the ability to get it back... unless > > you want that? Seems useless to me.) > > I would just special-case your KMEM-special value, and then branch off to the > core helpers? > > static int dax_kmem_parse_state(const char *buf) > { > if (sysfs_streq(buf, "unplugged")) > return DAX_KMEM_UNPLUGGED; > return mhp_online_type_from_str(...); > } > > So there is no need to add a value to MM core? > Was going to propose this, but then I thought... well if CXL detactes itself from dax and does this same pattern, maybe MMOP_UNPLUGGED makes sense. But i'll leave that for another day and do as you suggest. Thanks! ~Gregory