From nobody Thu Nov 11 14:26:14 2021 X-Original-To: dev-commits-src-main@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 2A082183C2BC; Thu, 11 Nov 2021 14:26:19 +0000 (UTC) (envelope-from markjdb@gmail.com) Received: from mail-qk1-x72e.google.com (mail-qk1-x72e.google.com [IPv6:2607:f8b0:4864:20::72e]) (using TLSv1.3 with cipher TLS_AES_128_GCM_SHA256 (128/128 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (2048 bits) client-digest SHA256) (Client CN "smtp.gmail.com", Issuer "GTS CA 1D4" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4HqkY70Rf1z3Bmv; Thu, 11 Nov 2021 14:26:19 +0000 (UTC) (envelope-from markjdb@gmail.com) Received: by mail-qk1-x72e.google.com with SMTP id g28so1479492qkk.9; Thu, 11 Nov 2021 06:26:19 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112; h=sender:date:from:to:cc:subject:message-id:references:mime-version :content-disposition:in-reply-to; bh=E6VzZIHynOA72wpzuFk9GTRctj5qW7yLW1ZNYTncHnQ=; b=FlUCwY45vca8OmfYbCIpH28TC1v4N5xlKjcr8pDG61Ey5xZlYrVc1VCcjgdHjuZcCs epZbWoVjNHi0IRHIKyoKDgTDZC76kMiuxlVNi89xf9pgmApbkjnpFljZ8rVCJ8lp2+iU t3sA8hFiY9XwO+V0LaGVePNTTr1xfB4C1BQGbhpEK0Uje1iTnpdjWX5gzo4wSzIr/d49 1GQ9ekobQMI0pzO/aXnu9v6nfB0lQbc/id2SKQAgP+LbfkC6AMCGCIbc0sPkC4ncqxwI mngJY6PRz3SpPf1Ui2ttF57jNhKIJY/PWtfJlNpSxp5K0+WeTbb5BDGGbYgaRqNFMDsD tF9g== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:sender:date:from:to:cc:subject:message-id :references:mime-version:content-disposition:in-reply-to; bh=E6VzZIHynOA72wpzuFk9GTRctj5qW7yLW1ZNYTncHnQ=; b=ZFbyZZqeMbVj7G1/4Ng7V8oF72AL05MsEry5QxPJf9IMWWRaXh6FMEy2S7TL05yyi3 l8QAdnV6qFANO2TbXVAmBU7r5hTLuva0Ib+9nq0njAsvFAbfEAxvs0EL3O0LRaiSfsMI BR7DLP/iPjEMsToe908FffbA6j8MVRxVNUn4wuEuip9bUyDwiezdB3R47pUOxCwTbZkC WDj5bkQan1pgqZWW2iSREej3aj3SX2Dzi/oXfW2M5M7WmEhE2LpBO90hpFQ5bgqcZ7P4 0Y/EbHz9ItuLktbhTNNq1MrJtz4UQPzZVJl/TjxE3JZ0oVvUVWzz6RR7iYq+aNrONugB fqaw== X-Gm-Message-State: AOAM531WAylOjoQXl7+B+l1263cJku5E/3mjDkw4jLkN1sCdG1+O0sHh 5eTYCIf32LAft028SeQK41AOPLwslZE= X-Google-Smtp-Source: ABdhPJz5HuJPk6YbXyh2/U2Ud1/SEgNBazKWSMqJDJIhgmxxa8d+07VjOOaKOpJVFG7rWTzQHMZoFw== X-Received: by 2002:a05:620a:45aa:: with SMTP id bp42mr6288784qkb.3.1636640777941; Thu, 11 Nov 2021 06:26:17 -0800 (PST) Received: from nuc ([142.126.186.191]) by smtp.gmail.com with ESMTPSA id c24sm1520587qkp.43.2021.11.11.06.26.16 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 11 Nov 2021 06:26:17 -0800 (PST) Sender: Mark Johnston Date: Thu, 11 Nov 2021 09:26:14 -0500 From: Mark Johnston To: Randall Stewart Cc: src-committers@freebsd.org, dev-commits-src-all@freebsd.org, dev-commits-src-main@freebsd.org Subject: Re: git: b8d60729deef - main - tcp: Congestion control cleanup. Message-ID: References: <202111111131.1ABBVH6s017371@gitrepo.freebsd.org> List-Id: Commit messages for the main branch of the src repository List-Archive: https://lists.freebsd.org/archives/dev-commits-src-main List-Help: List-Post: List-Subscribe: List-Unsubscribe: Sender: owner-dev-commits-src-main@freebsd.org X-BeenThere: dev-commits-src-main@freebsd.org MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <202111111131.1ABBVH6s017371@gitrepo.freebsd.org> X-Rspamd-Queue-Id: 4HqkY70Rf1z3Bmv X-Spamd-Bar: ---- Authentication-Results: mx1.freebsd.org; none X-Spamd-Result: default: False [-4.00 / 15.00]; REPLY(-4.00)[] X-ThisMailContainsUnwantedMimeParts: N On Thu, Nov 11, 2021 at 11:31:17AM +0000, Randall Stewart wrote: > The branch main has been updated by rrs: > > URL: https://cgit.FreeBSD.org/src/commit/?id=b8d60729deefa0bd13e6a395fcab4928e6e10445 > > commit b8d60729deefa0bd13e6a395fcab4928e6e10445 > Author: Randall Stewart > AuthorDate: 2021-11-11 11:28:18 +0000 > Commit: Randall Stewart > CommitDate: 2021-11-11 11:28:18 +0000 > > tcp: Congestion control cleanup. > > NOTE: HEADS UP read the note below if your kernel config is not including GENERIC!! > > This patch does a bit of cleanup on TCP congestion control modules. There were some rather > interesting surprises that one could get i.e. where you use a socket option to change > from one CC (say cc_cubic) to another CC (say cc_vegas) and you could in theory get > a memory failure and end up on cc_newreno. This is not what one would expect. The > new code fixes this by requiring a cc_data_sz() function so we can malloc with M_WAITOK > and pass in to the init function preallocated memory. The CC init is expected in this > case *not* to fail but if it does and a module does break the > "no fail with memory given" contract we do fall back to the CC that was in place at the time. > > This also fixes up a set of common newreno utilities that can be shared amongst other > CC modules instead of the other CC modules reaching into newreno and executing > what they think is a "common and understood" function. Lets put these functions in > cc.c and that way we have a common place that is easily findable by future developers or > bug fixers. This also allows newreno to evolve and grow support for its features i.e. ABE > and HYSTART++ without having to dance through hoops for other CC modules, instead > both newreno and the other modules just call into the common functions if they desire > that behavior or roll there own if that makes more sense. > > Note: This commit changes the kernel configuration!! If you are not using GENERIC in > some form you must add a CC module option (one of CC_NEWRENO, CC_VEGAS, CC_CUBIC, > CC_CDG, CC_CHD, CC_DCTCP, CC_HTCP, CC_HD). You can have more than one defined > as well if you desire. Note that if you create a kernel configuration that does not > define a congestion control module and includes INET or INET6 the kernel compile will > break. Also you need to define a default, generic adds 'options CC_DEFAULT=\"newreno\" > but you can specify any string that represents the name of the CC module (same names > that show up in the CC module list under net.inet.tcp.cc). If you fail to add the > options CC_DEFAULT in your kernel configuration the kernel build will also break. > > Reviewed by: Michael Tuexen > Sponsored by: Netflix Inc. > RELNOTES:YES > Differential Revision: https://reviews.freebsd.org/D32693 Hi Randall, This change causes a panic when starting up a vnet jail. V_default_cc_ptr is NULL in the new vnet, it doesn't automatically get copied from the parent vnet. I wrote the patch below and it allows my system to boot, but it's just a hack and I'm not sure what the right policy is. diff --git a/sys/netinet/cc/cc.c b/sys/netinet/cc/cc.c index 0a61aff37c96..f5ec10e487cf 100644 --- a/sys/netinet/cc/cc.c +++ b/sys/netinet/cc/cc.c @@ -309,6 +309,23 @@ cc_register_algo(struct cc_algo *add_cc) return (err); } +static void +vnet_cc_sysinit(void *arg) +{ + struct cc_algo *cc; + + if (IS_DEFAULT_VNET(curvnet)) + return; + + CURVNET_SET(vnet0); + cc = V_default_cc_ptr; + CURVNET_RESTORE(); + + V_default_cc_ptr = cc; +} +VNET_SYSINIT(vnet_cc_sysinit, SI_SUB_PROTO_IFATTACHDOMAIN, SI_ORDER_ANY, + vnet_cc_sysinit, NULL); + /* * Perform any necessary tasks before we exit congestion recovery. */