From nobody Sun Dec 24 08:23:11 2023 X-Original-To: dev-commits-src-all@mlmmj.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mlmmj.nyi.freebsd.org (Postfix) with ESMTP id 4SyYvM4GCcz54HXW; Sun, 24 Dec 2023 08:23:11 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4SyYvM2y79z4XnH; Sun, 24 Dec 2023 08:23:11 +0000 (UTC) (envelope-from git@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1703406191; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding; bh=zxwdaRpXZOrFRC5wer3ZW8II8qJowJQgW/Vb4p7hnG4=; b=HweFUZHu3+qWnZPyJAotj4fRpmsb3i4fyzB8P6LxUXHfVu8vUZp/891cHr/0Ai4uyxRQbo 1h4R+TUh0CGI59HzEBFnirmfcvvIb5dSPiWfFDptphK8O+y2V8LR6Emq4xTWJTot/hpElP c4XQAW8SmVHG/4USv6kqK2CsIDxnBbVJ0kx440tladJ2uU86tsi+C+s+sjt4IHJc9Ng9m6 u7k6chBDW3D2+LJIQOtAim9a9z07NPSjJXzWJbPwnRg707PUOplThGxkV3G0epxw+6t0eQ pMB78/rITXMqLK3penN5jqRrMy4xaUZ09GcdDqttvkUoiozgXzQBhRrJnfRkRg== ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1703406191; a=rsa-sha256; cv=none; b=XHMHMwLVgC+3aYzyhMyoJ8k3Oc8hOM8JvQjCVlL0udR6yJFS3UjYkrzMQHYE0z1RhwTO5d 1HWSr/APrv4owuTAqE7zUt0tDkTmSx7Mbuvj/VlQEKO6yHJhNX3pyH9OhI34GvUnIA+03M ZVxEHD4QWFFvOFpgV5j25QNYaCmKae3FasCgYdQBVoi+up3efC17ilWWShd8azBqWTEkQ+ fD41VrzeMV6gd17rJrmxwVNfck/kDL8bM98hCMXoAgUdD/c8Vu8G2s7whXb3WVun5kwN9b RpthnUYR+YzELEhHw4Sqf1VwFGq/RLBFKxBbaZ2059+HxFUyP6TcA0tO0zY/3A== ARC-Authentication-Results: i=1; mx1.freebsd.org; none ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1703406191; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding; bh=zxwdaRpXZOrFRC5wer3ZW8II8qJowJQgW/Vb4p7hnG4=; b=jWWpiyA2NMaQbo/ouyeD8b9kV5a23VVjawpVjuZdgAaJ2IklJdyZjqZ6xyBIpnYCMpXZRK OEVQn4IcsVstqN0Fs9flpePx9Mcm2aA3jfZWVp2eUQvjM90L9/ih815/g9095Neg0rfuaq rDfMQyQNHq4hstey4LdsdS07lrdOTpT2OUHfyXb8H/4EQ7VxMXE26m8+9GKDm+x4MDZa4j jTXJzQJZSCmI2TBJjI+TyI1Z7SSDfOoxvo877Y6L1GJ6+Bs1bU6uMVCSZV1/uesFxbC25k pVwRtECjCt7hjjpQVBTYe35bikII/xArx5thq6cwKCp/LNmL4UccvetpNU8opg== Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 4SyYvM23G5z5Td; Sun, 24 Dec 2023 08:23:11 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.17.1/8.17.1) with ESMTP id 3BO8NBFT087263; Sun, 24 Dec 2023 08:23:11 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.17.1/8.17.1/Submit) id 3BO8NBq9087260; Sun, 24 Dec 2023 08:23:11 GMT (envelope-from git) Date: Sun, 24 Dec 2023 08:23:11 GMT Message-Id: <202312240823.3BO8NBq9087260@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Vladimir Kondratyev Subject: git: 64e30cba3f04 - main - LinuxKPI: Add write_seqcount_invalidate() and seqprop_sequence() List-Id: Commit messages for all branches of the src repository List-Archive: https://lists.freebsd.org/archives/dev-commits-src-all List-Help: List-Post: List-Subscribe: List-Unsubscribe: Sender: owner-dev-commits-src-all@freebsd.org X-BeenThere: dev-commits-src-all@freebsd.org MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: wulf X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: 64e30cba3f0432fa684728b67850b6254d3713ea Auto-Submitted: auto-generated The branch main has been updated by wulf: URL: https://cgit.FreeBSD.org/src/commit/?id=64e30cba3f0432fa684728b67850b6254d3713ea commit 64e30cba3f0432fa684728b67850b6254d3713ea Author: Vladimir Kondratyev AuthorDate: 2023-12-24 08:19:59 +0000 Commit: Vladimir Kondratyev CommitDate: 2023-12-24 08:19:59 +0000 LinuxKPI: Add write_seqcount_invalidate() and seqprop_sequence() functions to linux/seqlock.h Sponsored by: Serenity Cyber Security, LLC Reviewed by: manu MFC after: 1 week Differential Revision: https://reviews.freebsd.org/D42810 --- sys/compat/linuxkpi/common/include/linux/seqlock.h | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) diff --git a/sys/compat/linuxkpi/common/include/linux/seqlock.h b/sys/compat/linuxkpi/common/include/linux/seqlock.h index a7b9dd12e493..48e42efc10fe 100644 --- a/sys/compat/linuxkpi/common/include/linux/seqlock.h +++ b/sys/compat/linuxkpi/common/include/linux/seqlock.h @@ -31,6 +31,7 @@ #include #include +#include #include #include #include @@ -84,9 +85,24 @@ seqcount_mutex_init(struct seqcount_mutex *seqcount, void *mutex __unused) struct seqcount_mutex: seqc_write_end \ )(&(s)->seqc) +static inline void +lkpi_write_seqcount_invalidate(seqc_t *seqcp) +{ + atomic_thread_fence_rel(); + *seqcp += SEQC_MOD * 2; +} +#define write_seqcount_invalidate(s) lkpi_write_seqcount_invalidate(&(s)->seqc) + #define read_seqcount_begin(s) seqc_read(&(s)->seqc) #define raw_read_seqcount(s) seqc_read_any(&(s)->seqc) +static inline seqc_t +lkpi_seqprop_sequence(const seqc_t *seqcp) +{ + return (atomic_load_int(__DECONST(seqc_t *, seqcp))); +} +#define seqprop_sequence(s) lkpi_seqprop_sequence(&(s)->seqc) + /* * XXX: Are predicts from inline functions still not honored by clang? */