From nobody Sat Feb 17 21:33:05 2024 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 4TchqQ07p7z59lGb; Sat, 17 Feb 2024 21:33:06 +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 4TchqP3x7Vz4hNJ; Sat, 17 Feb 2024 21:33:05 +0000 (UTC) (envelope-from git@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1708205585; 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=cDy30gjFsVAr22psBm5BmdKC0cz9FTkxFpBuV8TrvO0=; b=tBy7KiAFGVO8IeuF4QnX20hV1MjPVvf9Fl+frIDhSxZQSvaxQj2wlwi/+Zqb8P2pxTuF1s /3CGZ2X3FXiZodgAPtU3OEFCEjNrLyrOI4e5d90hj5e+0BZ4I+GuH+nNxDONojEskJwr+v PkCN4xpT0TsKd/VCqrcfaFrmyKLbDT/4kxsMa7+CjibTdzmvKqKGw1/aLYbF2zciBYWvpI x0FWL30wvwIP/gr8+XuBlDFA4d2iAQXID/UOByyH3QH+hxGX0jCu+r/pdbOErwILkz9qrW S0xNUZGiIhh028Oj7l/nk7ZT2g4YZSac6s7cx5qQSxWak89owCsFtyyXDFjW+g== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1708205585; 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=cDy30gjFsVAr22psBm5BmdKC0cz9FTkxFpBuV8TrvO0=; b=L+ACFMRv5vT2lXJ8yhNNBcKtm4VRqk62h1EnRpUjewnt4nlwkZvwEJETSrhV2lmzFS4LCq eRK0qgyQVutXeVSwCj/p9gozw2dCfec7xYMXO4Ac9mIDA8elIxK5CpQFlJ4WGrXQljfdwu bcwnTplVYxqZJ8mXoP+n7HxGO2s6lrL5ay7uriQE99GVkWsdEqKI79jINAU4FF/60hhQNF jPojZgDS2+Ao/odVs7tLYcM5O6sRg/U89F2a+MEdudyaYFOb3oLMsz7F7StzuSp56atNfz dxw/TvK7P3ZWwMd6JqHle58rnax1CJvJ/OcNw169x4pYTBUnxz4R7Wp/sgwg9A== ARC-Authentication-Results: i=1; mx1.freebsd.org; none ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1708205585; a=rsa-sha256; cv=none; b=JCo4rzfFMOaPUPzmOt7OUoGTVOin1a/5b4Ju+Y7dLyKHKsmzLyFyE+3bbiQoB4d1SVEBwG CgoltxPmFSINgcBO5tZiYYWia2aQC5Zh9GqW6eZmehcZspmLot9xeTbKtoQR4Z7+TX9acv vPautG+jINqlnENq2KnPo5orDgX93aV/h+rj5Wha350N3b4R0ZuTuUwH54jJrmB5JC7Z0b wbEmnEU+9llaB8tGWQekzqWhvGJqGw4L21Ff0t/gFbD4L1+cp17k8hoeg8CVDuFi+B4GUm OfMtYzak8Kp5D7F/UxaLr1aZvRB1ryHDWnKr7gkcOXeJykxhfG2fDxKUJOpawg== 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 4TchqP2ljpzP88; Sat, 17 Feb 2024 21:33:05 +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 41HLX564021008; Sat, 17 Feb 2024 21:33:05 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.17.1/8.17.1/Submit) id 41HLX5ue021005; Sat, 17 Feb 2024 21:33:05 GMT (envelope-from git) Date: Sat, 17 Feb 2024 21:33:05 GMT Message-Id: <202402172133.41HLX5ue021005@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-branches@FreeBSD.org From: Vladimir Kondratyev Subject: git: ada94bf9e8cb - stable/14 - 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/stable/14 X-Git-Reftype: branch X-Git-Commit: ada94bf9e8cb09e61c6c517dadb87fc5ccafa426 Auto-Submitted: auto-generated The branch stable/14 has been updated by wulf: URL: https://cgit.FreeBSD.org/src/commit/?id=ada94bf9e8cb09e61c6c517dadb87fc5ccafa426 commit ada94bf9e8cb09e61c6c517dadb87fc5ccafa426 Author: Vladimir Kondratyev AuthorDate: 2023-12-24 08:19:59 +0000 Commit: Vladimir Kondratyev CommitDate: 2024-02-17 20:58:38 +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 (cherry picked from commit 64e30cba3f0432fa684728b67850b6254d3713ea) --- 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? */