From nobody Thu Dec 26 19:03:28 2024 Delivered-To: importer@patchew.org Received-SPF: pass (zohomail.com: domain of lists.xenproject.org designates 192.237.175.120 as permitted sender) client-ip=192.237.175.120; envelope-from=xen-devel-bounces@lists.xenproject.org; helo=lists.xenproject.org; Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of lists.xenproject.org designates 192.237.175.120 as permitted sender) smtp.mailfrom=xen-devel-bounces@lists.xenproject.org; dmarc=pass(p=reject dis=none) header.from=citrix.com ARC-Seal: i=1; a=rsa-sha256; t=1732102586; cv=none; d=zohomail.com; s=zohoarc; b=mMLJJi9WpQJcaZMLgSGV6KKlCLsQZ0rBqfzTxyPJhuzOqoTpiVZMLU3FUJQW4iU4zTSzKfHTHtZ2rFB0AHWIfGyoH5GE/u07ljiqUBSpsOULsMbf8Cgggu33cA1ffFBwPwm8vqc+FDOCKo00SBQSWoJ/qTLo4M1Qj5V9FTB9nEo= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1732102586; h=Content-Type:Content-Transfer-Encoding:Cc:Cc:Date:Date:From:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:Subject:To:To:Message-Id:Reply-To; bh=86sTbQPzilf+WSdJgcVW1D6hKA0N+3C25zpjw6B93xw=; b=j+M7ZJLSy0HkWL53CvP+5hQ+DyrV1hiOZ482Zh0Al6h+n65MC5GdtcNBYp0AiT8/W5COVqil/1VuNm2DTI2IqvyMi01bxcpnXnKBJRTZp8tdtDKYydXa8wPi2kGKhBmfn4Oeg0ki4avSVwkXojRbmOjBo3bRVBDYaOHM5KjmSk8= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of lists.xenproject.org designates 192.237.175.120 as permitted sender) smtp.mailfrom=xen-devel-bounces@lists.xenproject.org; dmarc=pass header.from= (p=reject dis=none) Return-Path: Received: from lists.xenproject.org (lists.xenproject.org [192.237.175.120]) by mx.zohomail.com with SMTPS id 173210258609835.72171069641536; Wed, 20 Nov 2024 03:36:26 -0800 (PST) Received: from list by lists.xenproject.org with outflank-mailman.841043.1256559 (Exim 4.92) (envelope-from ) id 1tDj09-00018v-6S; Wed, 20 Nov 2024 11:36:05 +0000 Received: by outflank-mailman (output) from mailman id 841043.1256559; Wed, 20 Nov 2024 11:36:05 +0000 Received: from localhost ([127.0.0.1] helo=lists.xenproject.org) by lists.xenproject.org with esmtp (Exim 4.92) (envelope-from ) id 1tDj09-000184-1n; Wed, 20 Nov 2024 11:36:05 +0000 Received: by outflank-mailman (input) for mailman id 841043; Wed, 20 Nov 2024 11:36:03 +0000 Received: from se1-gles-sth1-in.inumbo.com ([159.253.27.254] helo=se1-gles-sth1.inumbo.com) by lists.xenproject.org with esmtp (Exim 4.92) (envelope-from ) id 1tDj07-00015s-HJ for xen-devel@lists.xenproject.org; Wed, 20 Nov 2024 11:36:03 +0000 Received: from mail-ej1-x62a.google.com (mail-ej1-x62a.google.com [2a00:1450:4864:20::62a]) by se1-gles-sth1.inumbo.com (Halon) with ESMTPS id 9dd6be19-a733-11ef-a0cb-8be0dac302b0; Wed, 20 Nov 2024 12:36:00 +0100 (CET) Received: by mail-ej1-x62a.google.com with SMTP id a640c23a62f3a-a9aa8895facso355704066b.2 for ; Wed, 20 Nov 2024 03:36:00 -0800 (PST) Received: from localhost ([213.195.123.63]) by smtp.gmail.com with ESMTPSA id a640c23a62f3a-aa20e086058sm766537066b.184.2024.11.20.03.35.59 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 20 Nov 2024 03:35:59 -0800 (PST) X-Outflank-Mailman: Message body and most headers restored to incoming version X-BeenThere: xen-devel@lists.xenproject.org List-Id: Xen developer discussion List-Unsubscribe: , List-Post: List-Help: List-Subscribe: , Errors-To: xen-devel-bounces@lists.xenproject.org Precedence: list Sender: "Xen-devel" X-Inumbo-ID: 9dd6be19-a733-11ef-a0cb-8be0dac302b0 X-Custom-Connection: eyJyZW1vdGVpcCI6IjJhMDA6MTQ1MDo0ODY0OjIwOjo2MmEiLCJoZWxvIjoibWFpbC1lajEteDYyYS5nb29nbGUuY29tIn0= X-Custom-Transaction: eyJpZCI6IjlkZDZiZTE5LWE3MzMtMTFlZi1hMGNiLThiZTBkYWMzMDJiMCIsInRzIjoxNzMyMTAyNTYwLjY2Mjc0MSwic2VuZGVyIjoicm9nZXIucGF1QGNsb3VkLmNvbSIsInJlY2lwaWVudCI6Inhlbi1kZXZlbEBsaXN0cy54ZW5wcm9qZWN0Lm9yZyJ9 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=citrix.com; s=google; t=1732102560; x=1732707360; darn=lists.xenproject.org; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=86sTbQPzilf+WSdJgcVW1D6hKA0N+3C25zpjw6B93xw=; b=bFjDmi0csSktofm3JPgjwCD5E5oET0MZ+rgZiyMZxelvtGht12oBDocUgiSI+HezQ9 X6b1c9WPA9iCh6YZcidxpg5XgJyeU0sv3PGK7Fen86pSf2rPynYZ2SJluMS37fqjIMbW KS2weP2Y0+w5PHZfMFaZRbxQXR1ojFWT8lEQ8= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1732102560; x=1732707360; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=86sTbQPzilf+WSdJgcVW1D6hKA0N+3C25zpjw6B93xw=; b=QqeqD/nlMOFDTo+/UzXXfmUYPHlhWJPiTwrN+hHKX7oCnYcqyFlNcqx/1/t1icafTP vwD2IEZvHWOcAV3kR6uTG8U8RwBuVB7Ge+snYOyYhhGOs7ilUpxOor5p6A5Qc9ip5fWn rtVnLIRypgrcWS8/Qfdw+EZ6VEjz8XyoMom2ga1ryvlf1co7/Mt4oeHF8IL2lWZu3bt7 a1wtI+HAzfYq0rS/jGv6nR3whb4WvdoWhgrVwkBr8QBUiX3OpgmfPRIecDQB0PSKsIaL NVR337Iz+vbqRZ0dmTbq5HOdEo+2cRS+hRR5Cnv5L9R45n1qxueV5k0eoIRii6npqoEb A38g== X-Gm-Message-State: AOJu0YyX+qiingvUNdaoXQ19gyHhmtaAUISFAri0wg+VJt2gL32vsk63 BzZRZJxxXZY6GjvfPQFeSEZyFkoUVzF6VgMugeWnKSXQxm3A0yHqNyJVoY1bbMZmdMNAEzhrdI2 Y X-Google-Smtp-Source: AGHT+IFo4N9LnGujJoDz1RqufZwRegILqY9+Yy/YBA3+QwwcYfB0R6VoUFM8Z5hR6fBQ0o0l2/PjjQ== X-Received: by 2002:a17:907:2da2:b0:a9f:450:48eb with SMTP id a640c23a62f3a-aa4dd71a2c0mr206835866b.45.1732102559783; Wed, 20 Nov 2024 03:35:59 -0800 (PST) From: Roger Pau Monne To: xen-devel@lists.xenproject.org Cc: Roger Pau Monne , Jan Beulich , Andrew Cooper Subject: [PATCH 1/2] x86/irq: fix calculation of max PV dom0 pIRQs Date: Wed, 20 Nov 2024 12:35:54 +0100 Message-ID: <20241120113555.38146-2-roger.pau@citrix.com> X-Mailer: git-send-email 2.46.0 In-Reply-To: <20241120113555.38146-1-roger.pau@citrix.com> References: <20241120113555.38146-1-roger.pau@citrix.com> MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable X-ZohoMail-DKIM: pass (identity @citrix.com) X-ZM-MESSAGEID: 1732102588045116600 The current calculation of PV dom0 pIRQs uses: n =3D min(fls(num_present_cpus()), dom0_max_vcpus()); The usage of fls() is wrong, as num_present_cpus() already returns the numb= er of present CPUs, not the bitmap mask of CPUs. Fix by removing the usage of fls(). Fixes: 7e73a6e7f12a ('have architectures specify the number of PIRQs a hard= ware domain gets') Signed-off-by: Roger Pau Monn=C3=A9 Acked-by: Andrew Cooper --- xen/arch/x86/io_apic.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/xen/arch/x86/io_apic.c b/xen/arch/x86/io_apic.c index d44d2c9a4173..bd5ad61c85e4 100644 --- a/xen/arch/x86/io_apic.c +++ b/xen/arch/x86/io_apic.c @@ -2744,7 +2744,7 @@ void __init ioapic_init(void) =20 unsigned int __hwdom_init arch_hwdom_irqs(const struct domain *d) { - unsigned int n =3D fls(num_present_cpus()); + unsigned int n =3D num_present_cpus(); /* Bounding by the domain pirq EOI bitmap capacity. */ const unsigned int max_irqs =3D min_t(unsigned int, nr_irqs, PAGE_SIZE * BITS_PER_BYTE); --=20 2.46.0 From nobody Thu Dec 26 19:03:28 2024 Delivered-To: importer@patchew.org Received-SPF: pass (zohomail.com: domain of lists.xenproject.org designates 192.237.175.120 as permitted sender) client-ip=192.237.175.120; envelope-from=xen-devel-bounces@lists.xenproject.org; helo=lists.xenproject.org; Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of lists.xenproject.org designates 192.237.175.120 as permitted sender) smtp.mailfrom=xen-devel-bounces@lists.xenproject.org; dmarc=pass(p=reject dis=none) header.from=citrix.com ARC-Seal: i=1; a=rsa-sha256; t=1732102587; cv=none; d=zohomail.com; s=zohoarc; b=WGxvXy8SQw74k3XS2nxtEyR3kHmYm6Rp+GGivokOk0RxaGy/6t2l59WTWcc6ZJK+LY25k7ERtOjz98DAN0ehlQrm18M/tHYurthhGlrN27hPjXHnM1OajRzrMcy6yd79coO2uzyTAv3Xusfnz68hPLxz5+QmccuPHTp9gcJ0J8k= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1732102587; h=Content-Type:Content-Transfer-Encoding:Cc:Cc:Date:Date:From:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:Subject:To:To:Message-Id:Reply-To; bh=RQSY1kHyaToiV6Map5orTQSUjEPRAZ9huo43+UBo760=; b=JRPfIgfjn5nRnr5SLbASuaGCZHiYwsxayYLHPnpv9qG+lLthhGz4FQ+SUI9KjKbd6TYhrhGsh28v4kvEeP1lokuvxfl4qy7syD2KN8VfWGLNJgOGqRrHr8QXGsT2w91K0mKWjuldOPX/SJW0nG6FOu6HYMSqszSEbaAexNGeFSQ= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of lists.xenproject.org designates 192.237.175.120 as permitted sender) smtp.mailfrom=xen-devel-bounces@lists.xenproject.org; dmarc=pass header.from= (p=reject dis=none) Return-Path: Received: from lists.xenproject.org (lists.xenproject.org [192.237.175.120]) by mx.zohomail.com with SMTPS id 17321025878591006.9614565746219; Wed, 20 Nov 2024 03:36:27 -0800 (PST) Received: from list by lists.xenproject.org with outflank-mailman.841044.1256574 (Exim 4.92) (envelope-from ) id 1tDj0A-0001Yv-Gu; Wed, 20 Nov 2024 11:36:06 +0000 Received: by outflank-mailman (output) from mailman id 841044.1256574; Wed, 20 Nov 2024 11:36:06 +0000 Received: from localhost ([127.0.0.1] helo=lists.xenproject.org) by lists.xenproject.org with esmtp (Exim 4.92) (envelope-from ) id 1tDj0A-0001Yo-E7; Wed, 20 Nov 2024 11:36:06 +0000 Received: by outflank-mailman (input) for mailman id 841044; Wed, 20 Nov 2024 11:36:06 +0000 Received: from se1-gles-sth1-in.inumbo.com ([159.253.27.254] helo=se1-gles-sth1.inumbo.com) by lists.xenproject.org with esmtp (Exim 4.92) (envelope-from ) id 1tDj0A-00015s-2q for xen-devel@lists.xenproject.org; Wed, 20 Nov 2024 11:36:06 +0000 Received: from mail-ej1-x629.google.com (mail-ej1-x629.google.com [2a00:1450:4864:20::629]) by se1-gles-sth1.inumbo.com (Halon) with ESMTPS id 9e80d060-a733-11ef-a0cb-8be0dac302b0; Wed, 20 Nov 2024 12:36:01 +0100 (CET) Received: by mail-ej1-x629.google.com with SMTP id a640c23a62f3a-aa4b439c5e8so562294566b.2 for ; Wed, 20 Nov 2024 03:36:01 -0800 (PST) Received: from localhost ([213.195.123.63]) by smtp.gmail.com with ESMTPSA id a640c23a62f3a-aa20df2649esm755526366b.39.2024.11.20.03.36.00 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 20 Nov 2024 03:36:00 -0800 (PST) X-Outflank-Mailman: Message body and most headers restored to incoming version X-BeenThere: xen-devel@lists.xenproject.org List-Id: Xen developer discussion List-Unsubscribe: , List-Post: List-Help: List-Subscribe: , Errors-To: xen-devel-bounces@lists.xenproject.org Precedence: list Sender: "Xen-devel" X-Inumbo-ID: 9e80d060-a733-11ef-a0cb-8be0dac302b0 X-Custom-Connection: eyJyZW1vdGVpcCI6IjJhMDA6MTQ1MDo0ODY0OjIwOjo2MjkiLCJoZWxvIjoibWFpbC1lajEteDYyOS5nb29nbGUuY29tIn0= X-Custom-Transaction: eyJpZCI6IjllODBkMDYwLWE3MzMtMTFlZi1hMGNiLThiZTBkYWMzMDJiMCIsInRzIjoxNzMyMTAyNTYxLjc3NzUzMSwic2VuZGVyIjoicm9nZXIucGF1QGNsb3VkLmNvbSIsInJlY2lwaWVudCI6Inhlbi1kZXZlbEBsaXN0cy54ZW5wcm9qZWN0Lm9yZyJ9 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=citrix.com; s=google; t=1732102561; x=1732707361; darn=lists.xenproject.org; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=RQSY1kHyaToiV6Map5orTQSUjEPRAZ9huo43+UBo760=; b=dY5e27T7SfsMrhD7Nzcmx+9VLT88sAw7FU4V3A2f+6fPE9shIYisIH/1Et2CoroHf2 t+5a8jV+8nz7VPZdp8j+N/7CFs8QSkPW9k5FrzduEzbMyAUZyDS7c6ujgLpyGTyUaWgt xUgEHAsgD5vnnz0CymjeRdg+hsMA8bBaFyW6E= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1732102561; x=1732707361; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=RQSY1kHyaToiV6Map5orTQSUjEPRAZ9huo43+UBo760=; b=QfoFjtfmwjfAND+BGOGiyIs67VFNPFoI/HvSsQL1qatp4MhqFRRkOUJK8aCvOA0Snq 9lzx17t6diWLFWBKssfIr51/SzOK39Fxqv0bBt4FJmmlxVkPiqZug8wZXaEgd29G17AD Us/ciLaqo+x5Os9/Dt6vXnozswlqwZLKIwj8EV1LjFe0KKKudPNR700fD1azSB45ePLp LcJ32ZbFwGFdYao5s3TmYi+rHxfD3s5KnwNgjGLxGqbIFbQiga6FA7nSInnbHHqy/jIq j/4eohf06Ie+0PIKS25bHaEh6/tED6um2oN3Nfk/fSfZnE3IIfvFlHu1/IsJV2nCUTvi UIaQ== X-Gm-Message-State: AOJu0YzWyDTFGfBBA0HingArRDHwnNnfSBag5+Z1YdOuKTpg5EToM2Hu EKYi05ZBOZYmRFZ7zvC587VEhgbDqQb0Q9QplVLgdCpPU1qMUCmwSChGhFbRW25U1qit8pP7I/B 7 X-Google-Smtp-Source: AGHT+IGpZBq/GRWTh1h/9HD7eEUOqw/KxHkCjxJBMTWI/j6IunYPvvZdkZpWu6/W1mvxx1/CyuPH5A== X-Received: by 2002:a17:906:fe0d:b0:aa4:777d:73b5 with SMTP id a640c23a62f3a-aa4dd551bd2mr213101866b.21.1732102560951; Wed, 20 Nov 2024 03:36:00 -0800 (PST) From: Roger Pau Monne To: xen-devel@lists.xenproject.org Cc: Roger Pau Monne , Jan Beulich , Andrew Cooper Subject: [PATCH 2/2] x86/pvh: also print hardware domain pIRQ limit for PVH Date: Wed, 20 Nov 2024 12:35:55 +0100 Message-ID: <20241120113555.38146-3-roger.pau@citrix.com> X-Mailer: git-send-email 2.46.0 In-Reply-To: <20241120113555.38146-1-roger.pau@citrix.com> References: <20241120113555.38146-1-roger.pau@citrix.com> MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable X-ZohoMail-DKIM: pass (identity @citrix.com) X-ZM-MESSAGEID: 1732102589813116600 Do not return early in the PVH/HVM case, so that the number of pIRQs is also printed. Fixes: 17f6d398f765 ('cmdline: document and enforce "extra_guest_irqs" uppe= r bounds') Signed-off-by: Roger Pau Monn=C3=A9 Reviewed-by: Andrew Cooper --- xen/arch/x86/io_apic.c | 12 +++++++----- 1 file changed, 7 insertions(+), 5 deletions(-) diff --git a/xen/arch/x86/io_apic.c b/xen/arch/x86/io_apic.c index bd5ad61c85e4..d9db2efc4f58 100644 --- a/xen/arch/x86/io_apic.c +++ b/xen/arch/x86/io_apic.c @@ -2754,11 +2754,13 @@ unsigned int __hwdom_init arch_hwdom_irqs(const str= uct domain *d) =20 /* PVH (generally: HVM) can't use PHYSDEVOP_pirq_eoi_gmfn_v{1,2}. */ if ( is_hvm_domain(d) ) - return nr_irqs; - - if ( !d->domain_id ) - n =3D min(n, dom0_max_vcpus()); - n =3D min(nr_irqs_gsi + n * NR_DYNAMIC_VECTORS, max_irqs); + n =3D nr_irqs; + else + { + if ( !d->domain_id ) + n =3D min(n, dom0_max_vcpus()); + n =3D min(nr_irqs_gsi + n * NR_DYNAMIC_VECTORS, max_irqs); + } =20 printk("%pd has maximum %u PIRQs\n", d, n); =20 --=20 2.46.0