From nobody Sun Dec 22 12:24:35 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=cloud.com ARC-Seal: i=1; a=rsa-sha256; t=1728312270; cv=none; d=zohomail.com; s=zohoarc; b=Jzly3rfi0a9J4q/zN4RYLYE0F8kezuJ4Jc9qd1MJ0r58uk+gazGI4uiR4MoeXPwlLj2rTSCTh/itITeaUde9fCDQprh0VS7fhO6pk4khsfWdBBL8Ir3PZpNKU1xQ7IGzimwkEjBlktqouWMwAGefCNFKhVOrv8I8/v7ItdT+RM8= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1728312270; h=Content-Transfer-Encoding:Cc:Cc:Date:Date:From:From:List-Subscribe:List-Post:List-Id:List-Help:List-Unsubscribe:MIME-Version:Message-ID:Sender:Subject:Subject:To:To:Message-Id:Reply-To; bh=sNAC+18oEUnhb5mytedDay7gb4s9baqUanV1IJn4ddk=; b=bSFjbiFNkxa/zKJR/dsHRCu241wO7+vyor/see5f2vm+GTit+du0+SNqgBTwP8nJ6ZmI1gNybjTQ8aBM2OHpwZ7Ofmxedu8Q6E18tfcNGv6hxbihCHiEwAc3V/PfIOTyJbAOXF6TtkP6+AXtTNbEgrI0kxK0Wb2pymCsaneIx+A= 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 1728312270238840.0610583821093; Mon, 7 Oct 2024 07:44:30 -0700 (PDT) Received: from list by lists.xenproject.org with outflank-mailman.812137.1224841 (Exim 4.92) (envelope-from ) id 1sxoxu-000452-3v; Mon, 07 Oct 2024 14:44:02 +0000 Received: by outflank-mailman (output) from mailman id 812137.1224841; Mon, 07 Oct 2024 14:44:02 +0000 Received: from localhost ([127.0.0.1] helo=lists.xenproject.org) by lists.xenproject.org with esmtp (Exim 4.92) (envelope-from ) id 1sxoxu-00044v-0B; Mon, 07 Oct 2024 14:44:02 +0000 Received: by outflank-mailman (input) for mailman id 812137; Mon, 07 Oct 2024 14:44:00 +0000 Received: from se1-gles-flk1-in.inumbo.com ([94.247.172.50] helo=se1-gles-flk1.inumbo.com) by lists.xenproject.org with esmtp (Exim 4.92) (envelope-from ) id 1sxoxs-00042A-8N for xen-devel@lists.xenproject.org; Mon, 07 Oct 2024 14:44:00 +0000 Received: from mail-ed1-x52f.google.com (mail-ed1-x52f.google.com [2a00:1450:4864:20::52f]) by se1-gles-flk1.inumbo.com (Halon) with ESMTPS id 95b417b6-84ba-11ef-99a2-01e77a169b0f; Mon, 07 Oct 2024 16:43:58 +0200 (CEST) Received: by mail-ed1-x52f.google.com with SMTP id 4fb4d7f45d1cf-5c40aea5c40so8814283a12.0 for ; Mon, 07 Oct 2024 07:43:58 -0700 (PDT) Received: from mbarnes-x-u.eng.citrite.net ([185.25.67.249]) by smtp.gmail.com with ESMTPSA id 4fb4d7f45d1cf-5c8e0594944sm3253004a12.20.2024.10.07.07.43.56 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 07 Oct 2024 07:43:57 -0700 (PDT) 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: 95b417b6-84ba-11ef-99a2-01e77a169b0f DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=cloud.com; s=cloud; t=1728312237; x=1728917037; darn=lists.xenproject.org; h=content-transfer-encoding:mime-version:message-id:date:subject:cc :to:from:from:to:cc:subject:date:message-id:reply-to; bh=sNAC+18oEUnhb5mytedDay7gb4s9baqUanV1IJn4ddk=; b=Iao3N16ZYhmyXnB4iiJ8cnKls+Ja74LF117aAu4SneL8cbXfsFp+Z4XQ4h8myZ81f3 eBoURQPlebj/s5R0swcp15mrUwwDBqEdCmiAgAnqtnk/ptstf2bLJbysIqBWJWxb90fu BCbLY8182fPXBzqE/QHGep2E08AdM+PevEzck= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1728312237; x=1728917037; h=content-transfer-encoding:mime-version:message-id:date:subject:cc :to:from:x-gm-message-state:from:to:cc:subject:date:message-id :reply-to; bh=sNAC+18oEUnhb5mytedDay7gb4s9baqUanV1IJn4ddk=; b=tkLxWVNWG1e1VvdZMUNuqlJw3TAIfsJftJBMVAWa8btXluoLe8Nv4uhKuKAd7FDhwy klIJigrzM5G2WeYIY4cororBZgsfxhC6xMeQPy1LuqazVMf+fDS/+93ahR+ZfqC89sBw SzChoy374pulXVN863PHhOv8eflcSJFhM5tMQRB+nX4r02tDvvOGdHZkZBb/hoytUWER YeZJAEIhDECMmr8QUbzP8fDhziPa+VI2o/7XwIyK3iSFj75LpjZYRRVldNdotfttI3mV JXSW+v0TGZaX7+FVmdVZeXv5LPCByB/OEDifnRkONUGf9TkiHyRc/n0EJgoqh0Xg58eJ q1tA== X-Gm-Message-State: AOJu0YzsYwaFOeYSIdY79f7DxB+61FTCVwLl+gUxK1yPM4s4Hz0E+FFK 9PHhatuU46CZ4Gx8AgJPn5/dtfLu2E+10Vajt90G2qmwqynU0zGj6FqIkVxtMV/SI3YDloxpc34 R X-Google-Smtp-Source: AGHT+IHfl/BqmCCe9MxIo313nFBT75bWyhQ42eYn/Vq4XVqWpPa7GUB2WOsV0eiJUkQ4DK1WYnxY+Q== X-Received: by 2002:a05:6402:354d:b0:5c8:97b9:58a6 with SMTP id 4fb4d7f45d1cf-5c8d2f1d9e1mr12054541a12.1.1728312237360; Mon, 07 Oct 2024 07:43:57 -0700 (PDT) From: Matthew Barnes To: xen-devel@lists.xenproject.org Cc: Matthew Barnes , Jan Beulich , Andrew Cooper , =?UTF-8?q?Roger=20Pau=20Monn=C3=A9?= Subject: [PATCH v2] x86/APIC: Switch flat driver to use phys dst for ext ints Date: Mon, 7 Oct 2024 15:34:43 +0100 Message-Id: <0db68e62ffc428f553a30397df1e79068d26bb5f.1728311378.git.matthew.barnes@cloud.com> X-Mailer: git-send-email 2.34.1 MIME-Version: 1.0 Bcc: Matthew Barnes Content-Transfer-Encoding: quoted-printable X-ZohoMail-DKIM: pass (identity @cloud.com) X-ZM-MESSAGEID: 1728312272194116600 Content-Type: text/plain; charset="utf-8" External interrupts via logical delivery mode in xAPIC do not benefit from targeting multiple CPUs and instead simply bloat up the vector space. However the xAPIC flat driver currently uses logical delivery for external interrupts. This patch switches the xAPIC flat driver to use physical destination mode for external interrupts, instead of logical destination mode. This patch also applies the following non-functional changes: - Remove now unused logical flat functions - Expand GENAPIC_FLAT and GENAPIC_PHYS macros, and delete them. Resolves: https://gitlab.com/xen-project/xen/-/issues/194 Signed-off-by: Matthew Barnes Reviewed-by: Roger Pau Monn=C3=A9 --- Changes in v2: - Reword commit message - Expand and delete GENAPIC_* macros - Bundle patch series into one patch --- xen/arch/x86/genapic/bigsmp.c | 8 +++++++- xen/arch/x86/genapic/default.c | 8 +++++++- xen/arch/x86/genapic/delivery.c | 10 ---------- xen/arch/x86/include/asm/genapic.h | 20 +------------------- 4 files changed, 15 insertions(+), 31 deletions(-) diff --git a/xen/arch/x86/genapic/bigsmp.c b/xen/arch/x86/genapic/bigsmp.c index e97e4453a033..b2e721845275 100644 --- a/xen/arch/x86/genapic/bigsmp.c +++ b/xen/arch/x86/genapic/bigsmp.c @@ -46,5 +46,11 @@ static int __init cf_check probe_bigsmp(void) =20 const struct genapic __initconst_cf_clobber apic_bigsmp =3D { APIC_INIT("bigsmp", probe_bigsmp), - GENAPIC_PHYS + .int_delivery_mode =3D dest_Fixed, + .int_dest_mode =3D 0, /* physical delivery */ + .init_apic_ldr =3D init_apic_ldr_phys, + .vector_allocation_cpumask =3D vector_allocation_cpumask_phys, + .cpu_mask_to_apicid =3D cpu_mask_to_apicid_phys, + .send_IPI_mask =3D send_IPI_mask_phys, + .send_IPI_self =3D send_IPI_self_legacy }; diff --git a/xen/arch/x86/genapic/default.c b/xen/arch/x86/genapic/default.c index a968836a1878..59c79afdb8fa 100644 --- a/xen/arch/x86/genapic/default.c +++ b/xen/arch/x86/genapic/default.c @@ -16,5 +16,11 @@ /* should be called last. */ const struct genapic __initconst_cf_clobber apic_default =3D { APIC_INIT("default", NULL), - GENAPIC_FLAT + .int_delivery_mode =3D dest_Fixed, + .int_dest_mode =3D 0, /* physical delivery */ + .init_apic_ldr =3D init_apic_ldr_flat, + .vector_allocation_cpumask =3D vector_allocation_cpumask_phys, + .cpu_mask_to_apicid =3D cpu_mask_to_apicid_phys, + .send_IPI_mask =3D send_IPI_mask_flat, + .send_IPI_self =3D send_IPI_self_legacy }; diff --git a/xen/arch/x86/genapic/delivery.c b/xen/arch/x86/genapic/deliver= y.c index d1f99bf6834a..3def78f380d3 100644 --- a/xen/arch/x86/genapic/delivery.c +++ b/xen/arch/x86/genapic/delivery.c @@ -19,16 +19,6 @@ void cf_check init_apic_ldr_flat(void) apic_write(APIC_LDR, val); } =20 -const cpumask_t *cf_check vector_allocation_cpumask_flat(int cpu) -{ - return &cpu_online_map; -}=20 - -unsigned int cf_check cpu_mask_to_apicid_flat(const cpumask_t *cpumask) -{ - return cpumask_bits(cpumask)[0]&0xFF; -} - /* * PHYSICAL DELIVERY MODE (unicast to physical APIC IDs). */ diff --git a/xen/arch/x86/include/asm/genapic.h b/xen/arch/x86/include/asm/= genapic.h index a694371c6d16..2f46f173c1d4 100644 --- a/xen/arch/x86/include/asm/genapic.h +++ b/xen/arch/x86/include/asm/genapic.h @@ -44,29 +44,11 @@ extern const struct genapic apic_bigsmp; void cf_check send_IPI_self_legacy(uint8_t vector); =20 void cf_check init_apic_ldr_flat(void); -unsigned int cf_check cpu_mask_to_apicid_flat(const cpumask_t *cpumask); +const cpumask_t *cf_check vector_allocation_cpumask_phys(int cpu); void cf_check send_IPI_mask_flat(const cpumask_t *cpumask, int vector); -const cpumask_t *cf_check vector_allocation_cpumask_flat(int cpu); -#define GENAPIC_FLAT \ - .int_delivery_mode =3D dest_LowestPrio, \ - .int_dest_mode =3D 1 /* logical delivery */, \ - .init_apic_ldr =3D init_apic_ldr_flat, \ - .vector_allocation_cpumask =3D vector_allocation_cpumask_flat, \ - .cpu_mask_to_apicid =3D cpu_mask_to_apicid_flat, \ - .send_IPI_mask =3D send_IPI_mask_flat, \ - .send_IPI_self =3D send_IPI_self_legacy =20 void cf_check init_apic_ldr_phys(void); unsigned int cf_check cpu_mask_to_apicid_phys(const cpumask_t *cpumask); void cf_check send_IPI_mask_phys(const cpumask_t *mask, int vector); -const cpumask_t *cf_check vector_allocation_cpumask_phys(int cpu); -#define GENAPIC_PHYS \ - .int_delivery_mode =3D dest_Fixed, \ - .int_dest_mode =3D 0 /* physical delivery */, \ - .init_apic_ldr =3D init_apic_ldr_phys, \ - .vector_allocation_cpumask =3D vector_allocation_cpumask_phys, \ - .cpu_mask_to_apicid =3D cpu_mask_to_apicid_phys, \ - .send_IPI_mask =3D send_IPI_mask_phys, \ - .send_IPI_self =3D send_IPI_self_legacy =20 #endif --=20 2.46.0