Received: by 2002:ac0:a5a6:0:0:0:0:0 with SMTP id m35-v6csp36001imm; Thu, 30 Aug 2018 06:27:02 -0700 (PDT) X-Google-Smtp-Source: ANB0VdbafvU7mu8TmwQnw8/34qnbnEErsXO7YcvbQE57AKU789t/mpYs/JtIeuL/z6zqEiOhYazJ X-Received: by 2002:a63:6446:: with SMTP id y67-v6mr9861163pgb.443.1535635622010; Thu, 30 Aug 2018 06:27:02 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1535635621; cv=none; d=google.com; s=arc-20160816; b=nHNzGdMQ63QbWEfOT2lGI/tVQ+EQkkEUEXEi3IvLqC+qORzHGSSo3GqNz9xOyi98Ls gIPnTJxDGpxxCOzC+bcWRiKtV6OFeYC2rw5hXrxS5zqj3qf10v5Ao6rJ6iUE8f0PptAf fCLWPEqhtBFFOgoggd3m24kKMB6s2Kgc/1rNcbUXmdE0coAxXOIsq1WladwG/jc+Uigm JOHq13/iULe/iry4Y7FuePQrgPx1p6xJcapZsbzg5DknhhiBQ92xZY6Y8XJ77hHQpXoR A6T9DlUtUCBBY68hxAN+i9v4buh+1N6/m0v8/xQq6B5K7fI58UspPPcaM2O4EEu8az7p lXSw== 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 :references:in-reply-to:message-id:date:subject:cc:to:from :dkim-signature:arc-authentication-results; bh=Bp8LPyM3QG2bBLxMXMdwxk8KlDypKG82bRB3LqKfNvg=; b=hZjhKfiNpndywOcqx9l1IrzlDTDl+IGcwiOgn5fU2wS9Ofzv1ScDuy3iHFiKH+4RFs p+hYbYPUqwN/DFLKxm0LFte2jF82RawntiD9MF8MHq0gYKHatBAtHfxRxta2HdKHdHDu ymJl4DLmxb5ZDl4a5KqSrqBN/nNhqGC5yEe9UJsk/hem9m9Np/m5LjzZ1c5DqAAdMVXU Aeew2wIApjhqeMTjDxfvjYLJzj92FbsA9Kp1Ifx/CMd5TFVHuULpmRm+Vko3P9efaJu0 oqP5a2FD/5nHZ8heZtpiK0e0gqa50CVx8cc8RVk/WjpIBhS5dAjnSUuGjbv3arIDB/Ir EpxQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=fail header.i=@chronox.de header.s=strato-dkim-0002 header.b=dLBP64m6; 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 x24-v6si6561708pln.465.2018.08.30.06.26.46; Thu, 30 Aug 2018 06:27:01 -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=fail header.i=@chronox.de header.s=strato-dkim-0002 header.b=dLBP64m6; 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 S1728934AbeH3R1T (ORCPT + 99 others); Thu, 30 Aug 2018 13:27:19 -0400 Received: from mo4-p01-ob.smtp.rzone.de ([85.215.255.51]:26068 "EHLO mo4-p01-ob.smtp.rzone.de" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1728722AbeH3R1T (ORCPT ); Thu, 30 Aug 2018 13:27:19 -0400 X-Greylist: delayed 357 seconds by postgrey-1.27 at vger.kernel.org; Thu, 30 Aug 2018 13:27:18 EDT DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; t=1535635510; s=strato-dkim-0002; d=chronox.de; h=References:In-Reply-To:Message-ID:Date:Subject:Cc:To:From: X-RZG-CLASS-ID:X-RZG-AUTH:From:Subject:Sender; bh=Bp8LPyM3QG2bBLxMXMdwxk8KlDypKG82bRB3LqKfNvg=; b=dLBP64m6X4CYl2EyFfDchRv33Gt4TA9o9T/BYScwwds30EogqGBWORwbV4AN+V4twZ +cEkC0xOJmc0SAArlKAiw7IPjSAkkpapR17gZsvDixC7C6mMzwlFK0db4sT5TURcaEVQ iHNxhGB5J5iGjPb+VSY8kVZVZUNhRQ6VaQipFwNi2DO31EJNa5QkacZ1QJKg38Yat1DI 9MD7B/0dfKioyD1fvvE/p8VrBtFdDygP/mfCe0GzJBeji31ff7mkOHZ54XY7zUXREudi LmD+fKYMn4cSYa0khMO6wzFrSFSECba8LESWXj5wSdUP4q0Bd+Ei3FCZ20w67GJqAkZ+ EduQ== X-RZG-AUTH: ":P2ERcEykfu11Y98lp/T7+hdri+uKZK8TKWEqNyiHySGSa9k9xmwdNnzGHXPaIfSfABn3" X-RZG-CLASS-ID: mo00 Received: from tauon.chronox.de by smtp.strato.de (RZmta 43.21 DYNA|AUTH) with ESMTPSA id e08f60u7UDJ9Hdi (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (curve secp521r1 with 521 ECDH bits, eq. 15360 bits RSA)) (Client did not present a certificate); Thu, 30 Aug 2018 15:19:09 +0200 (CEST) From: Stephan Mueller To: Krzysztof Kozlowski Cc: herbert@gondor.apana.org.au, davem@davemloft.net, linux-crypto@vger.kernel.org, linux-kernel@vger.kernel.org Subject: Re: Locking for HW crypto accelerators Date: Thu, 30 Aug 2018 15:19:09 +0200 Message-ID: <2002208.sm9qV7UXju@tauon.chronox.de> In-Reply-To: References: <3053033.se6UkFii4W@tauon.chronox.de> MIME-Version: 1.0 Content-Transfer-Encoding: 7Bit Content-Type: text/plain; charset="us-ascii" Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Am Donnerstag, 30. August 2018, 15:09:05 CEST schrieb Krzysztof Kozlowski: Hi Krzysztof, > Thanks Stephan for hints. Let's assume the each of init, update and > final are atomic... but how about the relation between update and > final? I have two concurrent users in user-space but only one HW: > > Process A: Process B: > init() and set_key() > init() and different key > update(some_data) > update(different_data) > final() > final() > > The final() from process A will now produce the result of hashing/CRC > of some_data and different_data (and even maybe mixed with init() for > different key). All because in the meantime process B added its own > data to the HW. The question is where is the state of the cipher operation kept that is produced with each of the init/update/final calls. Your answer implies that this state is kept in hardware. But commonly the state is kept in software. Look at ahash_request for example, the __ctx pointer is intended to point to the memory the driver needs to store its state. Pick a random driver implementation and search for ahash_request_ctx, for example. > > Best regards, > Krzysztof Ciao Stephan