From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from mail-qv1-f48.google.com (mail-qv1-f48.google.com [209.85.219.48]) (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 7E1193624A6 for ; Fri, 13 Feb 2026 14:47:07 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.219.48 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1770994028; cv=none; b=S+6kmIYqXbqr+SyDuSjMChIEGx/7nASVlm9UcI7foPG/fvrRTj5wwmYVAGC5IqMRUhXhDbcv71maBQPv34sx8Xfm4WSigbLfhzZFYjBo7TbAOuuyTwfoNyMyzeqTrsb5KwIN1WROiIS8VL3V64J4Jl9fTT8LxE/tytXn1s4t/2A= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1770994028; c=relaxed/simple; bh=cFmtjlApPJMv1ExIyQgS/Wkr5/q9Jg2WVOu3pXR2DIM=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version:Content-Type; b=kW8vsk5c/L+MK1UtOvU7ZOn/WZhDYCj/47beTpBgo81l4ZNmvxA0iAbz/RXzjIUUemoXAfFmxnFg9ZbbqpQCFqVJoWEj8pOqUK+kKRNEaQKVVeaAuYGQZOWrEtA0Es0RVtHh3kPwMwxb2mKpgnkAY1/QKihuighq438G6jyRfOU= 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=U07jB4IZ; arc=none smtp.client-ip=209.85.219.48 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="U07jB4IZ" Received: by mail-qv1-f48.google.com with SMTP id 6a1803df08f44-895341058b1so13721726d6.3 for ; Fri, 13 Feb 2026 06:47:07 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gourry.net; s=google; t=1770994026; x=1771598826; darn=vger.kernel.org; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=SrAMkqth4z6DpXcsZiO276ItuQcl7/pBA07JwYoUCTM=; b=U07jB4IZ9hM11xfW+WW55HSynriJzSkVLtEr9GIJxw44vhGDyjab0vcSe6KdKT3ycL UXITyv01HQLPQtajmTE6V8EZHfGr7JJ7c+4PNMUne8kz2mlIt04tlpSnHF9P9cImD6zq HCQ6ix7e4FT6bmwHTCQY8JIPNwp2NWV+cMPD+Sb8Kg9eL4fbpAma115AYMlVjI5TUynp dmVHW3YkeGQPG9m3KPT0I4THXbyjnvOgfiOge0sTq4cQ8sr1+9JAwv1qeQ++cj1F4g8s 8EoZZ1YbJpCD0TUk2oFntjdu11NZrockdAQ7wFD7dD4Vx9228flfb3xQJXOK7sGfHY/B GYHQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1770994026; x=1771598826; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-gg:x-gm-message-state:from :to:cc:subject:date:message-id:reply-to; bh=SrAMkqth4z6DpXcsZiO276ItuQcl7/pBA07JwYoUCTM=; b=pkfL6zM0kqPk0pnBe9SOlRkop1KtdTzb19Cgasrf33rKVQ7TYzStyTfBKsK+Rz0VDW ekhlkG9KkMPGMc6nlv3jnUs0XKZNDdFiYs9RtPBsokTCRSL0J+iYIQwzIA03mMEdWJUK j6TziW0W6DN1DYkHDVCBRzPQ/dm1mR5jpy4yW/hBZks6Nnsixvc0rWvpqp6QgFS8yhWr 6xRANeJSNthGKd6sOEYaNQy6DYqLfTgMSoFg/AeDj68PpswdqOmU3OSg5YeZNoAusqWr ib4uaTK73DN2jddBFmvLbow9i/MhnZ6uELo+ztZWO2zrtN78K+LxA6lEqfYpDJCE4e3H cg4g== X-Forwarded-Encrypted: i=1; AJvYcCVPsPxp5X+CnvzgGFCt/smtbK/vhAZiQqWUHUZmrnF9bSQL0Lxn50lT2axL8mzfLZEclSbZpYPVVSKjhqA=@vger.kernel.org X-Gm-Message-State: AOJu0YwKP2co6ErU4cr3HyP9nHc7rqRfGlHMy4abFZOHKi/jRtD3DBNr Mp2rvRLWIgBqHZCIf4x/umC8ooOQAyg8/OzDYnjH1vPwBbLPUcnfy9eKRUvbMHc7FuY= X-Gm-Gg: AZuq6aL4bwJsbN4zPmKBO9iOCCGas7fcnYuObVysmIMFyCbphrgBK7aN+fJfQHobq2g YUJ6RU+dXOJxeWVnFQd4lRFRjpM4Ar9ydg283Yu/IoX6ylkDkXzHQZ9p1JI5lztXS01XQrsRPgc 9yOt/hL8iJl6N0seViWY9NJR3iIKoT05YwaVgBpO4xIvbeqSVf/W61JcX27vrotsJmnWBWmIKgg OE++Sh3wkQVoNmGvgLot52BnoCtXj8wtXQ2q0CerwK82eQmCJcwYAbKXQ8eDibMI9VJ/rbatvqc SEAQNc+npQ5KCNywTfzXIkaa24YfJf2QaC4km0YeuqbUoVKY1vHJEnxgSIfOEYup/MhgtLPH1qV pbMNaoFeX2lAACrR6WF66tdQfcpiMzC4lML6pIhflykdUMjEYrjLlWaXT159MuiVPfVmFMrU1C8 OytN29KVNqssWZjZy67GgJAIqWaWFpNwTa/8QkCDPYpswpB/F9fUpfj4rPnAQ51JzcNpn9qGDlS Pm5IgizOT+Zefs= X-Received: by 2002:a05:622a:589:b0:502:a1c6:4ee with SMTP id d75a77b69052e-506a8271753mr27503871cf.1.1770994026464; Fri, 13 Feb 2026 06:47:06 -0800 (PST) Received: from gourry-fedora-PF4VCD3F.lan (pool-96-255-20-138.washdc.ftas.verizon.net. [96.255.20.138]) by smtp.gmail.com with ESMTPSA id 6a1803df08f44-8971cc7bbcdsm64961446d6.9.2026.02.13.06.47.05 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 13 Feb 2026 06:47:05 -0800 (PST) From: Gregory Price To: Smita Koralahalli Cc: Dan Williams , linux-cxl@vger.kernel.org, linux-kernel@vger.kernel.org Subject: Re: [PATCH] dax/hmem, cxl: Defer and resolve ownership of Soft Reserved memory ranges Date: Fri, 13 Feb 2026 09:47:00 -0500 Message-ID: <20260213144704.2780265-1-gourry@gourry.net> X-Mailer: git-send-email 2.53.0 In-Reply-To: <20260210064501.157591-9-Smita.KoralahalliChannabasappa@amd.com> References: <20260210064501.157591-9-Smita.KoralahalliChannabasappa@amd.com> 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=UTF-8 Content-Transfer-Encoding: 8bit On Tue, Feb 10, 2026 at 06:45:00AM +0000, Smita Koralahalli wrote: This is a review generated by kreview-0811365ff2 Reference: https://github.com/masoncl/review-prompts/ This is not an automated email, I thought this looked valid, the rest of the text here is auto-generated. ~Gregory --- [...] > +static void process_defer_work(void *data) > +{ > + struct platform_device *pdev = data; > + int rc; > + > + /* relies on cxl_acpi and cxl_pci having had a chance to load */ > + wait_for_device_probe(); [...] > +static void kill_defer_work(void *data) > +{ > + struct platform_device *pdev = data; > + > + dax_hmem_flush_work(); > + dax_hmem_unregister_work(process_defer_work, pdev); > +} > + > static int dax_hmem_platform_probe(struct platform_device *pdev) > { > + int rc; > + > + rc = dax_hmem_register_work(process_defer_work, pdev); > + if (rc) > + return rc; > + > + rc = devm_add_action_or_reset(&pdev->dev, kill_defer_work, pdev); > + if (rc) > + return rc; > + > return walk_hmem_resources(&pdev->dev, hmem_register_device); > } Is there a potential deadlock in the error path here? If walk_hmem_resources() encounters a CXL-intersecting range first (calling dax_hmem_queue_work(), which schedules process_defer_work on system_long_wq), and then a subsequent non-CXL Soft Reserved range fails to register, the probe returns an error. The devres cleanup then calls kill_defer_work -> dax_hmem_flush_work() -> flush_work(&dax_hmem_work). Meanwhile, process_defer_work calls wait_for_device_probe(), which waits for probe_count to reach zero. Since devres_release_all runs inside really_probe before driver_probe_device decrements probe_count, this looks like a circular wait: driver_probe_device atomic_inc(&probe_count) __driver_probe_device really_probe dax_hmem_platform_probe walk_hmem_resources -> hmem_register_device CXL range: dax_hmem_queue_work() non-CXL range: fails returns error devres_release_all kill_defer_work dax_hmem_flush_work flush_work(&dax_hmem_work) <-- waits for process_defer_work process_defer_work wait_for_device_probe() <-- waits for probe_count == 0 atomic_dec(&probe_count) <-- never reached The trigger requires both CXL-intersecting and non-CXL Soft Reserved ranges with the non-CXL registration failing, so the window is narrow, but the deadlock would be permanent if hit. Would it be safer to cancel the work instead of flushing it in the error path, or to avoid queuing deferred work during the initial walk?