From nobody Wed May 06 01:34:48 2026 X-Original-To: bugs@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 4g9HxN3dpdz6d311 for ; Wed, 06 May 2026 01:34:48 +0000 (UTC) (envelope-from bugzilla-noreply@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 "R13" (not verified)) by mx1.freebsd.org (Postfix) with ESMTPS id 4g9HxN2vcsz3l6N for ; Wed, 06 May 2026 01:34:48 +0000 (UTC) (envelope-from bugzilla-noreply@freebsd.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1778031288; 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=woRTMzAp/5LpRRJkmjJotohRt9Lwkk1rC3DwjUVeKcA=; b=TjFiAhHdpfpwwXtC/d3Qn6C7TIkRPWUTrNaSdPc46zYrMsM642EjMB6ze0fIC3iHd6BJTT prle7uOUF6nCE5Kh0NAoRSFUuKiDWL0ujUjbvxzsiBpgwfN5UB5O7+OTncIDcPRexr3M1l 0DtzVX85xltLrsjsFpfkudinbQDouxgchrosOUr+o15E8Jq4vEXaPqb7QUz1X23yhENEeh kIybYRmJK+fv4kSXheZvIBAlG4DAMPlpbUMR/Mx/AKIMQBu1Peu2AlUAExLuWQSNJ4cyfD hmuG2d56kECvM75CMGHoVhMslG2bgnUor39DRRCDoqUMeoILDMA5dMZ38AhCgg== ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1778031288; a=rsa-sha256; cv=none; b=LirpNQTPQI/zhctDMolm9iOWVwHGuhOeFwUYRSYfeDHLTDKyxbTTzhzhEP/hGRxD60SJn+ DIzKF281Jbdq3iu2SpO9LJKbpVYO8nF2+TS1jJbDBnlvbuA6DW4fBFRMEPtUS6jyusXkoB Azhd3FkpVnT2daVZhO+qJ0B/Ev3zSGW+eFQgJ9sIBqmlsQbskbt8bqSwJ4SKK7ydVY1g4Y tZWTLWfdu+lSlXFTyoaqSLeqN8Cy8lMVgNTeVafsoioGi0ymaD3uSHTw5ZB5Sbn3qsnwWD RMMVH+m623IcZyXWApwYV7AVLnGpQfW/a9Q929rBIc4mt4GsxYDDEMgNWsdFeA== 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=1778031288; 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=woRTMzAp/5LpRRJkmjJotohRt9Lwkk1rC3DwjUVeKcA=; b=RYiVjWbMj9BNGksjx4B9bKOI9PdIkTqG7locnOLQZQKWSgs2gMRYBCZ3ghzPsBZYggfkyJ HMq9QA8OlV1owAywjpwr3IpEH+0HJDUwhmUHCHnPdqkd7ifcFURKldY3dIzHn/LMztYRP6 uHzk7fSMAb9uPJfwTwwLwYC4Ns6Jnzt9Xzh0gshi8mFo9KCiqzS6DSA6AEmA1l96kViXI1 npX5y3sYzwmm/IQSeazJ43MFhCj2ckPAXY3REjItNG88SQ3aDwdz8Fo2CevW4u35y25Mht toODGWbS9ZumonEi47EIPlEacQd+mSSnECNRakVudIbsFm5V+JVmlDpcIZ7wbQ== Received: from kenobi.freebsd.org (kenobi.freebsd.org [IPv6:2610:1c1:1:606c::50:1d]) (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 4g9HxN1qzNz1l6 for ; Wed, 06 May 2026 01:34:48 +0000 (UTC) (envelope-from bugzilla-noreply@freebsd.org) Received: from kenobi.freebsd.org ([127.0.1.5]) by kenobi.freebsd.org (8.15.2/8.15.2) with ESMTP id 6461Ymb2080613 for ; Wed, 6 May 2026 01:34:48 GMT (envelope-from bugzilla-noreply@freebsd.org) Received: (from www@localhost) by kenobi.freebsd.org (8.15.2/8.15.2/Submit) id 6461YmJ1080612 for bugs@FreeBSD.org; Wed, 6 May 2026 01:34:48 GMT (envelope-from bugzilla-noreply@freebsd.org) X-Authentication-Warning: kenobi.freebsd.org: www set sender to bugzilla-noreply@freebsd.org using -f From: bugzilla-noreply@freebsd.org To: bugs@FreeBSD.org Subject: [Bug 295043] pf: per-packet microuptime() calls from 0493260115db cause major throughput regression with expensive timecounters Date: Wed, 06 May 2026 01:34:48 +0000 X-Bugzilla-Reason: AssignedTo X-Bugzilla-Type: new X-Bugzilla-Watch-Reason: None X-Bugzilla-Product: Base System X-Bugzilla-Component: kern X-Bugzilla-Version: 15.0-RELEASE X-Bugzilla-Keywords: X-Bugzilla-Severity: Affects Some People X-Bugzilla-Who: jworrell@gmail.com X-Bugzilla-Status: New X-Bugzilla-Resolution: X-Bugzilla-Priority: --- X-Bugzilla-Assigned-To: bugs@FreeBSD.org X-Bugzilla-Flags: X-Bugzilla-Changed-Fields: bug_id short_desc product version rep_platform op_sys bug_status bug_severity priority component assigned_to reporter Message-ID: Content-Transfer-Encoding: quoted-printable Content-Type: text/plain; charset="UTF-8" X-Bugzilla-URL: https://bugs.freebsd.org/bugzilla/ Auto-Submitted: auto-generated List-Id: Bug reports List-Archive: https://lists.freebsd.org/archives/freebsd-bugs List-Help: List-Post: List-Subscribe: List-Unsubscribe: Sender: owner-freebsd-bugs@FreeBSD.org List-Id: List-Post: List-Help: List-Subscribe: List-Unsubscribe: List-Owner: Precedence: list MIME-Version: 1.0 https://bugs.freebsd.org/bugzilla/show_bug.cgi?id=3D295043 Bug ID: 295043 Summary: pf: per-packet microuptime() calls from 0493260115db cause major throughput regression with expensive timecounters Product: Base System Version: 15.0-RELEASE Hardware: amd64 OS: Any Status: New Severity: Affects Some People Priority: --- Component: kern Assignee: bugs@FreeBSD.org Reporter: jworrell@gmail.com Commit 0493260115db ("pf: store state creation/expiration timestamps with millisecond precision") replaced time_uptime reads with microuptime() calls via pf_get_uptime() in pf's per-packet state expire update path. On systems using HPET (common in KVM guests without ITSC), this is extremely expensive. https://github.com/freebsd/freebsd-src/commit/0493260115db10164246762d6d492= 3880575e529 Measurements (FreeBSD/KVM guest, iperf3, pf enabled with stateful rules): vtnet, HPET: ~2.3 Gbit/s vtnet, TSC-low: ~9 Gbit/s ixl passthrough + VLANs, HPET: <1 Gbit/s ixl passthrough + VLANs, TSC-low: ~9 Gbit/s pf disabled, any timecounter: ~9 Gbit/s kern.timecounter.choice: TSC-low(-100) i8254(0) ACPI-fast(900) HPET(950) dummy(-1000000) TSC-low is distrusted because the hypervisor doesn't expose ITSC to the guest, which is common in many KVM configurations. How to reproduce: In a VM with pf enabled and stateful rules: sysctl kern.timecounter.hardware=3DHPET iperf3 -c # observe reduced throughput sysctl kern.timecounter.hardware=3DTSC-low iperf3 -c # throughput restored Possible approaches: The millisecond precision is primarily needed by pflow(4) at export time, not per packet. Defaulting pf_get_uptime() to (uint64_t)time_uptime * 1000 would preserve the data model changes while eliminating the per-packet timecounter read. The precise microuptime() path could be gated behind a sysctl for pflow users who need it. Alternatively, the patch could use getmicrouptime() instead of microuptime(). The former returns a cached value without querying the hardware timecounter, which is what the man page recommends when execution time matters more than precision. --=20 You are receiving this mail because: You are the assignee for the bug.=