From nobody Fri Jul 22 23:20:04 2022 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 4LqQQD4njLz4XC9b for ; Fri, 22 Jul 2022 23:20:04 +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 "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4LqQQD3myCz3x2y for ; Fri, 22 Jul 2022 23:20:04 +0000 (UTC) (envelope-from bugzilla-noreply@freebsd.org) 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 4LqQQD2lvhzJ1M for ; Fri, 22 Jul 2022 23:20:04 +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 26MNK4iU007900 for ; Fri, 22 Jul 2022 23:20:04 GMT (envelope-from bugzilla-noreply@freebsd.org) Received: (from bugzilla@localhost) by kenobi.freebsd.org (8.15.2/8.15.2/Submit) id 26MNK48e007899 for bugs@FreeBSD.org; Fri, 22 Jul 2022 23:20:04 GMT (envelope-from bugzilla-noreply@freebsd.org) X-Authentication-Warning: kenobi.freebsd.org: bugzilla set sender to bugzilla-noreply@freebsd.org using -f From: bugzilla-noreply@freebsd.org To: bugs@FreeBSD.org Subject: [Bug 265382] VLAN hash-list table thrashing when adding and removing entries Date: Fri, 22 Jul 2022 23:20:04 +0000 X-Bugzilla-Reason: AssignedTo X-Bugzilla-Type: changed X-Bugzilla-Watch-Reason: None X-Bugzilla-Product: Base System X-Bugzilla-Component: kern X-Bugzilla-Version: Unspecified X-Bugzilla-Keywords: X-Bugzilla-Severity: Affects Some People X-Bugzilla-Who: commit-hook@FreeBSD.org X-Bugzilla-Status: New X-Bugzilla-Resolution: X-Bugzilla-Priority: --- X-Bugzilla-Assigned-To: bugs@FreeBSD.org X-Bugzilla-Flags: X-Bugzilla-Changed-Fields: Message-ID: In-Reply-To: References: Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable 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 MIME-Version: 1.0 ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1658532004; 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: in-reply-to:in-reply-to:references:references; bh=MnTWY6IWn3fgQgYVIjIK/5MA2sIXxAFtfu9jV47ywlA=; b=Fa9QNbsf06BETkja+a4FNBK1hk1q6VMzilvfwLSNju1k1HrNMvcaknCL/DfS8Sh0g898+z TnYxtm18QgB2fVD7FhaNxUuZC2MuuiXmVIk3lJ9T4q4di8cmZgAW+YelN6tnV5hfiTm7Im 609pb45kzUdt6yWRZ3DE7SI8jODBS2MSo8giQKBw2ihnU58pcqOmHZ2hdBaRzQL0ZwHfad kt+XDzVa3r9iznPQLyh37Fct1n4atRI02kAYx05ZOSrZ4pj/iq+Tk4ekDABfmqJKxnWrL0 fq6vDal79/3dP4XZOSipCdWDRmCgt+803LQuFFzV9NDcGmaKET8zP3sRsk/SlQ== ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1658532004; a=rsa-sha256; cv=none; b=rFMH8FaN9Kw9eoSvtllRuPEXFu9UiYdHCDbOHV4Xc2rhPLd/iTh7TFz1MyCvLKKT2k5PBQ fcgGe8/1ADv+NzSgHnjQSbVbg8s1gS5uJFnZrQPh8TlYwXiKfeXWiDD/JPSyt1vc/6pAVB OvcaVi6dmDdZ7E3LZ9idHgKAuB1r6NmvMyEPfNefX3C/C9y7ObY2MEoKD08pak7Dfj8dZh BOgQvPX6tIPGXQ0j45XjYlECOqlL6V9FTv2kPMQ0ZjLaqm9HrCYBzPTSHoJYPTzHUSgMDW qJdYBeA1jbuouMiEN71Zv+aftPNPC26KgaaHEqZcnqQGc/X/26LdUrKKb/1wlw== ARC-Authentication-Results: i=1; mx1.freebsd.org; none X-ThisMailContainsUnwantedMimeParts: N https://bugs.freebsd.org/bugzilla/show_bug.cgi?id=3D265382 --- Comment #1 from commit-hook@FreeBSD.org --- A commit in branch main references this bug: URL: https://cgit.FreeBSD.org/src/commit/?id=3D151abc80cde778bc18b91c334d07fbd52= bbb38fb commit 151abc80cde778bc18b91c334d07fbd52bbb38fb Author: Kristof Provost AuthorDate: 2022-07-22 17:17:04 +0000 Commit: Kristof Provost CommitDate: 2022-07-22 17:18:41 +0000 if_vlan: avoid hash table thrashing when adding and removing entries vlan_remhash() uses incorrect value for b. When using the default value for VLAN_DEF_HWIDTH (4), the VLAN hash-list table expands from 16 chains to 32 chains as the 129th entry is added. trunk->hwidth becomes 5. Say a few more entries are added and there are now 135 entri= es. trunk-hwidth will still be 5. If an entry is removed, vlan_remhash() wi= ll calculate a value of 32 for b. refcnt will be decremented to 134. The if comparison at line 473 will return true and vlan_growhash() will be cal= led. The VLAN hash-list table will be compressed from 32 chains wide to 16 chains wide. hwidth will become 4. This is an error, and it can be seen when a new V= LAN is added. The table will again be expanded. If an entry is then removed, a= gain the table is contracted. If the number of VLANS stays in the range of 128-512, each time an inse= rt follows a remove, the table will expand. Each time a remove follows an insert, the table will be contracted. The fix is simple. The line 473 should test that the number of entries = has decreased such that the table should be contracted using what would be = the new value of hwidth. line 467 should be: b =3D 1 << (trunk->hwidth - 1); PR: 265382 Reviewed by: kp MFC after: 2 weeks Sponsored by: NetApp, Inc. sys/net/if_vlan.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) --=20 You are receiving this mail because: You are the assignee for the bug.=