From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-16.1 required=3.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,HEADER_FROM_DIFFERENT_DOMAINS, INCLUDES_CR_TRAILER,INCLUDES_PATCH,MAILING_LIST_MULTI,SPF_HELO_NONE,SPF_PASS, URIBL_BLOCKED autolearn=unavailable autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 61BD6C11F6A for ; Fri, 2 Jul 2021 15:55:51 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id 44968613FE for ; Fri, 2 Jul 2021 15:55:51 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S229807AbhGBP6V (ORCPT ); Fri, 2 Jul 2021 11:58:21 -0400 Received: from us-smtp-delivery-124.mimecast.com ([216.205.24.124]:22878 "EHLO us-smtp-delivery-124.mimecast.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231757AbhGBP6V (ORCPT ); Fri, 2 Jul 2021 11:58:21 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1625241348; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: in-reply-to:in-reply-to:references:references; bh=508AyhKpE8jUDrBFR0nb6Agup3ldPNqzk6KlIwcdo6g=; b=LpvTfE/Xx+XxBOBEfTmUYI/QfsjpiHQc0Gu+BHHdR3yz83mUE4ooCVhgda5bWfcA1zOBTW xytcClIOyvL59dXXPT824g80VpkdOa4Jesx3/C9QvjSknNLBabkhiZnNXeUNvEjRA+6v1r dj9+KQW/eQiIvFkwdJ6vEK9nSAZeJMc= Received: from mail-wm1-f72.google.com (mail-wm1-f72.google.com [209.85.128.72]) (Using TLS) by relay.mimecast.com with ESMTP id us-mta-459-JomhaFF6NAmtyieHslVtnA-1; Fri, 02 Jul 2021 11:55:47 -0400 X-MC-Unique: JomhaFF6NAmtyieHslVtnA-1 Received: by mail-wm1-f72.google.com with SMTP id k16-20020a7bc3100000b02901d849b41038so6401822wmj.7 for ; Fri, 02 Jul 2021 08:55:47 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:date:from:to:cc:subject:message-id:references :mime-version:content-disposition:in-reply-to; bh=508AyhKpE8jUDrBFR0nb6Agup3ldPNqzk6KlIwcdo6g=; b=mGBPHerdmQYiwm8J9nJWki6dyGKYK6mO80xVmaQi8QnRzznWRTqaOKP38mRND9+pxe LknqCK4mL9BkS6rnAk2RvibWLj9ouP0uUgPK9tnmBOUSfTITx4jUc+lNt0HzwUmP1/dk uxOo7mY1wCzyuqRESI3TQdH5W/0Ek8WZpDVhXq4NUtI2dJh0v7vD8sfsBXjg+NERMOdd NjPxXu4E80xy9GG3oUtENhk70m7v2G99t33s53UnmAW03XhegUglL2lDIUShEpXvikaU MSLxLHXovSJhOD210wCW1wJO4bc/nJUy7jEf/FGPXvFAE0vlp4HLgcYxFJol88dZj86q YEuw== X-Gm-Message-State: AOAM533MadYxSSGM8smSTzRtv9LjLc23WqXPigxLPIyq7PGhyxjdg502 +jyg16AQfy8W7IXr/rzJbq+HRC7WZfQ/FEOZXpTa/qhgAyfsZsDyAWrg6u2whEkvcZocg8yfjbq Y7SRUDuwDcVIwtPE0rSb31ng= X-Received: by 2002:a1c:1dd1:: with SMTP id d200mr205140wmd.82.1625241346471; Fri, 02 Jul 2021 08:55:46 -0700 (PDT) X-Google-Smtp-Source: ABdhPJw5g/VM21EKC5p1b+bedRgUGipGzZg9oN5IehHhOj+/WVKmexFW92+hQHKujHlDSVZapekDzw== X-Received: by 2002:a1c:1dd1:: with SMTP id d200mr205117wmd.82.1625241346342; Fri, 02 Jul 2021 08:55:46 -0700 (PDT) Received: from redhat.com ([2.55.4.39]) by smtp.gmail.com with ESMTPSA id n12sm4180006wmq.5.2021.07.02.08.55.42 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 02 Jul 2021 08:55:45 -0700 (PDT) Date: Fri, 2 Jul 2021 11:55:40 -0400 From: "Michael S. Tsirkin" To: Ming Lei Cc: Jens Axboe , Christoph Hellwig , "Martin K . Petersen" , linux-block@vger.kernel.org, linux-nvme@lists.infradead.org, linux-scsi@vger.kernel.org, Sagi Grimberg , Daniel Wagner , Wen Xiong , John Garry , Hannes Reinecke , Keith Busch , Damien Le Moal , Jason Wang , virtualization@lists.linux-foundation.org Subject: Re: [PATCH V2 5/6] virtio: add one field into virtio_device for recording if device uses managed irq Message-ID: <20210702115430-mutt-send-email-mst@kernel.org> References: <20210702150555.2401722-1-ming.lei@redhat.com> <20210702150555.2401722-6-ming.lei@redhat.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20210702150555.2401722-6-ming.lei@redhat.com> Precedence: bulk List-ID: X-Mailing-List: linux-block@vger.kernel.org On Fri, Jul 02, 2021 at 11:05:54PM +0800, Ming Lei wrote: > blk-mq needs to know if the device uses managed irq, so add one field > to virtio_device for recording if device uses managed irq. > > If the driver use managed irq, this flag has to be set so it can be > passed to blk-mq. > > Cc: "Michael S. Tsirkin" > Cc: Jason Wang > Cc: virtualization@lists.linux-foundation.org > Signed-off-by: Ming Lei The API seems somewhat confusing. virtio does not request a managed irq as such, does it? I think it's a decision taken by the irq core. Any way to query the irq to find out if it's managed? > --- > drivers/block/virtio_blk.c | 2 ++ > drivers/scsi/virtio_scsi.c | 1 + > drivers/virtio/virtio_pci_common.c | 1 + > include/linux/virtio.h | 1 + > 4 files changed, 5 insertions(+) > > diff --git a/drivers/block/virtio_blk.c b/drivers/block/virtio_blk.c > index e4bd3b1fc3c2..33b9c80ac475 100644 > --- a/drivers/block/virtio_blk.c > +++ b/drivers/block/virtio_blk.c > @@ -764,6 +764,8 @@ static int virtblk_probe(struct virtio_device *vdev) > vblk->tag_set.queue_depth = queue_depth; > vblk->tag_set.numa_node = NUMA_NO_NODE; > vblk->tag_set.flags = BLK_MQ_F_SHOULD_MERGE; > + if (vdev->use_managed_irq) > + vblk->tag_set.flags |= BLK_MQ_F_MANAGED_IRQ; > vblk->tag_set.cmd_size = > sizeof(struct virtblk_req) + > sizeof(struct scatterlist) * sg_elems; > diff --git a/drivers/scsi/virtio_scsi.c b/drivers/scsi/virtio_scsi.c > index b9c86a7e3b97..f301917abc84 100644 > --- a/drivers/scsi/virtio_scsi.c > +++ b/drivers/scsi/virtio_scsi.c > @@ -891,6 +891,7 @@ static int virtscsi_probe(struct virtio_device *vdev) > shost->max_channel = 0; > shost->max_cmd_len = VIRTIO_SCSI_CDB_SIZE; > shost->nr_hw_queues = num_queues; > + shost->use_managed_irq = vdev->use_managed_irq; > > #ifdef CONFIG_BLK_DEV_INTEGRITY > if (virtio_has_feature(vdev, VIRTIO_SCSI_F_T10_PI)) { > diff --git a/drivers/virtio/virtio_pci_common.c b/drivers/virtio/virtio_pci_common.c > index 222d630c41fc..f2ac48fb477b 100644 > --- a/drivers/virtio/virtio_pci_common.c > +++ b/drivers/virtio/virtio_pci_common.c > @@ -128,6 +128,7 @@ static int vp_request_msix_vectors(struct virtio_device *vdev, int nvectors, > if (desc) { > flags |= PCI_IRQ_AFFINITY; > desc->pre_vectors++; /* virtio config vector */ > + vdev->use_managed_irq = true; > } > > err = pci_alloc_irq_vectors_affinity(vp_dev->pci_dev, nvectors, > diff --git a/include/linux/virtio.h b/include/linux/virtio.h > index b1894e0323fa..85cc773b2dc7 100644 > --- a/include/linux/virtio.h > +++ b/include/linux/virtio.h > @@ -109,6 +109,7 @@ struct virtio_device { > bool failed; > bool config_enabled; > bool config_change_pending; > + bool use_managed_irq; > spinlock_t config_lock; > struct device dev; > struct virtio_device_id id; > -- > 2.31.1 From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-14.1 required=3.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,HEADER_FROM_DIFFERENT_DOMAINS,INCLUDES_CR_TRAILER, INCLUDES_PATCH,MAILING_LIST_MULTI,SPF_HELO_NONE,SPF_PASS,URIBL_BLOCKED autolearn=unavailable autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 81092C11F68 for ; Fri, 2 Jul 2021 15:56:07 +0000 (UTC) Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.133]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id 47D45613F7 for ; Fri, 2 Jul 2021 15:56:07 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 47D45613F7 Authentication-Results: mail.kernel.org; dmarc=fail (p=none dis=none) header.from=redhat.com Authentication-Results: mail.kernel.org; spf=none smtp.mailfrom=linux-nvme-bounces+linux-nvme=archiver.kernel.org@lists.infradead.org DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20210309; h=Sender: Content-Transfer-Encoding:Content-Type:List-Subscribe:List-Help:List-Post: List-Archive:List-Unsubscribe:List-Id:In-Reply-To:MIME-Version:References: Message-ID:Subject:Cc:To:From:Date:Reply-To:Content-ID:Content-Description: Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID: List-Owner; bh=RwgRj9tjVCPeO8dxo7sYXBxZ7mDBH710c+cDCc3brsw=; b=ExWnCAsbTfxH/Q kgGq1QFoLpVcFpgHUEVPpIWquPJuRwTKp8JMogAKSdQhQVm9MRLZKaP8yKs1EwLIACfeb8Er1sj5N jLw9wEe7ZVlYYCr87aQuRazmpN5MRCF975PHEk4/IhO1YqgysRSrovq531N3zQUEgAXt5gw4zw2qh EVInTeR5o+jBBCaJHpT/HUnfe2RKbmtkPtzutsQqRudoQheAc1dnwOHaUNPKRTiUQ/EkrvvqzxYI/ hMoaq6fQM1ML/CM7xz8vqDTZFMm/OodCkjW42bBHfeyKDob9q9zr/JwM0tO1ep0y95L6q3NH1aB+z 3VyOgXuLfaqJKM2zAy+Q==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.94.2 #2 (Red Hat Linux)) id 1lzLWF-003THV-NZ; Fri, 02 Jul 2021 15:55:55 +0000 Received: from us-smtp-delivery-124.mimecast.com ([216.205.24.124]) by bombadil.infradead.org with esmtps (Exim 4.94.2 #2 (Red Hat Linux)) id 1lzLWC-003TGP-GB for linux-nvme@lists.infradead.org; Fri, 02 Jul 2021 15:55:54 +0000 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1625241350; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: in-reply-to:in-reply-to:references:references; bh=508AyhKpE8jUDrBFR0nb6Agup3ldPNqzk6KlIwcdo6g=; b=e81EbUvOC8uYnJq5JoJalPrmgLYULa0Qia/Uu+D1GEWaq+8IpxS94jiknI3cETft/ggnnn mFbLIqczCguCvfGmeYRvjMUM/5xHCGwf10YpqUcFSPF/CFt2oe0cQj8B5T6R12cUFsPBb7 EQpDkHMorjds7EC0D7kKVG6dGDYCoQg= Received: from mail-wm1-f72.google.com (mail-wm1-f72.google.com [209.85.128.72]) (Using TLS) by relay.mimecast.com with ESMTP id us-mta-459-yJ6sObgxMYqtYp8lgMx78g-1; Fri, 02 Jul 2021 11:55:47 -0400 X-MC-Unique: yJ6sObgxMYqtYp8lgMx78g-1 Received: by mail-wm1-f72.google.com with SMTP id n37-20020a05600c3ba5b02901fe49ba3bd0so1078605wms.1 for ; Fri, 02 Jul 2021 08:55:47 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:date:from:to:cc:subject:message-id:references :mime-version:content-disposition:in-reply-to; bh=508AyhKpE8jUDrBFR0nb6Agup3ldPNqzk6KlIwcdo6g=; b=uTU0/qYLccMp5hEGRMlmIesfFa6XNvndGviX0B8l2LSk5awtECHxQU+XdwlltD1YFg KlZb0fDqiQGOzNDGtGJGcblRHalVYRT/+v3nileycRahE0F5No7DkGsZEklMoRKzWmbZ 5NKsKdBs7m2IpP3MGrJr5LuMTwn0rkNnIfltI8Js7GYlPiRkXl3s5//7X8Rdgv4szy/5 h/jJL1IzvBre5pmzCi+E0z8p6Ml5EblQkCkG8GIc0gZ0GRP+KiyuJJOZm45uZ6g1Uzmf LokpiKPZ368n+VttqA1Z206GLWdRLtprfBlfTc2pEPLOvMKQMm8prgfzDi72MgoVDgHC dfLA== X-Gm-Message-State: AOAM532FzhqHBIns/84+AuEOZ4v81oTmlMA9rKPS7e1Xs/hbakKdSsDp /NmivFnQVMX1Ig6N5oyeM2Il5Zc2/1yQ7OEq4ndYHsG9G4asOTk06yxQiL86y36SlU5B/KH36cS 0TvrqPAtTTh6BM+eCXBo6D3dVI9c= X-Received: by 2002:a1c:1dd1:: with SMTP id d200mr205135wmd.82.1625241346471; Fri, 02 Jul 2021 08:55:46 -0700 (PDT) X-Google-Smtp-Source: ABdhPJw5g/VM21EKC5p1b+bedRgUGipGzZg9oN5IehHhOj+/WVKmexFW92+hQHKujHlDSVZapekDzw== X-Received: by 2002:a1c:1dd1:: with SMTP id d200mr205117wmd.82.1625241346342; Fri, 02 Jul 2021 08:55:46 -0700 (PDT) Received: from redhat.com ([2.55.4.39]) by smtp.gmail.com with ESMTPSA id n12sm4180006wmq.5.2021.07.02.08.55.42 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 02 Jul 2021 08:55:45 -0700 (PDT) Date: Fri, 2 Jul 2021 11:55:40 -0400 From: "Michael S. Tsirkin" To: Ming Lei Cc: Jens Axboe , Christoph Hellwig , "Martin K . Petersen" , linux-block@vger.kernel.org, linux-nvme@lists.infradead.org, linux-scsi@vger.kernel.org, Sagi Grimberg , Daniel Wagner , Wen Xiong , John Garry , Hannes Reinecke , Keith Busch , Damien Le Moal , Jason Wang , virtualization@lists.linux-foundation.org Subject: Re: [PATCH V2 5/6] virtio: add one field into virtio_device for recording if device uses managed irq Message-ID: <20210702115430-mutt-send-email-mst@kernel.org> References: <20210702150555.2401722-1-ming.lei@redhat.com> <20210702150555.2401722-6-ming.lei@redhat.com> MIME-Version: 1.0 In-Reply-To: <20210702150555.2401722-6-ming.lei@redhat.com> Authentication-Results: relay.mimecast.com; auth=pass smtp.auth=CUSA124A263 smtp.mailfrom=mst@redhat.com X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com Content-Disposition: inline X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20210702_085552_660896_C3032D6D X-CRM114-Status: GOOD ( 25.01 ) X-BeenThere: linux-nvme@lists.infradead.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Sender: "Linux-nvme" Errors-To: linux-nvme-bounces+linux-nvme=archiver.kernel.org@lists.infradead.org On Fri, Jul 02, 2021 at 11:05:54PM +0800, Ming Lei wrote: > blk-mq needs to know if the device uses managed irq, so add one field > to virtio_device for recording if device uses managed irq. > > If the driver use managed irq, this flag has to be set so it can be > passed to blk-mq. > > Cc: "Michael S. Tsirkin" > Cc: Jason Wang > Cc: virtualization@lists.linux-foundation.org > Signed-off-by: Ming Lei The API seems somewhat confusing. virtio does not request a managed irq as such, does it? I think it's a decision taken by the irq core. Any way to query the irq to find out if it's managed? > --- > drivers/block/virtio_blk.c | 2 ++ > drivers/scsi/virtio_scsi.c | 1 + > drivers/virtio/virtio_pci_common.c | 1 + > include/linux/virtio.h | 1 + > 4 files changed, 5 insertions(+) > > diff --git a/drivers/block/virtio_blk.c b/drivers/block/virtio_blk.c > index e4bd3b1fc3c2..33b9c80ac475 100644 > --- a/drivers/block/virtio_blk.c > +++ b/drivers/block/virtio_blk.c > @@ -764,6 +764,8 @@ static int virtblk_probe(struct virtio_device *vdev) > vblk->tag_set.queue_depth = queue_depth; > vblk->tag_set.numa_node = NUMA_NO_NODE; > vblk->tag_set.flags = BLK_MQ_F_SHOULD_MERGE; > + if (vdev->use_managed_irq) > + vblk->tag_set.flags |= BLK_MQ_F_MANAGED_IRQ; > vblk->tag_set.cmd_size = > sizeof(struct virtblk_req) + > sizeof(struct scatterlist) * sg_elems; > diff --git a/drivers/scsi/virtio_scsi.c b/drivers/scsi/virtio_scsi.c > index b9c86a7e3b97..f301917abc84 100644 > --- a/drivers/scsi/virtio_scsi.c > +++ b/drivers/scsi/virtio_scsi.c > @@ -891,6 +891,7 @@ static int virtscsi_probe(struct virtio_device *vdev) > shost->max_channel = 0; > shost->max_cmd_len = VIRTIO_SCSI_CDB_SIZE; > shost->nr_hw_queues = num_queues; > + shost->use_managed_irq = vdev->use_managed_irq; > > #ifdef CONFIG_BLK_DEV_INTEGRITY > if (virtio_has_feature(vdev, VIRTIO_SCSI_F_T10_PI)) { > diff --git a/drivers/virtio/virtio_pci_common.c b/drivers/virtio/virtio_pci_common.c > index 222d630c41fc..f2ac48fb477b 100644 > --- a/drivers/virtio/virtio_pci_common.c > +++ b/drivers/virtio/virtio_pci_common.c > @@ -128,6 +128,7 @@ static int vp_request_msix_vectors(struct virtio_device *vdev, int nvectors, > if (desc) { > flags |= PCI_IRQ_AFFINITY; > desc->pre_vectors++; /* virtio config vector */ > + vdev->use_managed_irq = true; > } > > err = pci_alloc_irq_vectors_affinity(vp_dev->pci_dev, nvectors, > diff --git a/include/linux/virtio.h b/include/linux/virtio.h > index b1894e0323fa..85cc773b2dc7 100644 > --- a/include/linux/virtio.h > +++ b/include/linux/virtio.h > @@ -109,6 +109,7 @@ struct virtio_device { > bool failed; > bool config_enabled; > bool config_change_pending; > + bool use_managed_irq; > spinlock_t config_lock; > struct device dev; > struct virtio_device_id id; > -- > 2.31.1 _______________________________________________ Linux-nvme mailing list Linux-nvme@lists.infradead.org http://lists.infradead.org/mailman/listinfo/linux-nvme From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-13.6 required=3.0 tests=BAYES_00,DKIM_INVALID, DKIM_SIGNED,HEADER_FROM_DIFFERENT_DOMAINS,INCLUDES_CR_TRAILER,INCLUDES_PATCH, MAILING_LIST_MULTI,SPF_HELO_NONE,SPF_PASS,URIBL_BLOCKED autolearn=unavailable autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 9EF0AC11F68 for ; Fri, 2 Jul 2021 15:55:53 +0000 (UTC) Received: from smtp3.osuosl.org (smtp3.osuosl.org [140.211.166.136]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id 36BA8613FB for ; Fri, 2 Jul 2021 15:55:53 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 36BA8613FB Authentication-Results: mail.kernel.org; dmarc=fail (p=none dis=none) header.from=redhat.com Authentication-Results: mail.kernel.org; spf=pass smtp.mailfrom=virtualization-bounces@lists.linux-foundation.org Received: from localhost (localhost [127.0.0.1]) by smtp3.osuosl.org (Postfix) with ESMTP id EC24960725; Fri, 2 Jul 2021 15:55:52 +0000 (UTC) X-Virus-Scanned: amavisd-new at osuosl.org Received: from smtp3.osuosl.org ([127.0.0.1]) by localhost (smtp3.osuosl.org [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id 7tsckb1FW1ae; Fri, 2 Jul 2021 15:55:52 +0000 (UTC) Received: from lists.linuxfoundation.org (lf-lists.osuosl.org [IPv6:2605:bc80:3010:104::8cd3:938]) by smtp3.osuosl.org (Postfix) with ESMTPS id 8FA8060B5C; Fri, 2 Jul 2021 15:55:51 +0000 (UTC) Received: from lf-lists.osuosl.org (localhost [127.0.0.1]) by lists.linuxfoundation.org (Postfix) with ESMTP id 6D91DC001A; Fri, 2 Jul 2021 15:55:51 +0000 (UTC) Received: from smtp2.osuosl.org (smtp2.osuosl.org [140.211.166.133]) by lists.linuxfoundation.org (Postfix) with ESMTP id B09ECC000E for ; Fri, 2 Jul 2021 15:55:50 +0000 (UTC) Received: from localhost (localhost [127.0.0.1]) by smtp2.osuosl.org (Postfix) with ESMTP id 91591401C0 for ; Fri, 2 Jul 2021 15:55:50 +0000 (UTC) X-Virus-Scanned: amavisd-new at osuosl.org Authentication-Results: smtp2.osuosl.org (amavisd-new); dkim=pass (1024-bit key) header.d=redhat.com Received: from smtp2.osuosl.org ([127.0.0.1]) by localhost (smtp2.osuosl.org [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id V5eKHFmSCZgQ for ; Fri, 2 Jul 2021 15:55:49 +0000 (UTC) X-Greylist: domain auto-whitelisted by SQLgrey-1.8.0 Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [216.205.24.124]) by smtp2.osuosl.org (Postfix) with ESMTPS id BF93940103 for ; Fri, 2 Jul 2021 15:55:49 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1625241348; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: in-reply-to:in-reply-to:references:references; bh=508AyhKpE8jUDrBFR0nb6Agup3ldPNqzk6KlIwcdo6g=; b=LpvTfE/Xx+XxBOBEfTmUYI/QfsjpiHQc0Gu+BHHdR3yz83mUE4ooCVhgda5bWfcA1zOBTW xytcClIOyvL59dXXPT824g80VpkdOa4Jesx3/C9QvjSknNLBabkhiZnNXeUNvEjRA+6v1r dj9+KQW/eQiIvFkwdJ6vEK9nSAZeJMc= Received: from mail-wr1-f70.google.com (mail-wr1-f70.google.com [209.85.221.70]) (Using TLS) by relay.mimecast.com with ESMTP id us-mta-399-zvMjgoNYM5WCm7FN7eq1jg-1; Fri, 02 Jul 2021 11:55:47 -0400 X-MC-Unique: zvMjgoNYM5WCm7FN7eq1jg-1 Received: by mail-wr1-f70.google.com with SMTP id v18-20020adfa1d20000b029012c379fbc45so3537328wrv.22 for ; Fri, 02 Jul 2021 08:55:47 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:date:from:to:cc:subject:message-id:references :mime-version:content-disposition:in-reply-to; bh=508AyhKpE8jUDrBFR0nb6Agup3ldPNqzk6KlIwcdo6g=; b=SOsAqjSW9KIf3MC+pgZRSVxpQesdia5HZf0y7UE3/soF5NP5hS0tctBfEOyESdwODh dWkQ5tr54sHETVA7rj0BR8IDCj92JmBecNh0/JzVUpKO1oQCEo8CBM+zcz/Y7VYLx30h xY/z4iWF5iATnvKZ2JkoeaB5DoGqlh8JfzjwS2PcZupMhaAgx7lzjDOY6dp3zjGGgMKu kvyA5cK9/aO9ulPZhnqMwtI4y0ekCaZ7YSUL+HkApZcaZywxJZ3fjYEDfLrgFhEYVcyt t6I2w+mli5qzGNYK0izS/ov7eYGl1FrYQB8jJv32IVBYaFyZtWMsksrpaJjhDBmnhA+Z b6vQ== X-Gm-Message-State: AOAM533bW5BPMPHq4Z+0uARPbRfQx6acFNH3excbawvAb2D//opKmpq3 Ct+zrOOg2uitJe2eE7eSBABjdkrXXZmOio00kEgRHB1PeocuQB1ABqHIc5U0haD4d+Rn65hqY/G uBdZsH/1AyUZ0Bx7Kto25oGJfP/vf6DMb7zkDRcGV+w== X-Received: by 2002:a1c:1dd1:: with SMTP id d200mr205142wmd.82.1625241346472; Fri, 02 Jul 2021 08:55:46 -0700 (PDT) X-Google-Smtp-Source: ABdhPJw5g/VM21EKC5p1b+bedRgUGipGzZg9oN5IehHhOj+/WVKmexFW92+hQHKujHlDSVZapekDzw== X-Received: by 2002:a1c:1dd1:: with SMTP id d200mr205117wmd.82.1625241346342; Fri, 02 Jul 2021 08:55:46 -0700 (PDT) Received: from redhat.com ([2.55.4.39]) by smtp.gmail.com with ESMTPSA id n12sm4180006wmq.5.2021.07.02.08.55.42 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 02 Jul 2021 08:55:45 -0700 (PDT) Date: Fri, 2 Jul 2021 11:55:40 -0400 From: "Michael S. Tsirkin" To: Ming Lei Subject: Re: [PATCH V2 5/6] virtio: add one field into virtio_device for recording if device uses managed irq Message-ID: <20210702115430-mutt-send-email-mst@kernel.org> References: <20210702150555.2401722-1-ming.lei@redhat.com> <20210702150555.2401722-6-ming.lei@redhat.com> MIME-Version: 1.0 In-Reply-To: <20210702150555.2401722-6-ming.lei@redhat.com> Authentication-Results: relay.mimecast.com; auth=pass smtp.auth=CUSA124A263 smtp.mailfrom=mst@redhat.com X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com Content-Disposition: inline Cc: Jens Axboe , Damien Le Moal , John Garry , linux-scsi@vger.kernel.org, "Martin K . Petersen" , Daniel Wagner , linux-nvme@lists.infradead.org, virtualization@lists.linux-foundation.org, linux-block@vger.kernel.org, Keith Busch , Wen Xiong , Christoph Hellwig , Sagi Grimberg X-BeenThere: virtualization@lists.linux-foundation.org X-Mailman-Version: 2.1.15 Precedence: list List-Id: Linux virtualization List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Errors-To: virtualization-bounces@lists.linux-foundation.org Sender: "Virtualization" On Fri, Jul 02, 2021 at 11:05:54PM +0800, Ming Lei wrote: > blk-mq needs to know if the device uses managed irq, so add one field > to virtio_device for recording if device uses managed irq. > > If the driver use managed irq, this flag has to be set so it can be > passed to blk-mq. > > Cc: "Michael S. Tsirkin" > Cc: Jason Wang > Cc: virtualization@lists.linux-foundation.org > Signed-off-by: Ming Lei The API seems somewhat confusing. virtio does not request a managed irq as such, does it? I think it's a decision taken by the irq core. Any way to query the irq to find out if it's managed? > --- > drivers/block/virtio_blk.c | 2 ++ > drivers/scsi/virtio_scsi.c | 1 + > drivers/virtio/virtio_pci_common.c | 1 + > include/linux/virtio.h | 1 + > 4 files changed, 5 insertions(+) > > diff --git a/drivers/block/virtio_blk.c b/drivers/block/virtio_blk.c > index e4bd3b1fc3c2..33b9c80ac475 100644 > --- a/drivers/block/virtio_blk.c > +++ b/drivers/block/virtio_blk.c > @@ -764,6 +764,8 @@ static int virtblk_probe(struct virtio_device *vdev) > vblk->tag_set.queue_depth = queue_depth; > vblk->tag_set.numa_node = NUMA_NO_NODE; > vblk->tag_set.flags = BLK_MQ_F_SHOULD_MERGE; > + if (vdev->use_managed_irq) > + vblk->tag_set.flags |= BLK_MQ_F_MANAGED_IRQ; > vblk->tag_set.cmd_size = > sizeof(struct virtblk_req) + > sizeof(struct scatterlist) * sg_elems; > diff --git a/drivers/scsi/virtio_scsi.c b/drivers/scsi/virtio_scsi.c > index b9c86a7e3b97..f301917abc84 100644 > --- a/drivers/scsi/virtio_scsi.c > +++ b/drivers/scsi/virtio_scsi.c > @@ -891,6 +891,7 @@ static int virtscsi_probe(struct virtio_device *vdev) > shost->max_channel = 0; > shost->max_cmd_len = VIRTIO_SCSI_CDB_SIZE; > shost->nr_hw_queues = num_queues; > + shost->use_managed_irq = vdev->use_managed_irq; > > #ifdef CONFIG_BLK_DEV_INTEGRITY > if (virtio_has_feature(vdev, VIRTIO_SCSI_F_T10_PI)) { > diff --git a/drivers/virtio/virtio_pci_common.c b/drivers/virtio/virtio_pci_common.c > index 222d630c41fc..f2ac48fb477b 100644 > --- a/drivers/virtio/virtio_pci_common.c > +++ b/drivers/virtio/virtio_pci_common.c > @@ -128,6 +128,7 @@ static int vp_request_msix_vectors(struct virtio_device *vdev, int nvectors, > if (desc) { > flags |= PCI_IRQ_AFFINITY; > desc->pre_vectors++; /* virtio config vector */ > + vdev->use_managed_irq = true; > } > > err = pci_alloc_irq_vectors_affinity(vp_dev->pci_dev, nvectors, > diff --git a/include/linux/virtio.h b/include/linux/virtio.h > index b1894e0323fa..85cc773b2dc7 100644 > --- a/include/linux/virtio.h > +++ b/include/linux/virtio.h > @@ -109,6 +109,7 @@ struct virtio_device { > bool failed; > bool config_enabled; > bool config_change_pending; > + bool use_managed_irq; > spinlock_t config_lock; > struct device dev; > struct virtio_device_id id; > -- > 2.31.1 _______________________________________________ Virtualization mailing list Virtualization@lists.linux-foundation.org https://lists.linuxfoundation.org/mailman/listinfo/virtualization