Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1754310AbcK2Jo1 (ORCPT ); Tue, 29 Nov 2016 04:44:27 -0500 Received: from mx0b-001b2d01.pphosted.com ([148.163.158.5]:43697 "EHLO mx0a-001b2d01.pphosted.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1751485AbcK2JoT (ORCPT ); Tue, 29 Nov 2016 04:44:19 -0500 Date: Tue, 29 Nov 2016 10:44:06 +0100 From: Cornelia Huck To: "Gonglei (Arei)" Cc: "linux-kernel@vger.kernel.org" , "qemu-devel@nongnu.org" , "virtio-dev@lists.oasis-open.org" , "virtualization@lists.linux-foundation.org" , "linux-crypto@vger.kernel.org" , Luonengjun , "mst@redhat.com" , "stefanha@redhat.com" , "Huangweidong (C)" , "Wubin (H)" , "xin.zeng@intel.com" , Claudio Fontana , "herbert@gondor.apana.org.au" , "pasic@linux.vnet.ibm.com" , "davem@davemloft.net" , "Zhoujian (jay, Euler)" , "Hanweidong (Randy)" , "arei.gonglei@hotmail.com" , "Xuquan (Quan Xu)" , longpeng , "salvatore.benedetto@intel.com" Subject: Re: [virtio-dev] Re: [PATCH v3] crypto: add virtio-crypto driver In-Reply-To: <33183CC9F5247A488A2544077AF19020DA14A53D@DGGEMA505-MBX.china.huawei.com> References: <1480334903-6672-1-git-send-email-arei.gonglei@huawei.com> <1480334903-6672-2-git-send-email-arei.gonglei@huawei.com> <20161128141244.4defcfa1.cornelia.huck@de.ibm.com> <33183CC9F5247A488A2544077AF19020DA14A53D@DGGEMA505-MBX.china.huawei.com> Organization: IBM Deutschland Research & Development GmbH Vorsitzende des Aufsichtsrats: Martina Koederitz =?UTF-8?B?R2VzY2jDpGZ0c2bDvGhydW5nOg==?= Dirk Wittkopp Sitz der Gesellschaft: =?UTF-8?B?QsO2Ymxpbmdlbg==?= Registergericht: Amtsgericht Stuttgart, HRB 243294 X-Mailer: Claws Mail 3.11.1 (GTK+ 2.24.23; x86_64-pc-linux-gnu) MIME-Version: 1.0 Content-Type: text/plain; charset=US-ASCII Content-Transfer-Encoding: 7bit X-TM-AS-GCONF: 00 X-Content-Scanned: Fidelis XPS MAILER x-cbid: 16112909-0012-0000-0000-00000498769A X-IBM-AV-DETECTION: SAVI=unused REMOTE=unused XFE=unused x-cbparentid: 16112909-0013-0000-0000-000016633211 Message-Id: <20161129104406.6c110ae0.cornelia.huck@de.ibm.com> X-Proofpoint-Virus-Version: vendor=fsecure engine=2.50.10432:,, definitions=2016-11-29_01:,, signatures=0 X-Proofpoint-Spam-Details: rule=outbound_notspam policy=outbound score=0 spamscore=0 suspectscore=0 malwarescore=0 phishscore=0 adultscore=0 bulkscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.0.1-1609300000 definitions=main-1611290167 Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Length: 1489 Lines: 40 On Tue, 29 Nov 2016 01:37:44 +0000 "Gonglei (Arei)" wrote: > > On Mon, 28 Nov 2016 20:08:23 +0800 > > Gonglei wrote: > > > > > +static int virtcrypto_update_status(struct virtio_crypto *vcrypto) > > > +{ > > > + u32 status; > > > + int err; > > > + > > > + virtio_cread(vcrypto->vdev, > > > + struct virtio_crypto_config, status, &status); > > > + > > > + /* Ignore unknown (future) status bits */ > > > + status &= VIRTIO_CRYPTO_S_HW_READY; > > > > I'm wondering what the driver really should do if it encounters unknown > > status bits. > > > > I'd expect that new status bits are guarded by a feature bit and that > > the device should not set status bits if the respective feature bit has > > not been negotiated. Therefore, unknown status bits would be a host > > error and the driver should consider the device to be broken. > > > > Thoughts? > > > I agree with you. > > The reasonable way is reset the device if the driver > receive an unknown status IMO. What about setting FAILED in the generic virtio status? This indicates to the host that the driver 'has given up on the device', as the spec puts it. If the driver simply resets it, chances are that we will end up in the same situation again (after all, that's a host bug). Or/additionally use virtio_break_device(), as a quick grep revealed that qemu, for one, does not do anything with FAILED. That way at least the driver will stop mucking with the device.