Re: [IPsec] Discussion of draft-pwouters-ipsecme-multi-sa-performance

Valery Smyslov <smyslov.ietf@gmail.com> Tue, 18 October 2022 13:37 UTC

Return-Path: <smyslov.ietf@gmail.com>
X-Original-To: ipsec@ietfa.amsl.com
Delivered-To: ipsec@ietfa.amsl.com
Received: from localhost (localhost [127.0.0.1]) by ietfa.amsl.com (Postfix) with ESMTP id 3EE5BC1524A5 for <ipsec@ietfa.amsl.com>; Tue, 18 Oct 2022 06:37:52 -0700 (PDT)
X-Virus-Scanned: amavisd-new at amsl.com
X-Spam-Flag: NO
X-Spam-Score: -2.109
X-Spam-Level:
X-Spam-Status: No, score=-2.109 tagged_above=-999 required=5 tests=[BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, FREEMAIL_FROM=0.001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001, T_SCC_BODY_TEXT_LINE=-0.01] autolearn=ham autolearn_force=no
Authentication-Results: ietfa.amsl.com (amavisd-new); dkim=pass (2048-bit key) header.d=gmail.com
Received: from mail.ietf.org ([50.223.129.194]) by localhost (ietfa.amsl.com [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id xGv8PvQiN9fG for <ipsec@ietfa.amsl.com>; Tue, 18 Oct 2022 06:37:50 -0700 (PDT)
Received: from mail-lf1-x12b.google.com (mail-lf1-x12b.google.com [IPv6:2a00:1450:4864:20::12b]) (using TLSv1.3 with cipher TLS_AES_128_GCM_SHA256 (128/128 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits) server-digest SHA256) (No client certificate requested) by ietfa.amsl.com (Postfix) with ESMTPS id 87A23C1522DC for <ipsec@ietf.org>; Tue, 18 Oct 2022 06:37:50 -0700 (PDT)
Received: by mail-lf1-x12b.google.com with SMTP id b2so22545168lfp.6 for <ipsec@ietf.org>; Tue, 18 Oct 2022 06:37:50 -0700 (PDT)
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112; h=content-language:thread-index:content-transfer-encoding :mime-version:message-id:date:subject:in-reply-to:references:cc:to :from:from:to:cc:subject:date:message-id:reply-to; bh=meHjBd+r0cy1UCZL5i63rEc0T6QZ72kT6y7aq4mZw3U=; b=a659tfOar5ANHghzV1ptJlv7DXZ9uMdwN87YJlLjBkTwmiprM1fnlvWd/IVtHJaOwx 6xqUHcILMFK61bfqZdwbKsGpF8gBjm0AnZ5wDzjojErVcSxz7eu6vK57tak8ai2Fnpc0 uYnUbL0rUKtmQubw/uV8PrFFqAbkjZhvs4htw7787FVuzWnLk0tvSXjC91ujMDVxYUly EGXlpeXVN0WGfZ6rKiJBNOk+ezjiNAJRGIWu4sD8bY8fOY6akabcExsafBROuGrnmWmn qKe4DBbBP/lPY+Us5QZ7Jqjwf8dkzQarK2bKd8NKZ23OPNw+sKrwPKJmpqamQ7yfDmyb AvHA==
X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=content-language:thread-index:content-transfer-encoding :mime-version:message-id:date:subject:in-reply-to:references:cc:to :from:x-gm-message-state:from:to:cc:subject:date:message-id:reply-to; bh=meHjBd+r0cy1UCZL5i63rEc0T6QZ72kT6y7aq4mZw3U=; b=LVFD8eH6xI/hnP6on0YCGU36HnIvZSwNuwh0k8ym1HPYrL5m7AZoTOzip3g/zpyzKw cITti87HO3UcR3i9pd06u+J7iFoXAKFEk4Vw4yc5+m5rpp+oOjiQmqgam9V8CGgL30tK 4C/ZRnFBBYOk793STyp0ijBC5NqDs5riqHd4w3X4QAMy4sVABTvGER32J7XFQTzr9HYY w5MEZb/oDkNodECTV1eulrYu+b8Ux46am1uF/QYQ40QHJYlK/jbXGpBe+tIi4yHWaLdW 6kqtyeQLgXWQlBn5ApEka19kNzfie3fX/qS8zTMEpyoOKtkerj5wcPLkZtJUzxCwOwlC 2NqQ==
X-Gm-Message-State: ACrzQf2pt/DOcVfZL14od7aMmGtUQEpSwZbnSyyrO2I5qnx7uYwf7nOz Pvh1Ua3hOb6VCel6+QH6rm6JSMx+Kfw=
X-Google-Smtp-Source: AMsMyM6r26rE0wg2hJa+Cxjg2kYJc1R6qojTDVHp6eI0r2ScyFFN5oQiDjGwcXdS14HhNmuQqEJMDg==
X-Received: by 2002:ac2:5484:0:b0:4a2:4dae:5264 with SMTP id t4-20020ac25484000000b004a24dae5264mr929736lfk.569.1666100268326; Tue, 18 Oct 2022 06:37:48 -0700 (PDT)
Received: from buildpc ([93.188.44.204]) by smtp.gmail.com with ESMTPSA id b17-20020a2eb911000000b0026dd0ee72d1sm1990398ljb.72.2022.10.18.06.37.47 (version=TLS1_2 cipher=ECDHE-ECDSA-AES128-GCM-SHA256 bits=128/128); Tue, 18 Oct 2022 06:37:47 -0700 (PDT)
From: Valery Smyslov <smyslov.ietf@gmail.com>
To: 'Paul Wouters' <paul@nohats.ca>
Cc: 'Steffen Klassert' <steffen.klassert@secunet.com>, 'Michael Richardson' <mcr+ietf@sandelman.ca>, 'IPsecME WG' <ipsec@ietf.org>
References: <15eb01d8dd7e$fdf158e0$f9d40aa0$@gmail.com> <10861.1665504183@localhost> <161701d8dd8c$8d042a50$a70c7ef0$@gmail.com> <20221014101504.GI2602992@gauss3.secunet.de> <03c901d8e232$3850ef20$a8f2cd60$@gmail.com> <1ba3323-5fb1-8350-3acb-5d87ad8f2b16@nohats.ca>
In-Reply-To: <1ba3323-5fb1-8350-3acb-5d87ad8f2b16@nohats.ca>
Date: Tue, 18 Oct 2022 16:37:44 +0300
Message-ID: <048901d8e2f6$cddca010$6995e030$@gmail.com>
MIME-Version: 1.0
Content-Type: text/plain; charset="us-ascii"
Content-Transfer-Encoding: 7bit
X-Mailer: Microsoft Outlook 14.0
Thread-Index: AQJS+NHZSxlPMvP0ZarIorjX6+t7ygGkEVyDAbA4wY4BcMyZqQIz4SzuAZ/Nge6s2sA5YA==
Content-Language: ru
Archived-At: <https://mailarchive.ietf.org/arch/msg/ipsec/Fbz6bn3rPjasajwJTYfpNjqx_LA>
Subject: Re: [IPsec] Discussion of draft-pwouters-ipsecme-multi-sa-performance
X-BeenThere: ipsec@ietf.org
X-Mailman-Version: 2.1.39
Precedence: list
List-Id: Discussion of IPsec protocols <ipsec.ietf.org>
List-Unsubscribe: <https://www.ietf.org/mailman/options/ipsec>, <mailto:ipsec-request@ietf.org?subject=unsubscribe>
List-Archive: <https://mailarchive.ietf.org/arch/browse/ipsec/>
List-Post: <mailto:ipsec@ietf.org>
List-Help: <mailto:ipsec-request@ietf.org?subject=help>
List-Subscribe: <https://www.ietf.org/mailman/listinfo/ipsec>, <mailto:ipsec-request@ietf.org?subject=subscribe>
X-List-Received-Date: Tue, 18 Oct 2022 13:37:52 -0000

Hi Paul,

> On Mon, 17 Oct 2022, Valery Smyslov wrote:
> 
> [leaving cache/linux implementation details to Steffen to answer]
> 
> > Another issue that is not clear from the draft -
> > how per-CPU SAs are created. Consider the situation when
> > an outgoing packet is handled by a CPU
> > and there is no per-CPU Sa to handle it. Then, I assume,
> > the fallback SA is used.
> 
> Yes.

OK.

> > My question - in this
> > case does this CPU additionally requests IKE
> > to create a per-CPU SA for it?
> 
> Yes. In linux language, it would a per-CPU ACQUIRE to userland.

OK.

> > If so, then
> > what happens if the other side has indicated
> > that no more per-CPU SAs is allowed -
> > is it saved somewhere, so that future outgoing
> > packets handled by CPUs with no per-CPU SA,
> > don't trigger requests to create it anymore?
> 
> I think this is implementation specific. You could install an temporary
> rule into the SPD that would give the fallback SA more priority than the
> per-CPU policy installed, so it wouldn't generate ACQUIRES for a while.

Why for a while? And for how long? There is no indication
from the peer whether inability to create more SAs is temporary
or permanent, so we may end up with wasting resources when one peer will be constantly
trying to install per-CPU SA with no success.

> Perhaps userland could also decide to terminate another per-CPU SA that
> is idle. Although I think the advised policy is stated to install at
> least one per-CPU SA per CPU (and allow a few more to catch any race
> conditions and rekeys). 

Why more SAs than the number of CPUs are needed (not counting the Fallback SA)?
If you rekey per-CPU SAs proactively you will always have a per-CPU SA ready.
Or what do you mean by "race conditions" and why only few more SAs
help in this case?

> Clearly, if for part of the connection, you are
> using the fallback SA, you are running at suboptimal speed which is not
> a situation you should remain in.

Why? If the peer is unwilling (or unable) to install more SAs, then
you will be in this suboptimal situation forever. I don't think
it's a wrong situation you want to escape from ASAP, I think it's
a normal situation in general.

> >> We don't require a fallback SA in the draft, we just recommend to have
> >> one. So in that sense, once created, all SAs live their own live.
> >
> > Hmm, my impression from reading the draft is that it is not so:
> >
> > Section 3:
> >
> >   When negotiating CPU specific Child SAs, the first SA negotiated
> >   either in an IKE_AUTH exchange or CREATE_CHILD_SA is called Fallback
> >   SA.
> 
> Indeed. The idea is that no matter what, you can encrypt the packets and
> send them, even if at sub-optimal speeds. We don't want packets to have
> to wait another RTT for the per-CPU SA to establish. That would cause a
> lot of issues (slow TCP retransmits, UDP application retransmits, etc).
> Once the first SA is up, you have a working IPsec tunnel and no more
> packets should be dropped or wait for SA's to establish.

I understand all these considerations. My proposal is to use 
other existing per-CPU SA in this case. So, no special Fallback SA 
is needed (I understand that re-steering packet to a different CPU requires locking, 
but in my understanding using the Fallback SA requires locking as well).

> >   The Fallback Child SA MUST NOT be deleted when idle, as
> >   it is likely to be idle if enough per-CPU Child SAs are installed.
> >
> > I think that these BCP14 requirements make the fallback SA very special.
> 
> Yes it does. It ensures there is a fully working (albeit slow) IPsec
> connection.

And the "specialityness" of this SA worries me. I think that the same
functionality can be achieved without introducing this special SA.

Regards,
Valery.

> Paul