From owner-freebsd-hackers@freebsd.org Tue Oct 27 13:07:59 2020 Return-Path: Delivered-To: freebsd-hackers@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 1A9F344CE21 for ; Tue, 27 Oct 2020 13:07:59 +0000 (UTC) (envelope-from markjdb@gmail.com) Received: from mail-qk1-x744.google.com (mail-qk1-x744.google.com [IPv6:2607:f8b0:4864:20::744]) (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 1O1" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4CLBp56jmtz4ns8 for ; Tue, 27 Oct 2020 13:07:57 +0000 (UTC) (envelope-from markjdb@gmail.com) Received: by mail-qk1-x744.google.com with SMTP id z6so1016164qkz.4 for ; Tue, 27 Oct 2020 06:07:57 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=sender:date:from:to:cc:subject:message-id:references:mime-version :content-disposition:in-reply-to; bh=q7xZPP3bIFKYHlWSJxVDUKDj0uzUaaQkCsta1D6pxMw=; b=bjfl2uVhMjbWQscbidiO+b+uGyuaEU+XB0GNdZTxzlYecimDnHzaVY6HchuP5cqSAS lu5LeRKQ8ArwyduW8SCUK5/SjEQfuMhBFC0prf0PONcHxxoBWngAA0jSztyW6ryugCy0 aYHh4RwOalXieBjYC6TN1YkXQLnpvNXsLh8uWSepsvHXhw4Q8JuOBVOgX/GrutSF1S0B AOJM+3kIboAPeXsIFIc6cLlVgQnGQGaB4fj0u3140LV9uNBJ7ZqJCQO0VvI4VInXq8T7 bVKazI7Cee9irmf1QR+h2pO+Kk8qgwnd8VETZwaD2VHrzAmABbgxNeiT36I4tcE/D+xB v23w== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:sender:date:from:to:cc:subject:message-id :references:mime-version:content-disposition:in-reply-to; bh=q7xZPP3bIFKYHlWSJxVDUKDj0uzUaaQkCsta1D6pxMw=; b=Iajo1Zcd4U7WKVFteaeHULKEDHy+RvwIy/Us2NpeHIFl1X+xn6qGp2ki+RZx3Hb4WX qYdBbss46UkQP+4dwwkkAM9vFG4vGLrzVN31ZBGzV0EVEyDifWjB0a/sYdCoCzuYsaaF 5Uw1zw4302+0j3FaA2MaoqbiqCszqX7Pq8MzWVHL/TogOa3VXmaAvR4xeognT5H8hMWE SnDZssO/iI0Bff6vudygfUIJ0KJsQsgsRjaH8tewHfLpokmx15eQ2mU7QOZZx0ytfypd /gcviR1ocMNXSL+HvrdK1vPf3pjg25b6KYkz8O7X9YOmysQuLeYj9/jAxqVfH7lLCXl9 Hf6g== X-Gm-Message-State: AOAM53062dTn3blqT2BYSV2YYsDqLimWSWjvArA02bSeX8y3mFURYlh+ UkGYKGhZb7gs+kYDSS19UvA= X-Google-Smtp-Source: ABdhPJyLLeI0MqLJLjtu0wlfR8Wwbi3RFS1YR2eFV0lynyM2QWcT8sX98WNcwXTQyqv4Xw/9CECVvg== X-Received: by 2002:a05:620a:a09:: with SMTP id i9mr1876662qka.119.1603804077054; Tue, 27 Oct 2020 06:07:57 -0700 (PDT) Received: from raichu (toroon0560w-lp130-01-174-88-77-103.dsl.bell.ca. [174.88.77.103]) by smtp.gmail.com with ESMTPSA id 9sm601148qkv.110.2020.10.27.06.07.55 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 27 Oct 2020 06:07:56 -0700 (PDT) Sender: Mark Johnston Date: Tue, 27 Oct 2020 09:07:54 -0400 From: Mark Johnston To: Benjamin Kaduk Cc: Neel Chauhan , freebsd-hackers@freebsd.org Subject: Re: QAT driver Message-ID: <20201027130754.GE31663@raichu> References: <20201026200059.GA66299@raichu> <723fbd7326df42ce30cd5e361db9c736@neelc.org> <20201027032720.GB31663@raichu> <20201027045735.GJ39170@kduck.mit.edu> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20201027045735.GJ39170@kduck.mit.edu> X-Rspamd-Queue-Id: 4CLBp56jmtz4ns8 X-Spamd-Bar: -- Authentication-Results: mx1.freebsd.org; dkim=pass header.d=gmail.com header.s=20161025 header.b=bjfl2uVh; dmarc=none; spf=pass (mx1.freebsd.org: domain of markjdb@gmail.com designates 2607:f8b0:4864:20::744 as permitted sender) smtp.mailfrom=markjdb@gmail.com X-Spamd-Result: default: False [-2.09 / 15.00]; ARC_NA(0.00)[]; RCVD_VIA_SMTP_AUTH(0.00)[]; R_DKIM_ALLOW(-0.20)[gmail.com:s=20161025]; RCVD_TLS_ALL(0.00)[]; FROM_HAS_DN(0.00)[]; RCPT_COUNT_THREE(0.00)[3]; R_SPF_ALLOW(-0.20)[+ip6:2607:f8b0:4000::/36:c]; NEURAL_HAM_LONG(-1.00)[-0.999]; MIME_GOOD(-0.10)[text/plain]; PREVIOUSLY_DELIVERED(0.00)[freebsd-hackers@freebsd.org]; DMARC_NA(0.00)[freebsd.org]; TO_DN_SOME(0.00)[]; RCVD_COUNT_THREE(0.00)[3]; TO_MATCH_ENVRCPT_SOME(0.00)[]; DKIM_TRACE(0.00)[gmail.com:+]; NEURAL_HAM_SHORT(-0.37)[-0.370]; RCVD_IN_DNSWL_NONE(0.00)[2607:f8b0:4864:20::744:from]; NEURAL_HAM_MEDIUM(-1.02)[-1.018]; MID_RHS_NOT_FQDN(0.50)[]; FORGED_SENDER(0.30)[markj@freebsd.org,markjdb@gmail.com]; MIME_TRACE(0.00)[0:+]; FREEMAIL_ENVFROM(0.00)[gmail.com]; ASN(0.00)[asn:15169, ipnet:2607:f8b0::/32, country:US]; FROM_NEQ_ENVFROM(0.00)[markj@freebsd.org,markjdb@gmail.com]; MAILMAN_DEST(0.00)[freebsd-hackers] X-BeenThere: freebsd-hackers@freebsd.org X-Mailman-Version: 2.1.33 Precedence: list List-Id: Technical Discussions relating to FreeBSD List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 27 Oct 2020 13:07:59 -0000 On Mon, Oct 26, 2020 at 09:57:35PM -0700, Benjamin Kaduk wrote: > On Mon, Oct 26, 2020 at 11:27:20PM -0400, Mark Johnston wrote: > > On Mon, Oct 26, 2020 at 08:00:08PM -0700, Neel Chauhan wrote: > > > Hi, > > > > > > This is great news for me with my home HPE ML110 G10/Xeon 4108 server. > > > > > > However, I will not be able to test this patch unless it can get > > > backported to 12.1 or 12.2 once it's out, and I don't expect backporting > > > to happen. > > > > Indeed, it wouldn't appear before 12.3. > > > > > I have one question about this: will I be able to use this to accelerate > > > OpenSSL? Is additional code needed? > > > > In principle OpenSSL can make use of cryptodev(4) using the cryptodev > > engine, which would allow requests to be handled by qat(4) (or any other > > hardware crypto driver loaded in the kernel). I don't know that the > > cryptodev engine is really maintained these days though. More > > The openssl cryptodev engine was rewritten in > https://github.com/openssl/openssl/pull/3744 , but engines are going to be > deprecated in openssl 3.0. Is this the devcrypto engine? It appears to be broken on FreeBSD: it tries to invoke CIOCGSESSION on a /dev/crypto descriptor, but one is supposed to first use CRIOGET to get a separate descriptor with which sessions are associated. truss(1)ing "openssl speed -evp aes-128-cbc -engine devcrypto" yields: 82677: openat(AT_FDCWD,"/dev/crypto",O_RDWR,00) = 3 (0x3) 82677: ioctl(3,CIOCGSESSION,0x7fffffffde70) ERR#22 'Invalid argument' 82677: ioctl(3,CIOCGSESSION,0x7fffffffde70) ERR#22 'Invalid argument' 82677: ioctl(3,CIOCGSESSION,0x7fffffffde70) ERR#22 'Invalid argument' 82677: ioctl(3,CIOCGSESSION,0x7fffffffde70) ERR#22 'Invalid argument' 82677: ioctl(3,CIOCGSESSION,0x7fffffffde70) ERR#22 'Invalid argument' ... > In theory someone (Intel?) could write an > openssl "provider" that utilizes the QAT hardware, but (unsurprisingly, > given that the interface isn't even finalized yet!) no one has done that > yet. What's the difference between providers and engines? There is a QAT engine for OpenSSL.