Received: by 2002:a25:4158:0:0:0:0:0 with SMTP id o85csp2892591yba; Mon, 8 Apr 2019 06:59:13 -0700 (PDT) X-Google-Smtp-Source: APXvYqzlZ2VL9eAI8NmdJkgX409r5nwrGjDeY9nf8BNVQNEzffqkBmwJej6jluXB/5+PCPaKz+ES X-Received: by 2002:a62:5ec2:: with SMTP id s185mr29707200pfb.16.1554731953826; Mon, 08 Apr 2019 06:59:13 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1554731953; cv=none; d=google.com; s=arc-20160816; b=E8/Dqex/SWP62dYi8sTDyXCh7J8pQAaFZWTt279F1y1+JWuY5LRoyDsLSgC3kBFpJ/ sESMxa0v3nvOnmdvl4X+l+6J7m1ZqcQWAq6ryjlqCKKzrQjXxJuNbkYf43fzbqfx+oqX /A85Gd1+2WtARPmC/FF1OxRQrsrxDKRrEb1kUwCpqnlf4/FB8ObjUmaUiJwvWCEdxcPq /ydoxQ6ZJ/iLmDKPddRxZOLaCbUXlP1hS0w3q+Qzucn3sbGgUrVPUvN+A8VNU7S2q1Tw QaJijD897tE5pIz8kiWFVmaZbWwVVOlJDXg/sQ0uC0+J7hcIv0rdIby4VOIFkKG//IFw z8Yw== 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:in-reply-to :mime-version:user-agent:date:message-id:from:cc:references:to :subject:dkim-signature; bh=dIMyYXuJ/ZphoxiO57xMpJzVwF1azIzZHwbmusW54gA=; b=bPOK1pByNN/fQQp2qxccHmzd7gNOWzVzFWOhC9WI55np7Xw4MobZloESZTraI2uEs5 6Y+JqWlGBVjRtSOv5touf9l/UiMqqT59HKB3634FDx8sCMczn6BXSuHp0nVJ+KGEDbSe uUXu/2uSDiDhbmcgoMY/n+NVrYxZEM3LJ9rZTygCtk6L4nT5PLg6hlYurujHMsVqNTBt nzBu15Lvik0sqxktnZlOtYvJqf1OwygyjCMIBRGoWbrbYGNIg7TWy336bhWhaOwHnMch NKf4poDmfLlvdJcNMZ95bN6UrdFRZZ/Nv5jjOIDA0H1u0SRIPM7LSjuvhdNjJAYg03IO 4ZCg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@oracle.com header.s=corp-2018-07-02 header.b=NyibkznU; 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=pass (p=NONE sp=NONE dis=NONE) header.from=oracle.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id o7si13679622plk.215.2019.04.08.06.58.58; Mon, 08 Apr 2019 06:59:13 -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=pass header.i=@oracle.com header.s=corp-2018-07-02 header.b=NyibkznU; 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=pass (p=NONE sp=NONE dis=NONE) header.from=oracle.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726917AbfDHN6E (ORCPT + 99 others); Mon, 8 Apr 2019 09:58:04 -0400 Received: from userp2130.oracle.com ([156.151.31.86]:43336 "EHLO userp2130.oracle.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726383AbfDHN6E (ORCPT ); Mon, 8 Apr 2019 09:58:04 -0400 Received: from pps.filterd (userp2130.oracle.com [127.0.0.1]) by userp2130.oracle.com (8.16.0.27/8.16.0.27) with SMTP id x38DsTKp064142; Mon, 8 Apr 2019 13:57:56 GMT DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=oracle.com; h=subject : to : references : cc : from : message-id : date : mime-version : in-reply-to : content-type : content-transfer-encoding; s=corp-2018-07-02; bh=dIMyYXuJ/ZphoxiO57xMpJzVwF1azIzZHwbmusW54gA=; b=NyibkznU5fdPiNJ59OS18tyqwGmOxHoMxEbkNx582kg6zuA1oS39nAmRSBILIFrsfQWm b2ip3S4MnJGp/Kwe3MZd7Wy6Z1WGcxE7DusrtvUXIRrapUh6+M+vJ0rjf3c6jzjlP9eg gyjrCrwhyuOmea4foOqoLdSNR3DMECx7hMgdqKWWIhx72/yMUXTVLzJplf+KoLrXwYcF nXV58y7xTxHtgwzFkPbvwbXrDlQfHJsZ/fJdOFT3m364oDdgxfcntxkTXOYcDNs71gwO gp32kWMLZCJw9FQGuQhdbB6sUA2ALAVAb1r3P4j75PBmG3QNIjTvEgNn/QjK1bD6BO3r WA== Received: from userp3020.oracle.com (userp3020.oracle.com [156.151.31.79]) by userp2130.oracle.com with ESMTP id 2rpkhspkr6-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Mon, 08 Apr 2019 13:57:56 +0000 Received: from pps.filterd (userp3020.oracle.com [127.0.0.1]) by userp3020.oracle.com (8.16.0.27/8.16.0.27) with SMTP id x38Dvnme097661; Mon, 8 Apr 2019 13:57:56 GMT Received: from userv0121.oracle.com (userv0121.oracle.com [156.151.31.72]) by userp3020.oracle.com with ESMTP id 2rpkehqddw-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Mon, 08 Apr 2019 13:57:56 +0000 Received: from abhmp0005.oracle.com (abhmp0005.oracle.com [141.146.116.11]) by userv0121.oracle.com (8.14.4/8.13.8) with ESMTP id x38Dvsfo007793; Mon, 8 Apr 2019 13:57:54 GMT Received: from [10.191.23.208] (/10.191.23.208) by default (Oracle Beehive Gateway v4.0) with ESMTP ; Mon, 08 Apr 2019 06:57:54 -0700 Subject: Re: [PATCH 0/2] Limit number of hw queues by nr_cpu_ids for virtio-blk and virtio-scsi To: linux-scsi@vger.kernel.org, virtualization@lists.linux-foundation.org, linux-block@vger.kernel.org References: <1553682995-5682-1-git-send-email-dongli.zhang@oracle.com> Cc: mst@redhat.com, jasowang@redhat.com, axboe@kernel.dk, jejb@linux.ibm.com, martin.petersen@oracle.com, cohuck@redhat.com, linux-kernel@vger.kernel.org From: Dongli Zhang Message-ID: <8ee49e44-a52c-0596-e18e-7d92da8cef8f@oracle.com> Date: Mon, 8 Apr 2019 21:57:46 +0800 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:45.0) Gecko/20100101 Thunderbird/45.3.0 MIME-Version: 1.0 In-Reply-To: <1553682995-5682-1-git-send-email-dongli.zhang@oracle.com> Content-Type: text/plain; charset=windows-1252 Content-Transfer-Encoding: 7bit X-Proofpoint-Virus-Version: vendor=nai engine=5900 definitions=9220 signatures=668685 X-Proofpoint-Spam-Details: rule=notspam policy=default score=0 suspectscore=0 malwarescore=0 phishscore=0 bulkscore=0 spamscore=0 mlxscore=0 mlxlogscore=854 adultscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.0.1-1810050000 definitions=main-1904080118 X-Proofpoint-Virus-Version: vendor=nai engine=5900 definitions=9220 signatures=668685 X-Proofpoint-Spam-Details: rule=notspam policy=default score=0 priorityscore=1501 malwarescore=0 suspectscore=0 phishscore=0 bulkscore=0 spamscore=0 clxscore=1015 lowpriorityscore=0 mlxscore=0 impostorscore=0 mlxlogscore=880 adultscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.0.1-1810050000 definitions=main-1904080118 Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org ping? Thank you very much! Dongli Zhang On 03/27/2019 06:36 PM, Dongli Zhang wrote: > When tag_set->nr_maps is 1, the block layer limits the number of hw queues > by nr_cpu_ids. No matter how many hw queues are use by > virtio-blk/virtio-scsi, as they both have (tag_set->nr_maps == 1), they > can use at most nr_cpu_ids hw queues. > > In addition, specifically for pci scenario, when the 'num-queues' specified > by qemu is more than maxcpus, virtio-blk/virtio-scsi would not be able to > allocate more than maxcpus vectors in order to have a vector for each > queue. As a result, they fall back into MSI-X with one vector for config > and one shared for queues. > > Considering above reasons, this patch set limits the number of hw queues > used by nr_cpu_ids for both virtio-blk and virtio-scsi. > > ------------------------------------------------------------- > > Here is test result of virtio-scsi: > > qemu cmdline: > > -smp 2,maxcpus=4, \ > -device virtio-scsi-pci,id=scsi0,num_queues=8, \ > -device scsi-hd,drive=drive0,bus=scsi0.0,channel=0,scsi-id=0,lun=0, \ > -drive file=test.img,if=none,id=drive0 > > Although maxcpus=4 and num_queues=8, 4 queues are used while 2 interrupts > are allocated. > > # cat /proc/interrupts > ... ... > 24: 0 0 PCI-MSI 65536-edge virtio0-config > 25: 0 369 PCI-MSI 65537-edge virtio0-virtqueues > ... ... > > # /sys/block/sda/mq/ > 0 1 2 3 ------> 4 queues although qemu sets num_queues=8 > > > With the patch set, there is per-queue interrupt. > > # cat /proc/interrupts > 24: 0 0 PCI-MSI 65536-edge virtio0-config > 25: 0 0 PCI-MSI 65537-edge virtio0-control > 26: 0 0 PCI-MSI 65538-edge virtio0-event > 27: 296 0 PCI-MSI 65539-edge virtio0-request > 28: 0 139 PCI-MSI 65540-edge virtio0-request > 29: 0 0 PCI-MSI 65541-edge virtio0-request > 30: 0 0 PCI-MSI 65542-edge virtio0-request > > # ls /sys/block/sda/mq > 0 1 2 3 > > ------------------------------------------------------------- > > Here is test result of virtio-blk: > > qemu cmdline: > > -smp 2,maxcpus=4, > -device virtio-blk-pci,drive=drive-virtio-disk0,id=virtio-disk0,num-queues=8 > -drive test.img,format=raw,if=none,id=drive-virtio-disk0 > > Although maxcpus=4 and num-queues=8, 4 queues are used while 2 interrupts > are allocated. > > # cat /proc/interrupts > ... ... > 24: 0 0 PCI-MSI 65536-edge virtio0-config > 25: 0 65 PCI-MSI 65537-edge virtio0-virtqueues > ... ... > > # ls /sys/block/vda/mq > 0 1 2 3 -------> 4 queues although qemu sets num_queues=8 > > > With the patch set, there is per-queue interrupt. > > # cat /proc/interrupts > 24: 0 0 PCI-MSI 65536-edge virtio0-config > 25: 64 0 PCI-MSI 65537-edge virtio0-req.0 > 26: 0 10290 PCI-MSI 65538-edge virtio0-req.1 > 27: 0 0 PCI-MSI 65539-edge virtio0-req.2 > 28: 0 0 PCI-MSI 65540-edge virtio0-req.3 > > # ls /sys/block/vda/mq/ > 0 1 2 3 > > > Reference: https://lore.kernel.org/lkml/e4afe4c5-0262-4500-aeec-60f30734b4fc@default/ > > Thank you very much! > > Dongli Zhang >