Received: by 2002:a6b:500f:0:0:0:0:0 with SMTP id e15csp225283iob; Wed, 11 May 2022 13:03:05 -0700 (PDT) X-Google-Smtp-Source: ABdhPJyhbS2CSHJn4qmjmQgYaCKUH/tXSP1x6ZhfeWEBHty/Fz7KSPS3Cao6TAmDySwkt6D56D38 X-Received: by 2002:a63:af42:0:b0:39d:942c:504b with SMTP id s2-20020a63af42000000b0039d942c504bmr22821101pgo.453.1652299384887; Wed, 11 May 2022 13:03:04 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1652299384; cv=none; d=google.com; s=arc-20160816; b=LdJHIEA7f1J1TKhIJsaJC8HC58ok89YXPvwucxVYh66P/nI8oMft3p/EwHh1DaZN+J A1J8POdp29uPJytNQFFHI4wRPqxPLCGcR0k9gEiRCTIptech6ziKYozIpcpTBaVHHsv6 My6hHgTVHo8/6AQfcb+8nkueV771wUcJgr7O/kX/nG7/ZaL4+cxGJAS9DyN/kxcatS90 OYcD6Eomq0QpcuswtminoDVa3JrznSlQUE87bM9dYqaiLTydGD/X6lvlCyb6ycvHm1Bb E0BDja9nQOT63l9y3rDor6miXqLW28x6MfTpedPvK6LeW7pyPuwZCw0XaSRpGVtz0Dh0 KdMw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :message-id:date:subject:cc:to:from:dkim-signature; bh=OjuWDuA8wp2pAQhE78hbrB1ZqBopu0NlCqBoV3u9VOM=; b=DsHKKoZh0qCGLt6xONWFGa2aX7pgB+FC3i+lPmM7uoVi+mh1JZGR1PGLYAFP8YU1Fm 9elJNLJP/3H3xfukXGvjsFH5URAooqghQLeJoXmv6X2g7Ufzai7INUIMVv4kGYr+qnfa y+uI39Kphq8rmg1gIjlgj2YeJnxY9mFhJAfDNcw7LusyVG455qaUBOELYqtwjUeye4VH ZW6HTx5J2Z1mmryrTDvGZ8CIw0PnZKBXsJG0ImNDJWvmASy4MesVtPEZyhUDpeUq7+fn IaHyh9v1AXOilX+7oOZlurnugtj1Mv/rF4J6pctTssrC65qfGcAKL85b5/VgcrX7VdSE aJmw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@quicinc.com header.s=qcdkim header.b=dYQXk2L1; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=quicinc.com Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id mq4-20020a17090b380400b001d960c22782si966595pjb.158.2022.05.11.13.02.29; Wed, 11 May 2022 13:03:04 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@quicinc.com header.s=qcdkim header.b=dYQXk2L1; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=quicinc.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S234099AbiEKPWd (ORCPT + 99 others); Wed, 11 May 2022 11:22:33 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:36900 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1343532AbiEKPW1 (ORCPT ); Wed, 11 May 2022 11:22:27 -0400 Received: from alexa-out-sd-02.qualcomm.com (alexa-out-sd-02.qualcomm.com [199.106.114.39]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id E9B3A37BF4; Wed, 11 May 2022 08:22:25 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=quicinc.com; i=@quicinc.com; q=dns/txt; s=qcdkim; t=1652282545; x=1683818545; h=from:to:cc:subject:date:message-id:mime-version: content-transfer-encoding; bh=OjuWDuA8wp2pAQhE78hbrB1ZqBopu0NlCqBoV3u9VOM=; b=dYQXk2L1JTYnJ7zzmk7KWVTnC9DVyrWJv52KkP9see6g0gZENfPdjel+ LVzBcwsIVyjQeTKa/5QxiGdJLtC1yDOQCrUybbbx/dPEU4v6rS4QBxwgN iHXQ8ho105YnHxAfPq3dhbKcdQ4Cu6MS2yqaUcNJl7SDAalPHdX5DyADL 0=; Received: from unknown (HELO ironmsg-SD-alpha.qualcomm.com) ([10.53.140.30]) by alexa-out-sd-02.qualcomm.com with ESMTP; 11 May 2022 08:22:25 -0700 X-QCInternal: smtphost Received: from nasanex01c.na.qualcomm.com ([10.47.97.222]) by ironmsg-SD-alpha.qualcomm.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 11 May 2022 08:22:25 -0700 Received: from nalasex01a.na.qualcomm.com (10.47.209.196) by nasanex01c.na.qualcomm.com (10.47.97.222) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.2.986.22; Wed, 11 May 2022 08:22:25 -0700 Received: from jhugo-lnx.qualcomm.com (10.80.80.8) by nalasex01a.na.qualcomm.com (10.47.209.196) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.2.986.22; Wed, 11 May 2022 08:22:24 -0700 From: Jeffrey Hugo To: , , , , , , , , CC: , , , , , Jeffrey Hugo Subject: [PATCH v2 0/2] hyperv compose_msi_msg fixups Date: Wed, 11 May 2022 09:22:11 -0600 Message-ID: <1652282533-21502-1-git-send-email-quic_jhugo@quicinc.com> X-Mailer: git-send-email 2.7.4 MIME-Version: 1.0 Content-Transfer-Encoding: 7bit Content-Type: text/plain X-Originating-IP: [10.80.80.8] X-ClientProxiedBy: nasanex01b.na.qualcomm.com (10.46.141.250) To nalasex01a.na.qualcomm.com (10.47.209.196) X-Spam-Status: No, score=-4.4 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_MED,SPF_HELO_NONE, SPF_PASS,T_SCC_BODY_TEXT_LINE,URIBL_BLOCKED autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org While multi-MSI appears to work with pci-hyperv.c, there was a concern about how linux was doing the ITRE allocations. Patch 2 addresses the concern. However, patch 2 exposed an issue with how compose_msi_msg() was freeing a previous allocation when called for the Nth time. Imagine a driver using pci_alloc_irq_vectors() to request 32 MSIs. This would cause compose_msi_msg() to be called 32 times, once for each MSI. With patch 2, MSI0 would allocate the ITREs needed, and MSI1-31 would use the cached information. Then the driver uses request_irq() on MSI1-17. This would call compose_msi_msg() again on those MSIs, which would again use the cached information. Then unmask() would be called to retarget the MSIs to the right VCPU vectors. Finally, the driver calls request_irq() on MSI0. This would call conpose_msi_msg(), which would free the block of 32 MSIs, and allocate a new block. This would undo the retarget of MSI1-17, and likely leave those MSIs targeting invalid VCPU vectors. This is addressed by patch 1, which is introduced first to prevent a regression. Jeffrey Hugo (2): PCI: hv: Reuse existing ITRE allocation in compose_msi_msg() PCI: hv: Fix interrupt mapping for multi-MSI drivers/pci/controller/pci-hyperv.c | 76 ++++++++++++++++++++++++++++--------- 1 file changed, 59 insertions(+), 17 deletions(-) -- 2.7.4