From owner-freebsd-hackers@freebsd.org Fri Jun 12 16:14:09 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 5876F33EE06 for ; Fri, 12 Jun 2020 16:14:09 +0000 (UTC) (envelope-from markjdb@gmail.com) Received: from mail-qk1-x72d.google.com (mail-qk1-x72d.google.com [IPv6:2607:f8b0:4864:20::72d]) (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 49k5Q84j4fz3Scj; Fri, 12 Jun 2020 16:14:08 +0000 (UTC) (envelope-from markjdb@gmail.com) Received: by mail-qk1-x72d.google.com with SMTP id c14so9449581qka.11; Fri, 12 Jun 2020 09:14:08 -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:mime-version :content-disposition; bh=wx3DKO4ns/JahCcWxXVnoLoBaOvfU005d42GoW4zeac=; b=oQwa0G0226osz+gzZRelZIVEgRL/Ag7RtcZFlqaHegNKCDfFbRosqxVduVPQX2FDwX M8J9+LCNS9tIEYCvXzBHhcLVlrim6WQcxrgJLQGTdy0UQokUAevz3Dtb8iKl/g1xqV4M uqbHsQUShfCk0UkVhghgimNTnYjyQxEwD0SntXlnloLjUvo50FTN3D1T9s4xwEMNEkyH ohgbUQ7U9W/5+NljNZEKAw64BXjNCvB20Mmpp8eZsmEZhW2bDtbtnqtT5docpkw2ID3X ocbNZigrRPuO4NGGU+EPjbYoRS0Bo4WcNeB+B0W5XoEEnmrqf+9Qp5RcKf1thy383zyp aQTg== 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 :mime-version:content-disposition; bh=wx3DKO4ns/JahCcWxXVnoLoBaOvfU005d42GoW4zeac=; b=j2q4shd6JlYA2y+OXlTP3qO4wfbysSJmwruXzYjs5aZp756cHjoikA7Gpsxv/1Vvxb tDqmK6Ixc0fsMmOymaolsmB4eRfIV4jWIx6zVJOsiTxZ9DVtxnx7yqvO18UpXg953aAj D4PPF6EtFNEaZyInx9guvy12zuopQW12dSHtxrxtonKcgCbg27aEIaQA8CYCfyxd6EcX mpqSK5V0Fo6u6yQVeCfC17RFxuiFqS9AxKjMsCMPiWRB+AmZCvrytW0e/PuoY9liUL84 XcqV3GJcxSO7DIs+4NllHsdOWCSd9fThGJcygb2maDa0+Qc2jMBppKb8i8dZyNNAEsEZ Dx9w== X-Gm-Message-State: AOAM533epRYCU4WytH5P6rGI2hxDV5stOw2S/CUS3WJsngagy9w7y5Fb flU7w9l0bxymhVITVY16paWsVEqnetc= X-Google-Smtp-Source: ABdhPJxlIgdrVrOjzBztuQ9qgy8G5hejaqkQTZUJkc1+L9QN/I5+6L3m/soFxwma3gi1k4rfjBn7Iw== X-Received: by 2002:a37:9d43:: with SMTP id g64mr3602969qke.387.1591978447275; Fri, 12 Jun 2020 09:14:07 -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 x11sm4735426qti.60.2020.06.12.09.14.06 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 12 Jun 2020 09:14:06 -0700 (PDT) Sender: Mark Johnston Date: Fri, 12 Jun 2020 12:14:01 -0400 From: Mark Johnston To: freebsd-hackers@freebsd.org Subject: maintaining CRYPTO_TIMING Message-ID: <20200612161401.GA3992@raichu> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline X-Rspamd-Queue-Id: 49k5Q84j4fz3Scj X-Spamd-Bar: - Authentication-Results: mx1.freebsd.org; dkim=pass header.d=gmail.com header.s=20161025 header.b=oQwa0G02; dmarc=none; spf=pass (mx1.freebsd.org: domain of markjdb@gmail.com designates 2607:f8b0:4864:20::72d as permitted sender) smtp.mailfrom=markjdb@gmail.com X-Spamd-Result: default: False [-1.29 / 15.00]; RCVD_VIA_SMTP_AUTH(0.00)[]; ARC_NA(0.00)[]; R_DKIM_ALLOW(-0.20)[gmail.com:s=20161025]; NEURAL_HAM_MEDIUM(-0.96)[-0.960]; FROM_HAS_DN(0.00)[]; TO_MATCH_ENVRCPT_ALL(0.00)[]; R_SPF_ALLOW(-0.20)[+ip6:2607:f8b0:4000::/36]; MIME_GOOD(-0.10)[text/plain]; TO_DN_NONE(0.00)[]; DMARC_NA(0.00)[freebsd.org]; NEURAL_SPAM_SHORT(0.37)[0.369]; NEURAL_HAM_LONG(-1.00)[-1.000]; RCVD_COUNT_THREE(0.00)[3]; MID_RHS_NOT_FQDN(0.50)[]; DKIM_TRACE(0.00)[gmail.com:+]; RCPT_COUNT_TWO(0.00)[2]; RCVD_IN_DNSWL_NONE(0.00)[2607:f8b0:4864:20::72d:from]; FORGED_SENDER(0.30)[markj@freebsd.org,markjdb@gmail.com]; RECEIVED_SPAMHAUS_PBL(0.00)[184.147.207.195:received]; 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]; RCVD_TLS_ALL(0.00)[] 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 16:14:09 -0000 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. 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.