From owner-freebsd-hackers@freebsd.org Fri Jun 12 19:56:29 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 684FA344179 for ; Fri, 12 Jun 2020 19:56:29 +0000 (UTC) (envelope-from markjdb@gmail.com) Received: from mail-qk1-x742.google.com (mail-qk1-x742.google.com [IPv6:2607:f8b0:4864:20::742]) (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 49kBLg1KN0z402v; Fri, 12 Jun 2020 19:56:26 +0000 (UTC) (envelope-from markjdb@gmail.com) Received: by mail-qk1-x742.google.com with SMTP id b27so10163174qka.4; Fri, 12 Jun 2020 12:56:26 -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=AWg7TfgZuYURqOXgaLPgoVWDu44ZmtlFQIYHHpj+NWk=; b=CI8+u2TUFPwKl7xyhZKiOEG9OPwZEwRcvVvljJXkoiiCubpP2d6P7QVeDPTW7/6xEe 07rtW4ej9C6Jzul8oK4GO73zT/zsWdFMEhHsAAsy7NHAqAFhAsV80jD5HuVfk1Gw2PpZ hG++L+4qu2COH9pegWSIYsyvWUeHOYSan+tusSyXt1AN2ypld/8DysXFwEn3a/RWzoGY vP9cWzSz8mUIZ7lEArMr1XRAJSk9npEigPffKhZ7gTbK6QdrVkaOKE6d5ABESqqnmFzB zjTLBBDlMThGpBoRGTKGaFu+NdgqJUnHbVNezkX/oat+cRbrIhZYtHGNLbk61UsSlk4W l1wg== 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=AWg7TfgZuYURqOXgaLPgoVWDu44ZmtlFQIYHHpj+NWk=; b=kXICws3kM6exZIw98KBfxwJmrITjlLTNCht9Am97XRA7BIPEphRRH2HsOQnWH+SQ2t uwDz946Wh/lWMWvpF0FIG4DjwK6xkOH3cElMvk/qkdZ6WXb8vm2TusBGZbRWN3RNRgtI hcVlm77XP1+4ShSshQI9SAm6//Z0DOiXr/EVMTV4op/scqr+HI/5KQ2akQAChrL5K1Wp 08yreQso2tWsX4LG3JYfTF43L9M9iArqI2hkDNIaA0oJrQjb7/MsjoJnx5Uh04lkDmRx qOXfCZHHGTUduxtIavzax+Zl0DZgyxIxZRsG/rwheUCSqB6ftblN17b+7kuLLWShaR9K zvMg== X-Gm-Message-State: AOAM532BMcWdCM99J7QvSc1ue7ScnwpKom/4jupdP6DJKmNdYc3mTWgS zGvCGak5fB46kCvggYFxFIfI2heQhz0= X-Google-Smtp-Source: ABdhPJypHWkSGK9kL3bgrBIfYsh8qvFFwFnwhgQVzyJY4GEewwcrOiUMERrWKfCiVysLVGokFzVudw== X-Received: by 2002:a37:bce:: with SMTP id 197mr4889602qkl.370.1591991784990; Fri, 12 Jun 2020 12:56:24 -0700 (PDT) Received: from raichu (bras-base-toroon0560w-grc-21-184-147-207-195.dsl.bell.ca. [184.147.207.195]) by smtp.gmail.com with ESMTPSA id m53sm5727895qtb.64.2020.06.12.12.56.23 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 12 Jun 2020 12:56:24 -0700 (PDT) Sender: Mark Johnston Date: Fri, 12 Jun 2020 15:56:19 -0400 From: Mark Johnston To: John Baldwin Cc: freebsd-hackers@freebsd.org Subject: Re: maintaining CRYPTO_TIMING Message-ID: <20200612195619.GA14376@raichu> References: <20200612161401.GA3992@raichu> <37f0c691-f067-20e5-2c21-7513fbdc0380@FreeBSD.org> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <37f0c691-f067-20e5-2c21-7513fbdc0380@FreeBSD.org> X-Rspamd-Queue-Id: 49kBLg1KN0z402v X-Spamd-Bar: ---- Authentication-Results: mx1.freebsd.org; none X-Spamd-Result: default: False [-4.00 / 15.00]; REPLY(-4.00)[]; ASN(0.00)[asn:15169, ipnet:2607:f8b0::/32, country:US] 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: Fri, 12 Jun 2020 19:56:29 -0000 On Fri, Jun 12, 2020 at 12:46:27PM -0700, John Baldwin wrote: > On 6/12/20 9:14 AM, Mark Johnston wrote: > > Hi, > > > > I noticed that the opencrypto framework maintains counters for various > > operations. These counters are all global and are updated > > non-atomically, so they aren't SMP-friendly and won't be precise. I > > wrote a patch to convert them to counter(9), which fixes both issues, > > and I note that kern.crypto_stats was renamed to kern.crypto.stats in > > HEAD so presumably we can use this opportunity to break the sysctl ABI > > as well (the counters have to be widened from 32 bits to 64 bits). > > Nothing in the base system seems to actually fetch these counters > > outside of some code under tools/, which wasn't updated when the sysctl > > was renamed. > > I think this is fine. I'd probably not oppose just removing the stats > outright though. Not clear to me how useful they really are (I've never > used them, always used dtrace or other stats that are more specific) I think the current stats are not particularly useful, but I could imagine adding stats that might be. For instance, a counter for failed CRYPTO_OP_VERIFY_DIGEST operations, or for operations handled by software drivers vs. hardware drivers. I noticed while testing GELI with a WIP driver that I had forgotten to implement AES-XTS+HMAC, so the tests were causing GELI to fall back to a software implementation. Counters could perhaps make it easier to spot cases where a consumer is unexpectedly using an unaccelerated implementation. Or is there already an easy way to spot that? > > There is also CRYPTO_TIMING, which attempts to measure the time elapsed > > during various stages of cryptop processing. This similarly assumes > > that processing is single-threaded and I guess is really only useful to > > OCF driver developers. It has been in the tree for a very long time, > > but has anyone actually used it? I would like to remove it since it > > complicates the above-mentioned patch and is of limited usefulness in > > SMP systems. DTrace or some per-cryptop scheme could be used instead if > > it is really worth having that functionality, but I don't want to write > > a patch to implement that unless someone really wants it. > > This can go. I do use DTrace a fair bit when debugging driver issues, but > I haven't used any of this stuff at all. For real profiling pmcstat is a > better tool. Ok, thanks.