Received: by 2002:a25:4158:0:0:0:0:0 with SMTP id o85csp2944360yba; Mon, 8 Apr 2019 07:58:35 -0700 (PDT) X-Google-Smtp-Source: APXvYqxKwxmkmbJJVz8F14lvyKpyGeWgmXJyNNDQ1hGDBG5mfPIc1eSXot6HDsP5phXRwQpOftnH X-Received: by 2002:a17:902:2a89:: with SMTP id j9mr30930645plb.272.1554735514976; Mon, 08 Apr 2019 07:58:34 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1554735514; cv=none; d=google.com; s=arc-20160816; b=HL/xbiQSvr3zEzoHyO1eDPwvTv6JV24OtQBZ+mVp7DUbI2X5g/NFVDSVaWm53UbZVu BwNdKnJYpUowYGUbkdi9BbxBrDbGajaeMDlPW/R9zW0ACD9047I6l9TouBGDn5s1E0iI 82P3cL7v/n+utBQHf5delTnFNtpXfWwVZ9zAwqXql+nUf11+g2vfqf8Z935Qa/D4ote+ LeBCW8Teu63kqcgRuznTRRLY/MnCxpQ0o3QComoXzz1tpC200LEPP3YskwnVLmNkbeV0 fxheJLXHD8zgmVsauUBbgC4WkGnaXiXTSkWNCg31jLB4D7+1soYE2QRrZm9ivMesCk7I 7vTA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:message-id:content-transfer-encoding :mime-version:organization:references:in-reply-to:subject:cc:to:from :date; bh=tOk2cr29pRUvjjZqOi+7uC6iLlKS/xNky8GoJYc94To=; b=RUP1oRMeE2nE2fKWIftVvAsV7b2sPfvyYtZCb5i5spLrVU2g/ErXxvrOuR+ZJy6OZb ivFCAFUZxRakGleUguVDfjbBxBkI2Ht7lIrAPd+lPRCy813HKryCX7uoiUawYgGSg5TS a3+PgQmydOEhyqEucMNTL6Ooft1dD+fs25VMJ5+3PydDSvZG1Re1pP/C2Yb1Bd7JgzzU e0veCWvqYfGccpx3j3ODfYAKhWTlaPfJ30Ors7lOLJxNNROUkWb0gN9Oj1Hki8QSgYVT zNEOujIXW+dmXKOLw+vVJ7WD5gFBXuQWk/nCnyTHpm/mOs2mk4EAP0T3Wx6JgVUcava0 yGkw== ARC-Authentication-Results: i=1; mx.google.com; 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; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=ibm.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id i1si25642537pgq.528.2019.04.08.07.58.18; Mon, 08 Apr 2019 07:58:34 -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; 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; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=ibm.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1727129AbfDHONK (ORCPT + 99 others); Mon, 8 Apr 2019 10:13:10 -0400 Received: from mx0a-001b2d01.pphosted.com ([148.163.156.1]:33560 "EHLO mx0a-001b2d01.pphosted.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726489AbfDHONJ (ORCPT ); Mon, 8 Apr 2019 10:13:09 -0400 Received: from pps.filterd (m0098393.ppops.net [127.0.0.1]) by mx0a-001b2d01.pphosted.com (8.16.0.27/8.16.0.27) with SMTP id x38E7WQ5126659 for ; Mon, 8 Apr 2019 10:13:08 -0400 Received: from e06smtp01.uk.ibm.com (e06smtp01.uk.ibm.com [195.75.94.97]) by mx0a-001b2d01.pphosted.com with ESMTP id 2rr74etknr-1 (version=TLSv1.2 cipher=AES256-GCM-SHA384 bits=256 verify=NOT) for ; Mon, 08 Apr 2019 10:13:08 -0400 Received: from localhost by e06smtp01.uk.ibm.com with IBM ESMTP SMTP Gateway: Authorized Use Only! Violators will be prosecuted for from ; Mon, 8 Apr 2019 15:13:05 +0100 Received: from b06cxnps4076.portsmouth.uk.ibm.com (9.149.109.198) by e06smtp01.uk.ibm.com (192.168.101.131) with IBM ESMTP SMTP Gateway: Authorized Use Only! Violators will be prosecuted; (version=TLSv1/SSLv3 cipher=AES256-GCM-SHA384 bits=256/256) Mon, 8 Apr 2019 15:13:03 +0100 Received: from d06av23.portsmouth.uk.ibm.com (d06av23.portsmouth.uk.ibm.com [9.149.105.59]) by b06cxnps4076.portsmouth.uk.ibm.com (8.14.9/8.14.9/NCO v10.0) with ESMTP id x38ED2rr52953136 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Mon, 8 Apr 2019 14:13:02 GMT Received: from d06av23.portsmouth.uk.ibm.com (unknown [127.0.0.1]) by IMSVA (Postfix) with ESMTP id 01E01A4053; Mon, 8 Apr 2019 14:13:02 +0000 (GMT) Received: from d06av23.portsmouth.uk.ibm.com (unknown [127.0.0.1]) by IMSVA (Postfix) with ESMTP id A7336A4055; Mon, 8 Apr 2019 14:13:01 +0000 (GMT) Received: from oc2783563651 (unknown [9.152.224.40]) by d06av23.portsmouth.uk.ibm.com (Postfix) with ESMTP; Mon, 8 Apr 2019 14:13:01 +0000 (GMT) Date: Mon, 8 Apr 2019 16:12:59 +0200 From: Halil Pasic To: Cornelia Huck Cc: "Michael S . Tsirkin" , Jason Wang , virtualization@lists.linux-foundation.org, kvm@vger.kernel.org, linux-kernel@vger.kernel.org, stable@vger.kernel.org Subject: Re: [PATCH] virtio: Honour 'may_reduce_num' in vring_create_virtqueue In-Reply-To: <20190408123322.24086-1-cohuck@redhat.com> References: <20190408123322.24086-1-cohuck@redhat.com> Organization: IBM X-Mailer: Claws Mail 3.11.1 (GTK+ 2.24.31; x86_64-redhat-linux-gnu) MIME-Version: 1.0 Content-Type: text/plain; charset=US-ASCII Content-Transfer-Encoding: 7bit X-TM-AS-GCONF: 00 x-cbid: 19040814-4275-0000-0000-000003258E5A X-IBM-AV-DETECTION: SAVI=unused REMOTE=unused XFE=unused x-cbparentid: 19040814-4276-0000-0000-00003834A430 Message-Id: <20190408161259.7f1a0369@oc2783563651> X-Proofpoint-Virus-Version: vendor=fsecure engine=2.50.10434:,, definitions=2019-04-08_05:,, signatures=0 X-Proofpoint-Spam-Details: rule=outbound_notspam policy=outbound score=0 priorityscore=1501 malwarescore=0 suspectscore=0 phishscore=0 bulkscore=0 spamscore=0 clxscore=1015 lowpriorityscore=0 mlxscore=0 impostorscore=0 mlxlogscore=782 adultscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.0.1-1810050000 definitions=main-1904080119 Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Mon, 8 Apr 2019 14:33:22 +0200 Cornelia Huck wrote: > vring_create_virtqueue() allows the caller to specify via the > may_reduce_num parameter whether the vring code is allowed to > allocate a smaller ring than specified. > > However, the split ring allocation code tries to allocate a > smaller ring on allocation failure regardless of what the > caller specified. This may cause trouble for e.g. virtio-pci > in legacy mode, which does not support ring resizing. (The > packed ring code does not resize in any case.) > > Let's fix this by bailing out immediately in the split ring code > if the requested size cannot be allocated and may_reduce_num has > not been specified. > > While at it, fix a typo in the usage instructions. > > Fixes: 2a2d1382fe9d ("virtio: Add improved queue allocation API") > Cc: stable@vger.kernel.org # v4.6+ > Signed-off-by: Cornelia Huck Reviewed-by: Halil Pasic