From nobody Fri May 17 18:29:06 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; 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 Return-Path: Received: from lists.xenproject.org (lists.xenproject.org [192.237.175.120]) by mx.zohomail.com with SMTPS id 1697638757904548.4281078793863; Wed, 18 Oct 2023 07:19:17 -0700 (PDT) Received: from list by lists.xenproject.org with outflank-mailman.618595.962442 (Exim 4.92) (envelope-from ) id 1qt7Ny-0005UC-UL; Wed, 18 Oct 2023 14:18:58 +0000 Received: by outflank-mailman (output) from mailman id 618595.962442; Wed, 18 Oct 2023 14:18:58 +0000 Received: from localhost ([127.0.0.1] helo=lists.xenproject.org) by lists.xenproject.org with esmtp (Exim 4.92) (envelope-from ) id 1qt7Ny-0005U5-RO; Wed, 18 Oct 2023 14:18:58 +0000 Received: by outflank-mailman (input) for mailman id 618595; Wed, 18 Oct 2023 14:18:57 +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 1qt7Nx-0004vw-B0 for xen-devel@lists.xenproject.org; Wed, 18 Oct 2023 14:18:57 +0000 Received: from support.bugseng.com (mail.bugseng.com [162.55.131.47]) by se1-gles-flk1.inumbo.com (Halon) with ESMTPS id 44dd416c-6dc1-11ee-9b0e-b553b5be7939; Wed, 18 Oct 2023 16:18:54 +0200 (CEST) Received: from beta.station (net-188-218-250-245.cust.vodafonedsl.it [188.218.250.245]) by support.bugseng.com (Postfix) with ESMTPSA id 4169E4EE0740; Wed, 18 Oct 2023 16:18:54 +0200 (CEST) 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: 44dd416c-6dc1-11ee-9b0e-b553b5be7939 From: Simone Ballarin To: xen-devel@lists.xenproject.org Cc: consulting@bugseng.com, sstabellini@kernel.org, Simone Ballarin , Julien Grall , Bertrand Marquis , Volodymyr Babchuk Subject: [XEN PATCH 1/4] xen/arm: address violations of MISRA C:2012 Rule 13.1 Date: Wed, 18 Oct 2023 16:18:48 +0200 Message-Id: <31a926a09dfcef43d13a402fd3b235aeba48009d.1697638210.git.simone.ballarin@bugseng.com> X-Mailer: git-send-email 2.34.1 In-Reply-To: References: MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable X-ZM-MESSAGEID: 1697638758389100002 Content-Type: text/plain; charset="utf-8" Rule 13.1: Initializer lists shall not contain persistent side effects This patch moves expressions with side-effects into new variables before the initializer lists. Function calls do not necessarily have side-effects, in these cases the GCC pure or const attributes are added when possible. No functional changes. Signed-off-by: Simone Ballarin --- Function attributes pure and const do not need to be added as GCC attributes, they can be added using ECLAIR configurations. --- xen/arch/arm/device.c | 6 +++--- xen/arch/arm/guestcopy.c | 12 ++++++++---- xen/arch/arm/include/asm/current.h | 2 +- 3 files changed, 12 insertions(+), 8 deletions(-) diff --git a/xen/arch/arm/device.c b/xen/arch/arm/device.c index 1f631d3274..e9be078415 100644 --- a/xen/arch/arm/device.c +++ b/xen/arch/arm/device.c @@ -319,6 +319,8 @@ int handle_device(struct domain *d, struct dt_device_no= de *dev, p2m_type_t p2mt, int res; paddr_t addr, size; bool own_device =3D !dt_device_for_passthrough(dev); + bool dev_is_hostbridge =3D is_pci_passthrough_enabled() && + device_get_class(dev) =3D=3D DEVICE_PCI_HOSTB= RIDGE; /* * We want to avoid mapping the MMIO in dom0 for the following cases: * - The device is owned by dom0 (i.e. it has been flagged for @@ -329,9 +331,7 @@ int handle_device(struct domain *d, struct dt_device_no= de *dev, p2m_type_t p2mt, struct map_range_data mr_data =3D { .d =3D d, .p2mt =3D p2mt, - .skip_mapping =3D !own_device || - (is_pci_passthrough_enabled() && - (device_get_class(dev) =3D=3D DEVICE_PCI_HOSTBRIDG= E)), + .skip_mapping =3D !own_device || dev_is_hostbridge, .iomem_ranges =3D iomem_ranges, .irq_ranges =3D irq_ranges }; diff --git a/xen/arch/arm/guestcopy.c b/xen/arch/arm/guestcopy.c index 6716b03561..3ec6743bf6 100644 --- a/xen/arch/arm/guestcopy.c +++ b/xen/arch/arm/guestcopy.c @@ -109,27 +109,31 @@ static unsigned long copy_guest(void *buf, uint64_t a= ddr, unsigned int len, =20 unsigned long raw_copy_to_guest(void *to, const void *from, unsigned int l= en) { + struct vcpu *current_vcpu =3D current; return copy_guest((void *)from, (vaddr_t)to, len, - GVA_INFO(current), COPY_to_guest | COPY_linear); + GVA_INFO(current_vcpu), COPY_to_guest | COPY_linear); } =20 unsigned long raw_copy_to_guest_flush_dcache(void *to, const void *from, unsigned int len) { - return copy_guest((void *)from, (vaddr_t)to, len, GVA_INFO(current), + struct vcpu *current_vcpu =3D current; + return copy_guest((void *)from, (vaddr_t)to, len, GVA_INFO(current_vcp= u), COPY_to_guest | COPY_flush_dcache | COPY_linear); } =20 unsigned long raw_clear_guest(void *to, unsigned int len) { - return copy_guest(NULL, (vaddr_t)to, len, GVA_INFO(current), + struct vcpu *current_vcpu =3D current; + return copy_guest(NULL, (vaddr_t)to, len, GVA_INFO(current_vcpu), COPY_to_guest | COPY_linear); } =20 unsigned long raw_copy_from_guest(void *to, const void __user *from, unsigned int len) { - return copy_guest(to, (vaddr_t)from, len, GVA_INFO(current), + struct vcpu *current_vcpu =3D current; + return copy_guest(to, (vaddr_t)from, len, GVA_INFO(current_vcpu), COPY_from_guest | COPY_linear); } =20 diff --git a/xen/arch/arm/include/asm/current.h b/xen/arch/arm/include/asm/= current.h index 6973eeb1d1..a66e28fefb 100644 --- a/xen/arch/arm/include/asm/current.h +++ b/xen/arch/arm/include/asm/current.h @@ -28,7 +28,7 @@ struct cpu_info { uint32_t flags; }; =20 -static inline struct cpu_info *get_cpu_info(void) +static inline __attribute_pure__ struct cpu_info *get_cpu_info(void) { #ifdef __clang__ unsigned long sp; --=20 2.34.1 From nobody Fri May 17 18:29:06 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; 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 Return-Path: Received: from lists.xenproject.org (lists.xenproject.org [192.237.175.120]) by mx.zohomail.com with SMTPS id 1697638759582686.5557056535615; Wed, 18 Oct 2023 07:19:19 -0700 (PDT) Received: from list by lists.xenproject.org with outflank-mailman.618597.962454 (Exim 4.92) (envelope-from ) id 1qt7Nz-0005fX-O1; Wed, 18 Oct 2023 14:18:59 +0000 Received: by outflank-mailman (output) from mailman id 618597.962454; Wed, 18 Oct 2023 14:18:59 +0000 Received: from localhost ([127.0.0.1] helo=lists.xenproject.org) by lists.xenproject.org with esmtp (Exim 4.92) (envelope-from ) id 1qt7Nz-0005eA-HF; Wed, 18 Oct 2023 14:18:59 +0000 Received: by outflank-mailman (input) for mailman id 618597; Wed, 18 Oct 2023 14:18:58 +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 1qt7Ny-0004vw-BC for xen-devel@lists.xenproject.org; Wed, 18 Oct 2023 14:18:58 +0000 Received: from support.bugseng.com (mail.bugseng.com [162.55.131.47]) by se1-gles-flk1.inumbo.com (Halon) with ESMTPS id 4527c161-6dc1-11ee-9b0e-b553b5be7939; Wed, 18 Oct 2023 16:18:55 +0200 (CEST) Received: from beta.station (net-188-218-250-245.cust.vodafonedsl.it [188.218.250.245]) by support.bugseng.com (Postfix) with ESMTPSA id A47764EE0743; Wed, 18 Oct 2023 16:18:54 +0200 (CEST) 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: 4527c161-6dc1-11ee-9b0e-b553b5be7939 From: Simone Ballarin To: xen-devel@lists.xenproject.org Cc: consulting@bugseng.com, sstabellini@kernel.org, Simone Ballarin , Doug Goldstein , Andrew Cooper , George Dunlap , Jan Beulich , Julien Grall , Wei Liu Subject: [XEN PATCH 2/4] automation/eclair: add deviations and call properties. Date: Wed, 18 Oct 2023 16:18:49 +0200 Message-Id: <8f426cc761c734d457a74416dd5b83fd10128c26.1697638210.git.simone.ballarin@bugseng.com> X-Mailer: git-send-email 2.34.1 In-Reply-To: References: MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable X-ZM-MESSAGEID: 1697638760487100001 Content-Type: text/plain; charset="utf-8" Deviate violations of MISRA C:2012 Rule 13.1 caused by functions vcpu_runnable and __bad_atomic_size. These functions contain side-effects such as debugging logs, assertions and failures that cannot cause unexpected behaviors. Add "noeffect" call property to functions read_u.*_atomic and get_cycles. Signed-off-by: Simone Ballarin Acked-by: Stefano Stabellini --- .../eclair_analysis/ECLAIR/call_properties.ecl | 10 ++++++++++ automation/eclair_analysis/ECLAIR/deviations.ecl | 13 +++++++++++++ docs/misra/deviations.rst | 11 +++++++++++ 3 files changed, 34 insertions(+) diff --git a/automation/eclair_analysis/ECLAIR/call_properties.ecl b/automa= tion/eclair_analysis/ECLAIR/call_properties.ecl index 3f7794bf8b..f410a6aa58 100644 --- a/automation/eclair_analysis/ECLAIR/call_properties.ecl +++ b/automation/eclair_analysis/ECLAIR/call_properties.ecl @@ -104,3 +104,13 @@ Furthermore, their uses do initialize the involved var= iables as needed by futher -call_properties+=3D{"macro(^(__)?(raw_)?copy_from_(paddr|guest|compat)(_o= ffset)?$)", {"pointee_write(1=3Dalways)", "pointee_read(1=3Dnever)", "taken= ()"}} -call_properties+=3D{"macro(^(__)?copy_to_(guest|compat)(_offset)?$)", {"p= ointee_write(2=3Dalways)", "pointee_read(2=3Dnever)", "taken()"}} -doc_end + +-doc_begin=3D"Functions generated by build_atomic_read cannot be considere= d pure +since the input pointer is volatile." +-call_properties+=3D{"^read_u(8|16|32|64|int)_atomic.*$", {"noeffect"}} +-doc_end + +-doc_begin=3D"get_cycles does not perform visible side-effects " +-call_property+=3D{"name(get_cycles)", {"noeffect"}} +-doc_end + diff --git a/automation/eclair_analysis/ECLAIR/deviations.ecl b/automation/= eclair_analysis/ECLAIR/deviations.ecl index fa56e5c00a..b80ccea7bc 100644 --- a/automation/eclair_analysis/ECLAIR/deviations.ecl +++ b/automation/eclair_analysis/ECLAIR/deviations.ecl @@ -233,6 +233,19 @@ this." -config=3DMC3R1.R10.1,etypes+=3D{safe, "stmt(operator(and||or||xor||not||and_assign||or_assign||xor_assign))", "any()"} +# +# Series 13. +# + +-doc_begin=3D"Function __bad_atomic_size is intended to generate a linkage= error +if invoked. Calling it in intentionally unreachable switch cases is safe e= ven +in a initializer list." +-config=3DMC3R1.R13.1,reports+=3D{safe, "first_area(^.*__bad_atomic_size.*= $)"} +-doc_end + +-doc_begin=3D"Function vcpu_runnable contains pragmas and other side-effec= ts for +debugging purposes, their invocation is safe even in a initializer list." +-config=3DMC3R1.R13.1,reports+=3D{safe, "first_area(^.*vcpu_runnable.*$)"} -doc_end =20 -doc_begin=3D"See Section \"4.5 Integers\" of \"GCC_MANUAL\", where it say= s that diff --git a/docs/misra/deviations.rst b/docs/misra/deviations.rst index 8511a18925..2fcdb8da58 100644 --- a/docs/misra/deviations.rst +++ b/docs/misra/deviations.rst @@ -192,6 +192,17 @@ Deviations related to MISRA C:2012 Rules: See automation/eclair_analysis/deviations.ecl for the full explanat= ion. - Tagged as `safe` for ECLAIR. =20 + * - R13.1 + - Function __bad_atomic_size is intended to generate a linkage error = if + invoked. Calling it in intentionally unreachable switch cases is + safe even in a initializer list. + - Tagged as `safe` for ECLAIR. + + * - R13.1 + - Function vcpu_runnable contains pragmas and other side-effects for + debugging purposes, their invocation is safe even in a initializer = list. + - Tagged as `safe` for ECLAIR. + * - R13.5 - All developers and reviewers can be safely assumed to be well aware= of the short-circuit evaluation strategy for logical operators. --=20 2.34.1 From nobody Fri May 17 18:29:06 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; 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 Return-Path: Received: from lists.xenproject.org (lists.xenproject.org [192.237.175.120]) by mx.zohomail.com with SMTPS id 1697638769020423.9904031272215; Wed, 18 Oct 2023 07:19:29 -0700 (PDT) Received: from list by lists.xenproject.org with outflank-mailman.618598.962470 (Exim 4.92) (envelope-from ) id 1qt7O0-0006C5-U0; Wed, 18 Oct 2023 14:19:00 +0000 Received: by outflank-mailman (output) from mailman id 618598.962470; Wed, 18 Oct 2023 14:19:00 +0000 Received: from localhost ([127.0.0.1] helo=lists.xenproject.org) by lists.xenproject.org with esmtp (Exim 4.92) (envelope-from ) id 1qt7O0-0006Al-Qa; Wed, 18 Oct 2023 14:19:00 +0000 Received: by outflank-mailman (input) for mailman id 618598; Wed, 18 Oct 2023 14:18:59 +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 1qt7Nz-0004vw-BS for xen-devel@lists.xenproject.org; Wed, 18 Oct 2023 14:18:59 +0000 Received: from support.bugseng.com (mail.bugseng.com [162.55.131.47]) by se1-gles-flk1.inumbo.com (Halon) with ESMTPS id 4570c89c-6dc1-11ee-9b0e-b553b5be7939; Wed, 18 Oct 2023 16:18:55 +0200 (CEST) Received: from beta.station (net-188-218-250-245.cust.vodafonedsl.it [188.218.250.245]) by support.bugseng.com (Postfix) with ESMTPSA id 2CA834EE0741; Wed, 18 Oct 2023 16:18:55 +0200 (CEST) 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: 4570c89c-6dc1-11ee-9b0e-b553b5be7939 From: Simone Ballarin To: xen-devel@lists.xenproject.org Cc: consulting@bugseng.com, sstabellini@kernel.org, Simone Ballarin , Andrew Cooper , George Dunlap , Jan Beulich , Julien Grall , Wei Liu Subject: [XEN PATCH 3/4] xen/include: add pure and const attributes Date: Wed, 18 Oct 2023 16:18:50 +0200 Message-Id: X-Mailer: git-send-email 2.34.1 In-Reply-To: References: MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable X-ZM-MESSAGEID: 1697638770378100001 Content-Type: text/plain; charset="utf-8" Add const and pure attributes to address reports of MISRA C:2012 Rule 13.1: Initializer lists shall not contain persistent side effects Add pure attribute to function pdx_to_pfn. Add const attribute to functions generated by TYPE_SAFE. These functions are used in initializer lists: adding the attributes ensures that no effect will be performed by them. Signed-off-by: Simone Ballarin Reviewed-by: Stefano Stabellini --- Function attributes pure and const do not need to be added as GCC attributes, they can be added using ECLAIR configurations. --- xen/include/xen/pdx.h | 2 +- xen/include/xen/typesafe.h | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/xen/include/xen/pdx.h b/xen/include/xen/pdx.h index f3fbc4273a..5d1050967a 100644 --- a/xen/include/xen/pdx.h +++ b/xen/include/xen/pdx.h @@ -164,7 +164,7 @@ static inline unsigned long pfn_to_pdx(unsigned long pf= n) * @param pdx Page index * @return Obtained pfn after decompressing the pdx */ -static inline unsigned long pdx_to_pfn(unsigned long pdx) +static inline __attribute_pure__ unsigned long pdx_to_pfn(unsigned long pd= x) { return (pdx & pfn_pdx_bottom_mask) | ((pdx << pfn_pdx_hole_shift) & pfn_top_mask); diff --git a/xen/include/xen/typesafe.h b/xen/include/xen/typesafe.h index 7ecd3b4a8d..615df6f944 100644 --- a/xen/include/xen/typesafe.h +++ b/xen/include/xen/typesafe.h @@ -21,8 +21,8 @@ =20 #define TYPE_SAFE(_type, _name) \ typedef struct { _type _name; } _name##_t; \ - static inline _name##_t _##_name(_type n) { return (_name##_t) { n }; = } \ - static inline _type _name##_x(_name##_t n) { return n._name; } + static inline __attribute_const__ _name##_t _##_name(_type n) { return= (_name##_t) { n }; } \ + static inline __attribute_const__ _type _name##_x(_name##_t n) { retur= n n._name; } =20 #else =20 --=20 2.34.1 From nobody Fri May 17 18:29:06 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; 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 Return-Path: Received: from lists.xenproject.org (lists.xenproject.org [192.237.175.120]) by mx.zohomail.com with SMTPS id 1697638764761998.624749532444; Wed, 18 Oct 2023 07:19:24 -0700 (PDT) Received: from list by lists.xenproject.org with outflank-mailman.618596.962448 (Exim 4.92) (envelope-from ) id 1qt7Nz-0005Xw-Az; Wed, 18 Oct 2023 14:18:59 +0000 Received: by outflank-mailman (output) from mailman id 618596.962448; Wed, 18 Oct 2023 14:18:59 +0000 Received: from localhost ([127.0.0.1] helo=lists.xenproject.org) by lists.xenproject.org with esmtp (Exim 4.92) (envelope-from ) id 1qt7Nz-0005Ws-3s; Wed, 18 Oct 2023 14:18:59 +0000 Received: by outflank-mailman (input) for mailman id 618596; Wed, 18 Oct 2023 14:18:57 +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 1qt7Nx-0005Dj-J1 for xen-devel@lists.xenproject.org; Wed, 18 Oct 2023 14:18:57 +0000 Received: from support.bugseng.com (mail.bugseng.com [162.55.131.47]) by se1-gles-sth1.inumbo.com (Halon) with ESMTPS id 45c0c852-6dc1-11ee-98d4-6d05b1d4d9a1; Wed, 18 Oct 2023 16:18:56 +0200 (CEST) Received: from beta.station (net-188-218-250-245.cust.vodafonedsl.it [188.218.250.245]) by support.bugseng.com (Postfix) with ESMTPSA id A09F04EE0744; Wed, 18 Oct 2023 16:18:55 +0200 (CEST) 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: 45c0c852-6dc1-11ee-98d4-6d05b1d4d9a1 From: Simone Ballarin To: xen-devel@lists.xenproject.org Cc: consulting@bugseng.com, sstabellini@kernel.org, Simone Ballarin , George Dunlap , Dario Faggioli , Andrew Cooper , Jan Beulich , Julien Grall , Wei Liu Subject: [XEN PATCH 4/4] xen: address violations of MISRA C:2012 Rule 13.1 Date: Wed, 18 Oct 2023 16:18:51 +0200 Message-Id: <1e0f12095bcbc82ae3585c9fcf57bec7e324049c.1697638210.git.simone.ballarin@bugseng.com> X-Mailer: git-send-email 2.34.1 In-Reply-To: References: MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable X-ZM-MESSAGEID: 1697638766754100001 Content-Type: text/plain; charset="utf-8" Rule 13.1: Initializer lists shall not contain persistent side effects This patch moves expressions with side-effects outside the initializer list= s. No functional changes. Signed-off-by: Simone Ballarin --- xen/common/sched/core.c | 16 ++++++++++++---- xen/drivers/char/ns16550.c | 4 +++- 2 files changed, 15 insertions(+), 5 deletions(-) diff --git a/xen/common/sched/core.c b/xen/common/sched/core.c index 12deefa745..519884f989 100644 --- a/xen/common/sched/core.c +++ b/xen/common/sched/core.c @@ -1504,6 +1504,8 @@ long vcpu_yield(void) { struct vcpu * v=3Dcurrent; spinlock_t *lock; + domid_t domain_id; + int vcpu_id; =20 rcu_read_lock(&sched_res_rculock); =20 @@ -1515,7 +1517,9 @@ long vcpu_yield(void) =20 SCHED_STAT_CRANK(vcpu_yield); =20 - TRACE_2D(TRC_SCHED_YIELD, current->domain->domain_id, current->vcpu_id= ); + domain_id =3D current->domain->domain_id; + vcpu_id =3D current->vcpu_id; + TRACE_2D(TRC_SCHED_YIELD, domain_id, vcpu_id); raise_softirq(SCHEDULE_SOFTIRQ); return 0; } @@ -1888,14 +1892,17 @@ ret_t do_sched_op(int cmd, XEN_GUEST_HANDLE_PARAM(v= oid) arg) case SCHEDOP_shutdown: { struct sched_shutdown sched_shutdown; + domid_t domain_id; + int vcpu_id; =20 ret =3D -EFAULT; if ( copy_from_guest(&sched_shutdown, arg, 1) ) break; =20 + domain_id =3D current->domain->domain_id; + vcpu_id =3D current->vcpu_id; TRACE_3D(TRC_SCHED_SHUTDOWN, - current->domain->domain_id, current->vcpu_id, - sched_shutdown.reason); + domain_id, vcpu_id, sched_shutdown.reason); ret =3D domain_shutdown(current->domain, (u8)sched_shutdown.reason= ); =20 break; @@ -1905,13 +1912,14 @@ ret_t do_sched_op(int cmd, XEN_GUEST_HANDLE_PARAM(v= oid) arg) { struct sched_shutdown sched_shutdown; struct domain *d =3D current->domain; + int vcpu_id =3D current->vcpu_id; =20 ret =3D -EFAULT; if ( copy_from_guest(&sched_shutdown, arg, 1) ) break; =20 TRACE_3D(TRC_SCHED_SHUTDOWN_CODE, - d->domain_id, current->vcpu_id, sched_shutdown.reason); + d->domain_id, vcpu_id, sched_shutdown.reason); =20 spin_lock(&d->shutdown_lock); if ( d->shutdown_code =3D=3D SHUTDOWN_CODE_INVALID ) diff --git a/xen/drivers/char/ns16550.c b/xen/drivers/char/ns16550.c index 28ddedd50d..0b3d8b2a30 100644 --- a/xen/drivers/char/ns16550.c +++ b/xen/drivers/char/ns16550.c @@ -445,10 +445,12 @@ static void __init cf_check ns16550_init_postirq(stru= ct serial_port *port) struct msi_info msi =3D { .sbdf =3D PCI_SBDF(0, uart->ps_bdf[0], uart->ps_bdf[1], uart->ps_bdf[2]), - .irq =3D rc =3D uart->irq, + .irq =3D uart->irq, .entry_nr =3D 1 }; =20 + rc =3D uart->irq; + if ( rc > 0 ) { struct msi_desc *msi_desc =3D NULL; --=20 2.34.1