Received: by 2002:ac0:a5a6:0:0:0:0:0 with SMTP id m35-v6csp6279464imm; Mon, 27 Aug 2018 12:52:00 -0700 (PDT) X-Google-Smtp-Source: ANB0VdZlvo8CHyBGc4yJyEHHnfFuenilVA15vENHZ6Qvfnw5DepJBtwQGNv5VncDNz7zTjOqSoRt X-Received: by 2002:a62:1d54:: with SMTP id d81-v6mr15795535pfd.139.1535399520293; Mon, 27 Aug 2018 12:52:00 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1535399520; cv=none; d=google.com; s=arc-20160816; b=LFphekqZqhUrsyMggqvDBRpDU2IvW7d1i1THA18AUEij1EttPoWK60YNOGtK8tIR+L jA6ZZSFRW8pJlLQ0EH5t6eTpoq37HEgn6ofc91IvyHwhjCZuZ6r34roJfL0b8Y5LJncA wyfy+Gq2Q29QBIaeelQnfxCWEAhYeC6QE5XFoFyvUCxxplb7I9e6od2UgR4QR/3ugzBa 9sqdFesoG7hXGcQJLY1WP2PPlGqrq1CUXiqtIaccAn1+TUtuKBfet/I+5WKaryuaRQqm aC1s7E7W94xEnlvgsZ5MUc3NJUtAkG5IDtFDUPxqtg1QJB6Xb7vbWQxkSUowmf07HQ2o o6Ow== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:content-transfer-encoding:mime-version :message-id:to:from:cc:in-reply-to:subject:date:dkim-signature :arc-authentication-results; bh=YTTmwKLGeR4XonCav68BtUxFcLBZiwhISDalkn2irs4=; b=M1fM/u9w2IPiRPJ0uOcYpoevccJk4K8bUY6ylcT3xWKnnUFEwrdSzQK2grJZ/ChItG /Z6alo4nXTxs7ZHjEapscwIDrFdrwLAwzNU7Qn2Wdq7wQcRRRnh0r9frnNlkqy7/RiTO e+ZMUL8zj09gBf2Pr2f1U3BI+J5K3Fs3vF473rOwnYYRFKOiMZEx1e41iAWrqh0m2soJ U5IKFOQES0nqKJkX0DSwaOt9gJHR60J/FVajnxsuBWm2U984wE8M7252vYgOxHkvZ0NA MR/Q22ZLV/Rvh38uAnDMeryioreA847st8i1uS93EIUcJ4FJMztzZD9p+eWvqrKLqPZE xylA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@sifive.com header.s=google header.b="jWVi/olm"; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id w11-v6si110902pgm.531.2018.08.27.12.51.45; Mon, 27 Aug 2018 12:52:00 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; dkim=pass header.i=@sifive.com header.s=google header.b="jWVi/olm"; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1727389AbeH0Xij (ORCPT + 99 others); Mon, 27 Aug 2018 19:38:39 -0400 Received: from mail-pl1-f195.google.com ([209.85.214.195]:43130 "EHLO mail-pl1-f195.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1727218AbeH0Xih (ORCPT ); Mon, 27 Aug 2018 19:38:37 -0400 Received: by mail-pl1-f195.google.com with SMTP id x6-v6so52390plv.10 for ; Mon, 27 Aug 2018 12:50:36 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=sifive.com; s=google; h=date:subject:in-reply-to:cc:from:to:message-id:mime-version :content-transfer-encoding; bh=YTTmwKLGeR4XonCav68BtUxFcLBZiwhISDalkn2irs4=; b=jWVi/olmzo98/rW+l+fvlskDpT60QRfE/oFfiVcSNS3fGr6I/65wHNBnagCuoP1YWn IEoMGh5FFsO55CYkpvz+8AEnCSNMvEtzMy1gL67oVOh9Bm71QD1GqwytKkQDKs7oDBCc UfILxv9+Q1SXuHNbqKdJJiYoUsMvSzfuYKFGea5+b3x+y2DKfuTsoLxz6bOaFUvEY45k CDQLnzweX6Riw1gunEsUJUqmFk63zoMN5ZyDqWe7a+4LLC0MtWeGiRro6WPUqEVCZziU fkKKOy/p2/RNqzwMa2Q31ELG9yD/T1bzd0nb79O6DUHtyEdaB+ce+Hfa6wy78NDQ62rO VErw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:date:subject:in-reply-to:cc:from:to:message-id :mime-version:content-transfer-encoding; bh=YTTmwKLGeR4XonCav68BtUxFcLBZiwhISDalkn2irs4=; b=sFcAZdzwRn1BEk6IKqS8EdIf5PoixtGScaYSgEU+gOniBSsTY1PLH5jzTbQBjmEK/J ZCDLg5jC+C2r1lUngT5jRvTbyM9uXfnzdVFWyME0n6k/Fju9nZh0xX9sX7cw5ERAbp2v Z92/0Yi7i+upluXhWZcGoR9FyRab99W50vHiuJg5zFfMNqZDyLmC3O2sZT5QrXOoV0BB YN3uhS6kbdZRhsm3rV5cSOO/nidSmwfopM9UJJRlr2siUK0OzcjciwIyg2BAeROa7QrR b7pL5gsubp7kPJplX3mPqWh/mpalK/gD9WGg4C0OhWzSSQdRrfzjtU30czrKK5J8HuCj ASvg== X-Gm-Message-State: APzg51AMktTic9xw087vxEGGddQqaenU2pcK+ugBkGaZKxG8Xm/nsj0H mKp4yjt8EFuNaCAe1FxzoEvHIDcxRy4= X-Received: by 2002:a17:902:820a:: with SMTP id x10-v6mr14436645pln.261.1535399435311; Mon, 27 Aug 2018 12:50:35 -0700 (PDT) Received: from localhost ([12.206.222.5]) by smtp.gmail.com with ESMTPSA id 3-v6sm166133pfq.10.2018.08.27.12.50.33 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Mon, 27 Aug 2018 12:50:34 -0700 (PDT) Date: Mon, 27 Aug 2018 12:50:34 -0700 (PDT) X-Google-Original-Date: Mon, 27 Aug 2018 12:49:01 PDT (-0700) Subject: Re: [PATCH v2 01/17] asm: simd context helper API In-Reply-To: <20180824213849.23647-2-Jason@zx2c4.com> CC: linux-kernel@vger.kernel.org, netdev@vger.kernel.org, davem@davemloft.net, Jason@zx2c4.com, luto@kernel.org, Greg KH , sneves@dei.uc.pt, linux-arch@vger.kernel.org From: Palmer Dabbelt To: Jason@zx2c4.com Message-ID: Mime-Version: 1.0 (MHng) Content-Type: text/plain; charset=utf-8; format=flowed Content-Transfer-Encoding: 8bit Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Fri, 24 Aug 2018 14:38:33 PDT (-0700), Jason@zx2c4.com wrote: > Sometimes it's useful to amortize calls to XSAVE/XRSTOR and the related > FPU/SIMD functions over a number of calls, because FPU restoration is > quite expensive. This adds a simple header for carrying out this pattern: > > simd_context_t simd_context = simd_get(); > while ((item = get_item_from_queue()) != NULL) { > encrypt_item(item, simd_context); > simd_context = simd_relax(simd_context); > } > simd_put(simd_context); > > The relaxation step ensures that we don't trample over preemption, and > the get/put API should be a familiar paradigm in the kernel. > > Signed-off-by: Jason A. Donenfeld > Cc: Andy Lutomirski > Cc: Greg KH > Cc: Samuel Neves > Cc: linux-arch@vger.kernel.org > --- > arch/alpha/include/asm/Kbuild | 5 ++-- > arch/arc/include/asm/Kbuild | 1 + > arch/arm/include/asm/simd.h | 42 ++++++++++++++++++++++++++++++ > arch/arm64/include/asm/simd.h | 37 +++++++++++++++++++++----- > arch/c6x/include/asm/Kbuild | 3 ++- > arch/h8300/include/asm/Kbuild | 3 ++- > arch/hexagon/include/asm/Kbuild | 1 + > arch/ia64/include/asm/Kbuild | 1 + > arch/m68k/include/asm/Kbuild | 1 + > arch/microblaze/include/asm/Kbuild | 1 + > arch/mips/include/asm/Kbuild | 1 + > arch/nds32/include/asm/Kbuild | 7 ++--- > arch/nios2/include/asm/Kbuild | 1 + > arch/openrisc/include/asm/Kbuild | 7 ++--- > arch/parisc/include/asm/Kbuild | 1 + > arch/powerpc/include/asm/Kbuild | 3 ++- > arch/riscv/include/asm/Kbuild | 3 ++- > arch/s390/include/asm/Kbuild | 3 ++- > arch/sh/include/asm/Kbuild | 1 + > arch/sparc/include/asm/Kbuild | 1 + > arch/um/include/asm/Kbuild | 3 ++- > arch/unicore32/include/asm/Kbuild | 1 + > arch/x86/include/asm/simd.h | 30 ++++++++++++++++++++- > arch/xtensa/include/asm/Kbuild | 1 + > include/asm-generic/simd.h | 15 +++++++++++ > include/linux/simd.h | 28 ++++++++++++++++++++ > 26 files changed, 180 insertions(+), 21 deletions(-) > create mode 100644 arch/arm/include/asm/simd.h > create mode 100644 include/linux/simd.h ... > diff --git a/arch/riscv/include/asm/Kbuild b/arch/riscv/include/asm/Kbuild > index 576ffdca06ba..8d3e7aef3234 100644 > --- a/arch/riscv/include/asm/Kbuild > +++ b/arch/riscv/include/asm/Kbuild > @@ -4,9 +4,9 @@ generic-y += checksum.h > generic-y += cputime.h > generic-y += device.h > generic-y += div64.h > -generic-y += dma.h > generic-y += dma-contiguous.h > generic-y += dma-mapping.h > +generic-y += dma.h > generic-y += emergency-restart.h > generic-y += errno.h > generic-y += exec.h If this is the canonical ordering and doing so makes your life easier then I'm OK taking this as a separate patch into the RISC-V tree, but if not then feel free to roll something like this up into your next patch set. > @@ -45,6 +45,7 @@ generic-y += setup.h > generic-y += shmbuf.h > generic-y += shmparam.h > generic-y += signal.h > +generic-y += simd.h > generic-y += socket.h > generic-y += sockios.h > generic-y += stat.h Either way, this looks fine for as far as the RISC-V stuff goes as it's pretty much a NOP. As long as it stays a NOP then feel free to add a Reviewed-by: Palmer Dabbelt as far as the RISC-V parts are conceded. It looks like there's a lot of other issues, though, so it's not much of a review :)