Received: by 2002:a6b:500f:0:0:0:0:0 with SMTP id e15csp5430790iob; Mon, 9 May 2022 16:35:48 -0700 (PDT) X-Google-Smtp-Source: ABdhPJwCg4/9YEMcwUHjO/x7ECxrc/PFc2OLgOHxbAKa7yasmsCy4/O16Jur9BTDtottlOXMeY6G X-Received: by 2002:a17:90b:1a8a:b0:1dc:ea29:f6a9 with SMTP id ng10-20020a17090b1a8a00b001dcea29f6a9mr16144329pjb.108.1652139348160; Mon, 09 May 2022 16:35:48 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1652139348; cv=none; d=google.com; s=arc-20160816; b=uipVPb6WG4N3H3NfqaeJ5nVvm/mAWnKaAydyOXRj1Jac4ECeMmflf9a6DPrnirTwf3 G1tPHbXjakMhs2XNtz3q9AZM8du1Fs7EQG058CvQMPiE39/qUaZH/I5Gz3eBBKPpM33+ RBYSvTtcooPmI8OpO34jjHtVKUvWWSh5rJBYeXTk54PpO9A8rmwXdJwS0WUtadHdGkt9 JRcCSEX/p4H3sxd0v1ZhMY+Noti8AP0akY8U3cLcbrtG99GL3vR57ODX2/h/OMBZ05r3 gra/i8FJ9IFiAQ7Ma5JGavV+CXn/939un65b9TGUXBJo2IkgMQ36rNVFjyuxiF1f2UnP tUsA== 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=oScRt9r65AzkUG4UGU4eQGB8xkEn+zBqisLCl/Zw22VEDxpap0ETGZMXTJlb4Sk0SE Yj6aooPZpSlITaRLVuWeyJCQ8wxkPH5XrzMFx0JZZSLagbFjn6BBx45TRlHyxMv4Nni3 qyeYwYtZIT3zHa19kdFUzT5AjaEfnOeIoYLSgBBBVNrgQ3EqpPz/DLYkWhLjE9SmHHiD vCakt1BVHJlTe2ZFGb/XOW0/RrCwsu+fwqK6bcyCSimaMPuwD5jhHtOzNv+oufUbz+aa nfW+zM0mzg25ALIUufleMB4MZB5WG7UA/K61xr2qUBqs4B5WO58z+cEkMa8mJXYMh5EW eRgA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@quicinc.com header.s=qcdkim header.b=XoBTw2hh; 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 u185-20020a6385c2000000b003daebbac710si435135pgd.413.2022.05.09.16.35.31; Mon, 09 May 2022 16:35:48 -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=XoBTw2hh; 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 S231309AbiEIVzX (ORCPT + 99 others); Mon, 9 May 2022 17:55:23 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:59422 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231305AbiEIVxs (ORCPT ); Mon, 9 May 2022 17:53:48 -0400 Received: from alexa-out.qualcomm.com (alexa-out.qualcomm.com [129.46.98.28]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 976672CBF8C; Mon, 9 May 2022 14:48:43 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=quicinc.com; i=@quicinc.com; q=dns/txt; s=qcdkim; t=1652132924; x=1683668924; h=from:to:cc:subject:date:message-id:mime-version: content-transfer-encoding; bh=OjuWDuA8wp2pAQhE78hbrB1ZqBopu0NlCqBoV3u9VOM=; b=XoBTw2hh+QTXB8T4ZVkdF914KbEpZdAeK63UZSnuaK7ACsQA53W1Bv95 5hAHUXnngUNCDu9uj2MncyYIlTj3vqENLoD+no9uwphcHoNN/MN+PbTI8 YKQE16xOcT7nO1hUiGcPaH8WtnKC7KgssxdGRu75Q8VaCoL+1MixrAeGN 0=; Received: from ironmsg07-lv.qualcomm.com ([10.47.202.151]) by alexa-out.qualcomm.com with ESMTP; 09 May 2022 14:48:43 -0700 X-QCInternal: smtphost Received: from nasanex01c.na.qualcomm.com ([10.47.97.222]) by ironmsg07-lv.qualcomm.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 09 May 2022 14:48:42 -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; Mon, 9 May 2022 14:48:33 -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; Mon, 9 May 2022 14:48:31 -0700 From: Jeffrey Hugo To: , , , , , , , , CC: , , , , , Jeffrey Hugo Subject: [PATCH 0/2] hyperv compose_msi_msg fixups Date: Mon, 9 May 2022 15:48:20 -0600 Message-ID: <1652132902-27109-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: nasanex01a.na.qualcomm.com (10.52.223.231) To nalasex01a.na.qualcomm.com (10.47.209.196) X-Spam-Status: No, score=-2.8 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_LOW,SPF_HELO_NONE, SPF_PASS,T_SCC_BODY_TEXT_LINE 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