From mboxrd@z Thu Jan 1 00:00:00 1970 From: Borislav Petkov Subject: Re: [Part2 PATCH v6 13/38] crypto: ccp: Add Secure Encrypted Virtualization (SEV) command support Date: Fri, 27 Oct 2017 22:15:54 +0200 Message-ID: <20171027201554.GH12039@nazgul.tnic> References: <20171023092020.GB19523@nazgul.tnic> <20171026135614.GA12359@nazgul.tnic> <9258d8e7-b185-01d2-be92-d7d2820c7eb6@amd.com> <20171026174427.GB29782@nazgul.tnic> <20171026201322.GA32181@nazgul.tnic> <89f4ec21-e31e-18f2-27c5-946c38cd128d@amd.com> <20171027075650.GA1276@nazgul.tnic> <323f3862-b326-e6b4-015f-6d923d7c700f@amd.com> Mime-Version: 1.0 Content-Type: text/plain; charset=utf-8 Cc: kvm@vger.kernel.org, Paolo Bonzini , Radim =?utf-8?B?S3LEjW3DocWZ?= , Herbert Xu , Gary Hook , Tom Lendacky , linux-crypto@vger.kernel.org, linux-kernel@vger.kernel.org To: Brijesh Singh Return-path: Received: from mail.skyhub.de ([5.9.137.197]:42806 "EHLO mail.skyhub.de" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751831AbdJ0UPw (ORCPT ); Fri, 27 Oct 2017 16:15:52 -0400 Content-Disposition: inline In-Reply-To: <323f3862-b326-e6b4-015f-6d923d7c700f@amd.com> Sender: linux-crypto-owner@vger.kernel.org List-ID: On Fri, Oct 27, 2017 at 06:28:38AM -0500, Brijesh Singh wrote: > ... User can retry the command sometime later when nobody else is > using the PSP. That still doesn't prevent you from doing two things: * make that fw_init_count a proper kref instead of your homegrown thing * do not preemptively execute commands on the PSP if you can't possibly know what the next command is going to be - instead, just put it in the required state only when you really have to. I.e., don't do all that unnecessary INIT -> CMD -> SHUTDOWN game for no reason. Thx. -- Regards/Gruss, Boris. ECO tip #101: Trim your mails when you reply. From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1752788AbdJ0UPz (ORCPT ); Fri, 27 Oct 2017 16:15:55 -0400 Received: from mail.skyhub.de ([5.9.137.197]:42806 "EHLO mail.skyhub.de" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751831AbdJ0UPw (ORCPT ); Fri, 27 Oct 2017 16:15:52 -0400 Date: Fri, 27 Oct 2017 22:15:54 +0200 From: Borislav Petkov To: Brijesh Singh Cc: kvm@vger.kernel.org, Paolo Bonzini , Radim =?utf-8?B?S3LEjW3DocWZ?= , Herbert Xu , Gary Hook , Tom Lendacky , linux-crypto@vger.kernel.org, linux-kernel@vger.kernel.org Subject: Re: [Part2 PATCH v6 13/38] crypto: ccp: Add Secure Encrypted Virtualization (SEV) command support Message-ID: <20171027201554.GH12039@nazgul.tnic> References: <20171023092020.GB19523@nazgul.tnic> <20171026135614.GA12359@nazgul.tnic> <9258d8e7-b185-01d2-be92-d7d2820c7eb6@amd.com> <20171026174427.GB29782@nazgul.tnic> <20171026201322.GA32181@nazgul.tnic> <89f4ec21-e31e-18f2-27c5-946c38cd128d@amd.com> <20171027075650.GA1276@nazgul.tnic> <323f3862-b326-e6b4-015f-6d923d7c700f@amd.com> MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Disposition: inline In-Reply-To: <323f3862-b326-e6b4-015f-6d923d7c700f@amd.com> User-Agent: Mutt/1.6.0 (2016-04-01) Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Fri, Oct 27, 2017 at 06:28:38AM -0500, Brijesh Singh wrote: > ... User can retry the command sometime later when nobody else is > using the PSP. That still doesn't prevent you from doing two things: * make that fw_init_count a proper kref instead of your homegrown thing * do not preemptively execute commands on the PSP if you can't possibly know what the next command is going to be - instead, just put it in the required state only when you really have to. I.e., don't do all that unnecessary INIT -> CMD -> SHUTDOWN game for no reason. Thx. -- Regards/Gruss, Boris. ECO tip #101: Trim your mails when you reply. --