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=-2.6 required=3.0 tests=DKIM_SIGNED,DKIM_VALID, DKIM_VALID_AU,HEADER_FROM_DIFFERENT_DOMAINS,MAILING_LIST_MULTI,SPF_PASS, USER_AGENT_MUTT autolearn=ham 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 73121C10F0E for ; Mon, 8 Apr 2019 01:34:52 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id 3A91720883 for ; Mon, 8 Apr 2019 01:34:52 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (2048-bit key) header.d=linaro.org header.i=@linaro.org header.b="t56JIJp9" Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726465AbfDHBeu (ORCPT ); Sun, 7 Apr 2019 21:34:50 -0400 Received: from mail-yw1-f67.google.com ([209.85.161.67]:45156 "EHLO mail-yw1-f67.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726349AbfDHBeu (ORCPT ); Sun, 7 Apr 2019 21:34:50 -0400 Received: by mail-yw1-f67.google.com with SMTP id j128so4354184ywg.12 for ; Sun, 07 Apr 2019 18:34:50 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=date:from:to:subject:message-id:references:mime-version :content-disposition:in-reply-to:user-agent; bh=94R1PsB3DOvrvTb4L+SuN8cpW6ir/jjUWNee5sxFAwA=; b=t56JIJp9Z+taxl58zDxj126cBjzW2MJrq9M+DRfRtjaaTVGruRWAJZe5wti1xmy0Jk g93iT8KuFUWg6I1pLCRs/WGJI7xfa0vvgOs6ed/QmmQQ9aa3pufT2bBw9HunZ5axZ0tl smsopvTFHG/pkzhH0+JkU9D7tzE22bB3T8n2gHB2MFZBcptNZEjXGY+VKqyvsZs8WBmk xd/gaLn5/7esVa3lBU96DsG+tvYrCpUEpeHdp9B6CdPnK34ZjDNgFv+qr+HthWvSEPKx vMOjdRQdhHZUEQWceBF/YSj3DLP5094id+gfzkCQr9gw5VJI8nSSS0SpDR8Mixi4y5vj LxwA== 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:subject:message-id:references :mime-version:content-disposition:in-reply-to:user-agent; bh=94R1PsB3DOvrvTb4L+SuN8cpW6ir/jjUWNee5sxFAwA=; b=mLje21pmaIhzKI5GLWGN7e+N7ns1QMKTnK3IshH0bXmt1c4eXxqujfsoXTN0Uo/hJA 2oJ8PRwFfUl4j0XmO+Yiu+XOjNJiG3h3XCMFl82Tqi67o4cclJI6aJpebREwLWAFwE/N y6dFHsSxwUseraqE/syN8QwC9DKIF3jggFU239ndqeCmhznUuOrDuv1UsImGRkNmNZnl Tkggoy+t3JM2KfE1JkQTnPqsOZKse/AjKZwNFmuWMVluMLxmOxkLA1cO7Lx7Z5OXOC1I /u6lWf+2pdq67TKAZWWKHGjlC5MaeBLLMreeJfTpwFmn2kIp4YtWKi2tBuz2qWkvkg3p ZKUw== X-Gm-Message-State: APjAAAVYgT/bDAcflK8KGl4r5vXJX6TbQzDwBkjfRj2L9Llsi1eAFt7s qtZF2GHm0Lqv5lTSOh05atDmJRmC2N0LMw3x X-Google-Smtp-Source: APXvYqzn1PliCtFjz8vasmNLaeFoFVGdcqFswu1IclRGeH8o8VoJa06HSp2a43e+Ei1t/KvconLyaw== X-Received: by 2002:a81:1393:: with SMTP id 141mr21053423ywt.140.1554687289666; Sun, 07 Apr 2019 18:34:49 -0700 (PDT) Received: from leoy-ThinkPad-X240s (li931-65.members.linode.com. [45.56.113.65]) by smtp.gmail.com with ESMTPSA id 207sm9641421ywv.9.2019.04.07.18.34.46 (version=TLS1_2 cipher=ECDHE-RSA-CHACHA20-POLY1305 bits=256/256); Sun, 07 Apr 2019 18:34:48 -0700 (PDT) Date: Mon, 8 Apr 2019 09:34:42 +0800 From: Leo Yan To: kvm@vger.kernel.org, kvmarm@lists.cs.columbia.edu, Will Deacon , Marc Zyngier , Jean-Philippe Brucker , Eric Auger , Robin Murphy Subject: Re: [PATCH] vfio-pci: Fix MSI IRQ forwarding for without per-vector masking Message-ID: <20190408013442.GA10011@leoy-ThinkPad-X240s> References: <20190322052308.28254-1-leo.yan@linaro.org> <20190322052924.GB31904@leoy-ThinkPad-X240s> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20190322052924.GB31904@leoy-ThinkPad-X240s> User-Agent: Mutt/1.9.4 (2018-02-28) Sender: kvm-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: kvm@vger.kernel.org Hi Jean-Philippe, On Fri, Mar 22, 2019 at 01:29:24PM +0800, Leo Yan wrote: > On Fri, Mar 22, 2019 at 01:23:08PM +0800, Leo Yan wrote: > > If MSI doesn't support per-vector masking capability and > > PCI_MSI_FLAGS_MASKBIT isn't set in message control field, the function > > vfio_pci_msi_vector_write() will directly bail out for this case and > > every vector's 'virt_state' keeps setting bit VFIO_PCI_MSI_STATE_MASKED. > > > > This results in the state maintained in 'virt_state' cannot really > > reflect the MSI hardware state; finally it will mislead the function > > vfio_pci_update_msi_entry() to skip IRQ forwarding with below flow: > > > > vfio_pci_update_msi_entry() { > > > > [...] > > > > if (msi_is_masked(entry->virt_state) == msi_is_masked(entry->phys_state)) > > return 0; ==> skip IRQ forwarding > > > > [...] > > } > > > > To fix this issue, when detect PCI_MSI_FLAGS_MASKBIT is not set in the > > message control field, this patch simply clears bit > > VFIO_PCI_MSI_STATE_MASKED for all vectors 'virt_state'; at the end > > vfio_pci_update_msi_entry() can forward MSI IRQ successfully. > > Just remind, this patch is for kvmtool but not for kernel. Sorry I > forget to add it in subject. Gentle ping. Not sure if this patch is reasonable, could you help to give a review? [...] Thanks, Leo Yan