Received: by 2002:a05:6a10:206:0:0:0:0 with SMTP id 6csp2079518pxj; Sat, 19 Jun 2021 02:16:23 -0700 (PDT) X-Google-Smtp-Source: ABdhPJz2E15UT9Rfkjc7XAaQFR6H/5lSGY0shZM3Q3JeYEuGQzI+CE2ahhZQfEbydgUzjPa9CARX X-Received: by 2002:a5d:9a97:: with SMTP id c23mr11641493iom.38.1624094183040; Sat, 19 Jun 2021 02:16:23 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1624094183; cv=none; d=google.com; s=arc-20160816; b=feA+BwHpV7lsUiA3IoYYaNX8KZDSsTR+6RW6kUEo+3Gjo1KAMIMc2nQMzl1EfSR7Rf xXdeAVfJpt1R7E3+NN+1x0mL7BTSgjsw6CmGlxRbiKnXk93C+MExnEfrvIGH1RhjccB9 StsvZFyl56w95tyi6DVGnnF27/E5tLACl7/+n7mu+lXdehrBkXOQKUZPrlXjLHPzD7n4 PiFfE37kqBEBEFbrHhw8MARUx7TJ45qjmYYYUgp8zYgc9zkgXrMxEHqK9j1qCyaQdD/O OOX45UDCRiCUnzbFvPvebhIzq1JHazhHZgoVdiEt+RD3KIF0sAnuWLDrHNWugdEZCckp 0p/g== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:message-id :mime-version:in-reply-to:references:cc:to:subject:from:date :dkim-signature; bh=3T7Odnlsnem8BkJlC2xSfftmUKp4jKXmmLUMcPJbBEA=; b=gNKnSrMzoL37O92LGbl0RvbKgtHqRuj8oESa0G8XfwwdZTbJqb1AfWIAbaBMRy1EP1 ZuTqINSP2u+biqb5GfxxfngIER4ek3xGCdfIlpq61q0qyT0UUs6tA4MbanJOcJK/Wdc1 ewXm90pzJmhTi0glKbEbqzsSktbliB1ISqIyiHVi8Lm9zpNJ3Zq+zTTg1w3y7/AKcy5W 5o+//WN/wUN3NlzGfk+PNSIyrdmLo44Qppg62VhM5vKHqCNen+HIsJzePWMJXzP630Ni Tr3lUXEQvBGsHkBwjymqxUZ7NySvXO36Ae5hcB7SOzv0np7ZpcdpBpevgH2ZHe7Dr4bI 8iKg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@gmail.com header.s=20161025 header.b=Idn92CI+; spf=pass (google.com: domain of linux-crypto-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-crypto-owner@vger.kernel.org; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id a17si4299957ilh.108.2021.06.19.02.16.11; Sat, 19 Jun 2021 02:16:23 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-crypto-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; dkim=pass header.i=@gmail.com header.s=20161025 header.b=Idn92CI+; spf=pass (google.com: domain of linux-crypto-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-crypto-owner@vger.kernel.org; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S235650AbhFSDYW (ORCPT + 99 others); Fri, 18 Jun 2021 23:24:22 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:48708 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S235603AbhFSDYW (ORCPT ); Fri, 18 Jun 2021 23:24:22 -0400 Received: from mail-pg1-x52c.google.com (mail-pg1-x52c.google.com [IPv6:2607:f8b0:4864:20::52c]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 463AFC061574 for ; Fri, 18 Jun 2021 20:22:12 -0700 (PDT) Received: by mail-pg1-x52c.google.com with SMTP id t9so9412371pgn.4 for ; Fri, 18 Jun 2021 20:22:12 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=date:from:subject:to:cc:references:in-reply-to:mime-version :message-id:content-transfer-encoding; bh=3T7Odnlsnem8BkJlC2xSfftmUKp4jKXmmLUMcPJbBEA=; b=Idn92CI+h8pY9q7HPYIz/0jW5jkAufr8GnNY7FFeQORmQ9SmvmYuuchs68QAnUofxU j642JXTnUvarg9FzIqNT/YOT2fQI3R9Vtura966K0T4HlNM7dtsb10gmwK6VcTMp3+UH N3woyo0zlsbbqlXbiO6+9V/oLRxLtbCUU8bVcVwbj7h2lf9RNRXweiUkKF3GCEmHaSSH KafqbdAdbLJrLdIdcEZ2Kf4sRBTBdRNTPtfl5EytC4bp713rC04HrKsQeisymGVv+1GK 5TyTIo1xfYdMRjh1/PaiAJ+KAoPzLTmFKNIQW+sBfs9FFviPd9f1vFvzcH2M65Vbtjlk DdcQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:date:from:subject:to:cc:references:in-reply-to :mime-version:message-id:content-transfer-encoding; bh=3T7Odnlsnem8BkJlC2xSfftmUKp4jKXmmLUMcPJbBEA=; b=QdaNksWKkASAEYHnXtBYPxcbZIsUOUNlQ7AV7blAVp9+veeXiSu1LPP9bQqa6FniGg 50al2+5e3Gj9oDyE8zz8d8zXJjD2iF/tF3mtjKDCDwyOEm1TQRsEhyA5tvVZ4zteVjpV BrBnqu8wO4uy5dCKTX8U4DsUAH5ht7bovt0aHr4/F8KC4eDkjxlUX8ILV+nWVZfS3EeK Py1ltSkIDWMemhTxnctewI/3HoGdC5XUKFKX0+xknUMP0x3/3GJhibrEoKJsYihhUbQ6 HE0Mgp12Wt/WPWUxesbRI3VAnAo9og/PfhppobNO92dvGCa1KVhUmVHNofmPxp4VZerc Uv6g== X-Gm-Message-State: AOAM533id6PFNuLN8pOAOStOl6U/l8ZfbtqQlb5Ybr2XWRsHrbKIFVLM Wu/t4jA1ze+YEp6QDiKrT9A= X-Received: by 2002:a63:ef44:: with SMTP id c4mr12840074pgk.162.1624072931781; Fri, 18 Jun 2021 20:22:11 -0700 (PDT) Received: from localhost (60-242-147-73.tpgi.com.au. [60.242.147.73]) by smtp.gmail.com with ESMTPSA id h8sm8736847pjf.7.2021.06.18.20.22.10 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 18 Jun 2021 20:22:11 -0700 (PDT) Date: Sat, 19 Jun 2021 13:22:05 +1000 From: Nicholas Piggin Subject: Re: [PATCH v6 12/17] powerpc/pseries/vas: Integrate API with open/close windows To: Haren Myneni , herbert@gondor.apana.org.au, linux-crypto@vger.kernel.org, linuxppc-dev@lists.ozlabs.org, mpe@ellerman.id.au Cc: haren@us.ibm.com, hbabu@us.ibm.com References: <827bf56dce09620ebecd8a00a5f97105187a6205.camel@linux.ibm.com> <1623971609.844odc55aw.astroid@bobo.none> <0d6ca1ec553a61b219f42ebf6699dd6c56e2e978.camel@linux.ibm.com> In-Reply-To: <0d6ca1ec553a61b219f42ebf6699dd6c56e2e978.camel@linux.ibm.com> MIME-Version: 1.0 Message-Id: <1624072607.4axs4cpe7w.astroid@bobo.none> Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-crypto@vger.kernel.org Excerpts from Haren Myneni's message of June 18, 2021 5:49 pm: > On Fri, 2021-06-18 at 09:22 +1000, Nicholas Piggin wrote: >> Excerpts from Haren Myneni's message of June 18, 2021 6:36 am: >> > This patch adds VAS window allocatioa/close with the corresponding >> > hcalls. Also changes to integrate with the existing user space VAS >> > API and provide register/unregister functions to NX pseries driver. >> >=20 >> > The driver register function is used to create the user space >> > interface (/dev/crypto/nx-gzip) and unregister to remove this >> > entry. >> >=20 >> > The user space process opens this device node and makes an ioctl >> > to allocate VAS window. The close interface is used to deallocate >> > window. >> >=20 >> > Signed-off-by: Haren Myneni >>=20 >> Reviewed-by: Nicholas Piggin >>=20 >> Unless there is some significant performance reason it might be >> simplest >> to take the mutex for the duration of the allocate and frees rather >> than=20 >> taking it several times, covering the atomic with the lock instead. >>=20 >> You have a big lock, might as well use it and not have to wonder what >> if=20 >> things race here or there. >=20 > Using mutex to protect allocate/deallocate window and setup/free IRQ, > also to protect updating the list. We do not need lock for modify > window hcall and other things. Hence taking mutex several times. Right, at which point you have to consider what happens with=20 interleaving allocates and deallocates. I'm not saying it's wrong, just=20 that if you do credential allocation, hcall allocation, irq allocation,=20 and list insertion all under the one lock, and remoe it all under the=20 one lock, concurrency requires less attention. > Also > used atomic for counters (used_lpar_creds) which can be exported in > sysfs (this patch will be added later in next enhancement seris).=20 That's okay you can use mutexes for that too if that's how you're protecting them. >=20 > Genarlly applications open window initially, do continuous copy/paste > operations and close window later. But possible that the library / > application to open/close window for each request. Also may be opening > or closing multiple windows (say 1000 depends on cores on the system) > at the same time. These cases may affect the application performance. It definitely could if you have a lot of concurrent open/close, but the code as is won't handle it all that well either, so there's the question of what is reasonable to do and what is reasonable to add concurrency complexity for. As I said, you've got it working and seem to have covered all cases now=20 so let's get the series in first. But something to consider changing IMO. Thanks, Nick