Article View: linux.kernel.netdev
Article #12107Re: [PATCH net] ptp: Report clock removal to poll waiters
From: Simon Horman
Date: Fri, 06 Nov 2026 09:22
Date: Fri, 06 Nov 2026 09:22
65 lines
9802 bytes
9802 bytes
This is an AI-generated review of your patch. The human sending this
email has considered the AI review valid, or at least plausible.
Full review at: https://netdev-ai.bots.linux.dev/sashiko/#/patchset/20261102122340.1160733-1-thnkslprpt@gmail.com?part=1
---
ptp: Report clock removal to poll waiters
The patch adds a check of ptp->defunct to ptp_poll(), placed after
poll_wait() has registered on tsev_wq. ptp_poll() now returns EPOLLERR
when the clock is being removed, so a poll waiter that consumes the
removal wakeup no longer stays blocked until timeout.
> diff --git a/drivers/ptp/ptp_chardev.c b/drivers/ptp/ptp_chardev.c
> index f63b45f5ee6ae..01adc70ad97b4 100644
> --- a/drivers/ptp/ptp_chardev.c
> +++ b/drivers/ptp/ptp_chardev.c
> @@ -593,6 +593,9 @@ __poll_t ptp_poll(struct posix_clock_context *pccontext, struct file *fp,
>
> poll_wait(fp, &ptp->tsev_wq, wait);
>
> + if (READ_ONCE(ptp->defunct))
> + return EPOLLERR;
> +
[Severity: Low]
This isn't a bug, but should the other accesses to ptp->defunct be
annotated to match this new READ_ONCE()?
The only writer still uses a plain store, so this load has no
WRITE_ONCE() to pair with:
drivers/ptp/ptp_clock.c:ptp_clock_unregister() {
...
ptp->defunct = 1;
wake_up_interruptible(&ptp->tsev_wq);
...
}
The other lockless reader in this file, ptp_read(), still uses plain
loads:
drivers/ptp/ptp_chardev.c:ptp_read() {
...
if (wait_event_interruptible(ptp->tsev_wq, ptp->defunct || queue_cnt(queue)))
return -ERESTARTSYS;
if (ptp->defunct)
return -ENODEV;
...
}
After this patch, ptp_poll() and ptp_read() read the same flag in two
different ways. Other code in this subsystem pairs its annotations
explicitly. For example, queue_cnt() in ptp_private.h notes that its
READ_ONCE() is "Paired with WRITE_ONCE() in
enqueue_external_timestamp(), ptp_read(), extts_fifo_show()".
Would it be more consistent to use WRITE_ONCE(ptp->defunct, 1) in
ptp_clock_unregister() and READ_ONCE() in ptp_read()? The other option
is to leave the new check unannotated like the existing ones.
> return queue_cnt(queue) ? EPOLLIN : 0;
> }
--
pw-bot: changes-requested
Technical Details
Message-ID:
<20261106092205.1168004-2-horms@kernel.org>Path:
mbox-mo1.pugleaf.net!archive.usenet.blueworldhosting.com!usenet.blueworldhosting.com!diablo1.usenet.blueworldhosting.com!usenet.network!.POSTED!vger.kernel.org!netdev+bounces-357870-linux-kernel-netdev=dewy.ruReferences:
<20261102122340.1160733-1-thnkslprpt@gmail.com>Show Full Headers
Complete Article Headers
Path: mbox-mo1.pugleaf.net!archive.usenet.blueworldhosting.com!usenet.blueworldhosting.com!diablo1.usenet.blueworldhosting.com!usenet.network!.POSTED!vger.kernel.org!netdev+bounces-357870-linux-kernel-netdev=dewy.ru From: horms@kernel.org (Simon Horman) Newsgroups: linux.kernel.netdev Subject: Re: [PATCH net] ptp: Report clock removal to poll waiters Date: Fri, 6 Nov 2026 09:22:06 +0000 Organization: Usenet Network Message-ID: <20261106092205.1168004-2-horms@kernel.org> References: <20261102122340.1160733-1-thnkslprpt@gmail.com> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Injection-Info: usenet.network; logging-data="3837260"; mail-complaints-to="abuse@usenet.network" Cancel-Lock: sha1:kF9GrRXXXnwRvZgEyXytEqx2NLA= sha256:PvGfPyGiVbI7/gfvGE4jAapoWAkwskElriQc6p9gc3M= sha1:AA5cS4lkCFRhfDaF5SuymXNOOzE= sha256:/UVbWr1GbwD01LQhyps2eeBxOZZjPZAdGu1KpyZQMuw= List-ID: <netdev.vger.kernel.org> X-Mailpost-Empty-Hdrs: X-Spam-Level X-Received: from localhost (localhost [127.0.0.1]) by mail.dewy.ru (Postfix) with ESMTP id A5A441131DB; Fri, 6 Nov 2026 12:34:08 +0300 (MSK) X-Virus-Scanned: Debian amavisd-new at usenet.network X-Spam-Flag: NO X-Spam-Score: -3.401 X-Spam-Status: No, score=-3.401 tagged_above=-9999 required=6.31 tests=[DCC_REPUT_70_89=0.1, DKIMWL_WL_HIGH=-0.001, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, MAILING_LIST_MULTI=-1, RCVD_IN_DNSWL_MED=-2.3, SPF_HELO_NONE=0.001, SPF_PASS=-0.001] autolearn=ham autolearn_force=no X-Authentication-Results: mail.dewy.ru (amavisd-new); dkim=pass (2048-bit key) header.d=kernel.org X-Received: from mail.dewy.ru ([127.0.0.1]) by localhost (mail.dewy.ru [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id AK5xl0rDsSA8; Fri, 6 Nov 2026 12:34:03 +0300 (MSK) X-Received-SPF: Pass (mailfrom) identity=mailfrom; client-ip=172.234.253.10; helo=sea.lore.kernel.org; envelope-from=netdev+bounces-357870-linux-kernel-netdev=dewy.ru@vger.kernel.org; receiver=<UNKNOWN> X-Authentication-Results: OpenDMARC; dmarc=pass (p=quarantine dis=none) header.from=kernel.org X-Received: from sea.lore.kernel.org (sea.lore.kernel.org [172.234.253.10]) by mail.dewy.ru (Postfix) with ESMTPS id DEAD11131D5; Fri, 6 Nov 2026 12:33:53 +0300 (MSK) X-Received: from smtp.subspace.kernel.org (conduit.subspace.kernel.org [100.77.114.92]) by sea.lore.kernel.org (Postfix) with ESMTP id 6865A295CE; Fri, 6 Nov 2026 09:23:26 +0000 (UTC) X-Authentication-Results: smtp.subspace.kernel.org; arc=pass header.oldest-pass=0 smtp.remote-ip=127.0.0.1 X-ARC-Seal: i=2; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; cv=pass; t=1793956975; b=0gRWtuq8Q3+vQXmgCiGKFqboDpH2xWCeBWfz5dBmexfp3zOVZuMh/CITL6f94fbicIdw krY75rRe/Urs5Bzbz15IGZaO/LTIHL53szn5YL7IQO0dIPiK4/YtcdTVEt7Jx0meR/Iv3 To4JpK/PwH/cAki9Naew434hz30FC9u42dZep0WIOfjuYlS8/v/52fbIhgL31h3i+hZss ho3pFX8pptnTgpBM1UvoX2KXuDWxdgKGUWPYHkGNxfeJjDp7p1LHTGi39SNcBcKXXT+Z8 O4Okuam16DzI5QVELJiuypAqUS4Z0IXZhBzE9g4J/gDntVDncnZa3fnWCybYnH61HGw== X-ARC-Message-Signature: i=2; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; c=relaxed/relaxed; t=1793956975; h=X-Original-To:Received:Received:DKIM-Signature:From:To:Cc:Subject: Date:Message-ID:X-Mailer:In-Reply-To:References:X-Mailing-List: List-Id:List-Post:List-Help:List-Subscribe:List-Unsubscribe: List-Owner:Precedence:MIME-Version:Content-Transfer-Encoding; bh=B2VlpYxIyrjBwpfsYj6tday8nvUyo3/23/5HWi7DkJA=; b=mkKw0wJjGPrQ+CxouqK9iX25t3nVOKnLkuNBbaM6NfqbMz7HF8wDjmZpvXboNyGs4y8S swnMhvA3dqOAkZKN4O7M0pTVJXzBYZNiufwBaUxJfdXBCD564G/LwWEDI4eOlnqUleCS4 spWIrT/wUjW89rFxp4kFzk68xkVufB7266zLmdbKXDN4DacsDgDZGj3G9Ok0CNDrdrbpm 60pOPFwRgLy+YPFLhigig2L0NrqMoxq3rVwbW8S+TKq/rUT1VlZRicUV68M93hdcsM1GU +9CDYDO7j51qq3mOfdTkxPXgsCkO7GeNd+nIUPlxfRdQpp/TnkZXH3+nkWrp6wk9EXw== X-ARC-Authentication-Results: i=2; smtp.subspace.kernel.org; dkim=pass header.d=kernel.org header.i=@kernel.org header.a=rsa-sha256 header.s=k20260515 header.b=ed+zaeMM; arc=pass header.oldest-pass=0 smtp.remote-ip=127.0.0.1 X-Received: from localhost.localdomain (localhost [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 1194E606D81F; Fri, 6 Nov 2026 09:22:55 +0000 (UTC) X-Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key, unprotected) header.d=kernel.org header.i=@kernel.org header.a=rsa-sha256 header.s=k20260515 header.b=ed+zaeMM X-Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.remote-ip=100.103.45.18 X-ARC-Seal: i=1; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; cv=none; t=1793956969; b=V9udbh4ielcEEyshhQmQa1KB9ut7HbJ3X9+c6Jq0m7Ev9/3z8xEYtVqGrQtUnU7/kf0n 0BBlwCLACEZcPfMohbesEL8cT2h1mwbzD5IxuOfqsqgdAL/CB99M7/zVVMb2R0mU10jVH GktiCtvv2a+zyrL3+DXrICf5hK/XoMmpoAOYhitYyfQJpIAWbPfTxBor303tbNlLL0cqh Kf2LWQjMcO0K7Zd6h9iZS34runv7wg1ByCmYtpHzW1Ln/yi3wu+juEgUxqIwelKywXl4E YmKhAThjCwtTqhMK++UGspGNg+WpM3wnpvAmjhOv+8z/O8xUJiwJNZGUVx6ADBDHYMQ== X-ARC-Message-Signature: i=1; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; c=relaxed/relaxed; t=1793956969; h=Received:DKIM-Signature:From:To:Cc:Subject:Date:Message-ID:X-Mailer: In-Reply-To:References:MIME-Version:Content-Transfer-Encoding; bh=B2VlpYxIyrjBwpfsYj6tday8nvUyo3/23/5HWi7DkJA=; b=Uj4KRAKwrOM4dHungbn9dq/gCEm7PNbfoOk1TqK8fKz3qGRWVZqQiKgfiC3xwe4fHoBL DOTq13BQ3kvdUZ0P0Qo5a40DrcwzWhwuZctCCRvvAIpNjI3diQfoesv+DimYF6DohraKM Es8qWhfQe96XYF+ZzX6mWtG/yjQKBx6LFrFDXzXUKYNLUcwd91uFGlhB6cGueVhDy9jtK 6BW+eoXDpqeyyD3wuP6CKVMegx99Sf5lv2Uh28HP4OyBQnzNKqjVD2iCkrp2L0zttiiHb HOotNl5Q0sGboo0R/CDd4AhBnMKpJodEacfp70C1XI9nUPKCwIvjZmr3uumgr+2q0Zg== X-ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dkim=pass header.d=kernel.org header.i=@kernel.org header.a=rsa-sha256 header.s=k20260515 header.b=ed+zaeMM; arc=none smtp.remote-ip=100.103.45.18 X-Received: from smtp.kernel.org (quasi.space.kernel.org [100.103.45.18]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature ECDSA (prime256v1)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id E67B5606D813; Fri, 6 Nov 2026 09:22:48 +0000 (UTC) X-Received: by smtp.kernel.org (Postfix) with ESMTPSA id A81F01F0089F; Fri, 6 Nov 2026 09:22:46 +0000 (UTC) X-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=kernel.org; s=k20260515; t=1793956968; bh=B2VlpYxIyrjBwpfsYj6tday8nvUyo3/23/5HWi7DkJA=; h=From:To:Cc:Subject:Date:In-Reply-To:References; b=ed+zaeMMxZkk0sMX866f+hgUL+LQdcH7o/qgyoCCXq+vPhec3VXmkvw9H9xDLigWw UY59NgQpfozxZ25pJ/8Qp3Y5hEdCF2kdkNTJ5B2MucLA/3E8ng0Wu3PnU1+gE0FSmt BMi33657UPtzIj6cpgeskuDgJH/84aPM+MoqyBa1+cVAkwhijctC2I/DVbGdVgYkKV m+M56yMwhFwDD5wSM8d/QfYvFNONQo6b7EiQMaUSm3gpmeHGevg0deKPMUxWX2Rv7n YQkXB0lwcKfVPiIluNdn/qZXDQaiJPNjFwS3NJLFi9pDniyKA11Sp2ciLyv0ng2bSe I3AhH3FJxH26A== X-Cc: Simon Horman <horms@kernel.org>, richardcochran@gmail.com, netdev@vger.kernel.org, davem@davemloft.net, edumazet@kernel.org, kuba@kernel.org, pabeni@redhat.com, linux-kernel@vger.kernel.org X-Mailer: git-send-email 2.56.0 X-In-Reply-To: <20261102122340.1160733-1-thnkslprpt@gmail.com> X-Mailing-List: netdev@vger.kernel.org X-List-Post: <mailto:netdev@vger.kernel.org> X-List-Help: <mailto:netdev+help@vger.kernel.org> X-List-Subscribe: <mailto:netdev+subscribe@vger.kernel.org> X-List-Unsubscribe: <mailto:netdev+unsubscribe@vger.kernel.org> X-List-Owner: <mailto:netdev+owner@vger.kernel.org> X-Precedence: list