Received: by 2002:a05:7412:8d10:b0:f3:1519:9f41 with SMTP id bj16csp2119859rdb; Thu, 7 Dec 2023 20:50:54 -0800 (PST) X-Google-Smtp-Source: AGHT+IH+3yv8c8eFbcpU6nA+M2CHY8D9FHTNmvytiacZPFZ2MZoj69bIJ7pVfJqJQhbEjGCgiLZw X-Received: by 2002:a05:6358:249b:b0:170:87e:78d with SMTP id m27-20020a056358249b00b00170087e078dmr4016354rwc.19.1702011054158; Thu, 07 Dec 2023 20:50:54 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1702011054; cv=none; d=google.com; s=arc-20160816; b=oX/haC7yoXEry+8NRAkqoaNozNx3SRJMHxo6oOUZjArVdhwBSpiVAm7cgDgN3Zhxfe 3zLIsrapiOkZaMe7Ky42D3B5fuxWL9VMWsS+TDSggS82h6VNcRhmW43gfCN/TTDcSZ9Y o80kzbueMiu70i4eVQWPYFUM4S83eOOFKv3W9Apwc3ZSIGrSCkfl3XRhgEoZ5oihzKkR emBMmNcNvA0e9M2w0yjh1oIbnOjkmaad8kliCoLjr7dK4FLJl1JnC9Dpw4xdKxvUogPy vX5qr5e+7F4+hIs55sfOyHEqQNrBrz3VCifD5S+DlRhxyLOwuS0eDMDVwJJ55Ktr0LLk ilVA== 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 :organization:references:in-reply-to:message-id:subject:cc:to:from :date:dkim-signature; bh=c++sKtq/cN4AgdsFXRtiv6kfTi2lzxVvbJYTRYSX3uM=; fh=ZvpbeHpP0Y0v3u+CaZzOwTVebjaGJIGbrjWY8xhkDeQ=; b=0LVubO4Q6qN48arDvwlzfeZgt0fJqcl5PLzIOjq6c+9ttOpW/BFTGeqxg/896XcJpS WwyXh6/TCLsIy41C664oLe604vigERL5U5MrBvy5vtS8iNTSGAdbgORLHGM4vi2GX6EL u54bqh5tzVN5Hyfx0rjHzFNkeOwqCbTbL9GtBkmtdLCYUAvEqlsuPRnfoqFmk/cj6IOp hNdzEucmeZUqek9sQpibA5+1l3Oq6OvhDXESOnDwmwY0daRTB1/lSrfMclDoZ/9DSa19 UJ/l+JJicV6hNZQmZNzlptgtb1KoGvc24cDzaXgJXkP07JCwDyxORANEfVI0M5ekrDPR v2gQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@intel.com header.s=Intel header.b=FmG95ClQ; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:5 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=intel.com Return-Path: Received: from groat.vger.email (groat.vger.email. [2620:137:e000::3:5]) by mx.google.com with ESMTPS id t5-20020a62d145000000b006ce72ca697asi884189pfl.251.2023.12.07.20.50.53 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 07 Dec 2023 20:50:54 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:5 as permitted sender) client-ip=2620:137:e000::3:5; Authentication-Results: mx.google.com; dkim=pass header.i=@intel.com header.s=Intel header.b=FmG95ClQ; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:5 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=intel.com Received: from out1.vger.email (depot.vger.email [IPv6:2620:137:e000::3:0]) by groat.vger.email (Postfix) with ESMTP id 8ADF68232672; Thu, 7 Dec 2023 20:50:51 -0800 (PST) X-Virus-Status: Clean X-Virus-Scanned: clamav-milter 0.103.11 at groat.vger.email Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S235659AbjLHEth (ORCPT + 99 others); Thu, 7 Dec 2023 23:49:37 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:56104 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S232855AbjLHEtf (ORCPT ); Thu, 7 Dec 2023 23:49:35 -0500 Received: from mgamail.intel.com (mgamail.intel.com [192.198.163.11]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 0CB4C10DF; Thu, 7 Dec 2023 20:49:39 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1702010980; x=1733546980; h=date:from:to:cc:subject:message-id:in-reply-to: references:mime-version:content-transfer-encoding; bh=rRbc8jEQsK6Twf+fS79kJj0RpcKvEBd0c38qzLKizrs=; b=FmG95ClQIe54FWVvc3yFxeqksYWIK91V0GT3JDNc26rWa2rN/W3/FnMf PpPLs2NgjKce7nkfFaN4p+pXG+kVR6n0aKc5+r4PuXx6gu9aa6hQITJvi UCXOdmUufAL++dpjFlLFaEhqXmKOTm4zdVemZhxcHfQ7djr/3SDFuK9HI vfowd+T6aFg5fyCpDzU/NeQrwl9zb6SjLHNA4G6aMArtgu2wBQUoWAxS3 1jJCMxLijT3VPmU2pQuC9zrRqh9kR6N8RjiOmYM51zZwPKRunxa6ABlIO EvZtTaPljzaFBBhUuzRf1059LhoiAcD6dBdpvFCnilVZt832LqXq+yHj5 w==; X-IronPort-AV: E=McAfee;i="6600,9927,10917"; a="1180700" X-IronPort-AV: E=Sophos;i="6.04,259,1695711600"; d="scan'208";a="1180700" Received: from orsmga007.jf.intel.com ([10.7.209.58]) by fmvoesa105.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 07 Dec 2023 20:49:39 -0800 X-ExtLoop1: 1 X-IronPort-AV: E=McAfee;i="6600,9927,10917"; a="765363581" X-IronPort-AV: E=Sophos;i="6.04,259,1695711600"; d="scan'208";a="765363581" Received: from jacob-builder.jf.intel.com (HELO jacob-builder) ([10.24.100.114]) by orsmga007-auth.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 07 Dec 2023 20:49:38 -0800 Date: Thu, 7 Dec 2023 20:54:31 -0800 From: Jacob Pan To: Thomas Gleixner Cc: LKML , X86 Kernel , iommu@lists.linux.dev, Lu Baolu , kvm@vger.kernel.org, Dave Hansen , Joerg Roedel , "H. Peter Anvin" , Borislav Petkov , Ingo Molnar , Raj Ashok , "Tian, Kevin" , maz@kernel.org, peterz@infradead.org, seanjc@google.com, Robin Murphy , jacob.jun.pan@linux.intel.com Subject: Re: [PATCH RFC 01/13] x86: Move posted interrupt descriptor out of vmx code Message-ID: <20231207205431.75a214c2@jacob-builder> In-Reply-To: <87wmtruw87.ffs@tglx> References: <20231112041643.2868316-1-jacob.jun.pan@linux.intel.com> <20231112041643.2868316-2-jacob.jun.pan@linux.intel.com> <87wmtruw87.ffs@tglx> Organization: OTC X-Mailer: Claws Mail 3.17.5 (GTK+ 2.24.32; x86_64-pc-linux-gnu) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: quoted-printable X-Spam-Status: No, score=-0.8 required=5.0 tests=DKIMWL_WL_HIGH,DKIM_SIGNED, DKIM_VALID,HEADER_FROM_DIFFERENT_DOMAINS,MAILING_LIST_MULTI, SPF_HELO_NONE,SPF_PASS,T_SCC_BODY_TEXT_LINE autolearn=unavailable autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on groat.vger.email Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-Greylist: Sender passed SPF test, not delayed by milter-greylist-4.6.4 (groat.vger.email [0.0.0.0]); Thu, 07 Dec 2023 20:50:51 -0800 (PST) Hi Thomas, On Wed, 06 Dec 2023 17:33:28 +0100, Thomas Gleixner wrote: > On Sat, Nov 11 2023 at 20:16, Jacob Pan wrote: > > +/* Posted-Interrupt Descriptor */ > > +struct pi_desc { > > + u32 pir[8]; /* Posted interrupt requested */ > > + union { > > + struct { > > + /* bit 256 - Outstanding Notification > > */ > > + u16 on : 1, > > + /* bit 257 - Suppress Notification */ > > + sn : 1, > > + /* bit 271:258 - Reserved */ > > + rsvd_1 : 14; > > + /* bit 279:272 - Notification Vector */ > > + u8 nv; > > + /* bit 287:280 - Reserved */ > > + u8 rsvd_2; > > + /* bit 319:288 - Notification > > Destination */ > > + u32 ndst; =20 >=20 > This mixture of bitfields and types is weird and really not intuitive: >=20 > /* Posted-Interrupt Descriptor */ > struct pi_desc { > /* Posted interrupt requested */ > u32 pir[8]; >=20 > union { > struct { > /* bit 256 - Outstanding Notification */ > u64 on : 1, > /* bit 257 - Suppress Notification */ > sn : 1, > /* bit 271:258 - Reserved */ > : 14, > /* bit 279:272 - Notification Vector */ > nv : 8, > /* bit 287:280 - Reserved */ > : 8, > /* bit 319:288 - Notification Destination > */ ndst : 32; > }; > u64 control; > }; > u32 rsvd[6]; > } __aligned(64); >=20 It seems bit-fields cannot pass type check. I got these compile error. arch/x86/kernel/irq.c: In function =E2=80=98intel_posted_msi_init=E2=80=99: ./include/linux/percpu-defs.h:363:20: error: cannot take address of bit-fie= ld =E2=80=98nv=E2=80=99 363 | __verify_pcpu_ptr(&(variable)); \ | ^ ./include/linux/percpu-defs.h:219:47: note: in definition of macro =E2=80= =98__verify_pcpu_ptr=E2=80=99 219 | const void __percpu *__vpp_verify =3D (typeof((ptr) + 0))NULL; \ | ^~~ ./include/linux/percpu-defs.h:490:34: note: in expansion of macro =E2=80=98= __pcpu_size_call=E2=80=99 490 | #define this_cpu_write(pcp, val) __pcpu_size_call(this_cpu_write_, = pcp, val) | ^~~~~~~~~~~~~~~~ arch/x86/kernel/irq.c:358:2: note: in expansion of macro =E2=80=98this_cpu_= write=E2=80=99 358 | this_cpu_write(posted_interrupt_desc.nv, POSTED_MSI_NOTIFICATION_V= ECTOR); | ^~~~~~~~~~~~~~ ./include/linux/percpu-defs.h:364:15: error: =E2=80=98sizeof=E2=80=99 appli= ed to a bit-field 364 | switch(sizeof(variable)) { \ >=20 > > +static inline bool pi_test_and_set_on(struct pi_desc *pi_desc) > > +{ > > + return test_and_set_bit(POSTED_INTR_ON, > > + (unsigned long *)&pi_desc->control); =20 >=20 > Please get rid of those line breaks. will do. Thanks, Jacob