From nobody Thu May 9 09:06:27 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=quarantine dis=none) header.from=suse.com ARC-Seal: i=1; a=rsa-sha256; t=1704787573; cv=none; d=zohomail.com; s=zohoarc; b=azH/oF6Y2GG60J4dWiiMvX0Bh0S3I+JmxPKukTNBYuzwv4XVNTOMas39QAU17s2oRUqDpO9uzZzzhkoT8UgXFvsfbRQwhkPT1E3bh9/u3lJd8z0bLvlM41jTwz2TSvivN+cTlYYujqk+zGoiYfb1bG3R+tLU3SHK2Vcwy2TQAtA= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1704787573; h=Content-Type: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=CEqr9QrMCey4RTfR3m71tRVavPGwQg0PARsYXTCITQU=; b=T7zg8aVWAljTvjLsbQa7Wzr53rYtGPrqeT68yXjjJuDQE6XT1V/wbh5Fshn8zopKtr7ngiwM+vHTKv3cxbXsLt3akexjKc2ZUBtKrk2psNkzXU3zWMFsUJrEUP0bHFH/sk77mtAolqNRBMx7IquOw5uxGRLCFTAnGOCFt9YGkuo= 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=quarantine dis=none) Return-Path: Received: from lists.xenproject.org (lists.xenproject.org [192.237.175.120]) by mx.zohomail.com with SMTPS id 1704787573471475.71011376826016; Tue, 9 Jan 2024 00:06:13 -0800 (PST) Received: from list by lists.xenproject.org with outflank-mailman.664316.1034440 (Exim 4.92) (envelope-from ) id 1rN77T-0001zZ-TT; Tue, 09 Jan 2024 08:05:55 +0000 Received: by outflank-mailman (output) from mailman id 664316.1034440; Tue, 09 Jan 2024 08:05:55 +0000 Received: from localhost ([127.0.0.1] helo=lists.xenproject.org) by lists.xenproject.org with esmtp (Exim 4.92) (envelope-from ) id 1rN77T-0001zS-Qz; Tue, 09 Jan 2024 08:05:55 +0000 Received: by outflank-mailman (input) for mailman id 664316; Tue, 09 Jan 2024 08:05:54 +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 1rN77S-0001zM-3v for xen-devel@lists.xenproject.org; Tue, 09 Jan 2024 08:05:54 +0000 Received: from mail-lf1-x135.google.com (mail-lf1-x135.google.com [2a00:1450:4864:20::135]) by se1-gles-sth1.inumbo.com (Halon) with ESMTPS id e8a27cb4-aec5-11ee-98ef-6d05b1d4d9a1; Tue, 09 Jan 2024 09:05:53 +0100 (CET) Received: by mail-lf1-x135.google.com with SMTP id 2adb3069b0e04-50eabbc3dccso2656195e87.2 for ; Tue, 09 Jan 2024 00:05:53 -0800 (PST) Received: from [10.156.60.236] (ip-037-024-206-209.um08.pools.vodafone-ip.de. [37.24.206.209]) by smtp.gmail.com with ESMTPSA id bw10-20020a056638460a00b0046e33773c09sm478861jab.36.2024.01.09.00.05.50 (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Tue, 09 Jan 2024 00:05:51 -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: e8a27cb4-aec5-11ee-98ef-6d05b1d4d9a1 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=suse.com; s=google; t=1704787552; x=1705392352; darn=lists.xenproject.org; h=content-transfer-encoding:autocrypt:subject:from:cc:to :content-language:user-agent:mime-version:date:message-id:from:to:cc :subject:date:message-id:reply-to; bh=CEqr9QrMCey4RTfR3m71tRVavPGwQg0PARsYXTCITQU=; b=Xcvfs1MV2NuzBzPgyN+a+RGz8aeFHw4R09wfM8o9XHolx26i5Mn4QqNjZnjy6388ui Vx1I+PzBb7xQ9luyUPs4x+Iqdbzgg87+Th4BwfE8Z7krATsQveJBCspxbhK7XpTAPuiK SMEym+/xxSvTHfZolxjedc7F7aVaUAIpcjE+6PyhkBGP7g1hJkJu/+2UCnR4/2xwxJrp L7HIdcld/lktHaiAQxfeThv4TIG98b46CP/BJuYvYHFZFlTePtAhqw2UufULFJOl0ovW rkjKfmo+QLV3dSxaiKJBBqety3K5QIhYCsVjCvs2djWL33qP5piH6FHAFvrfbjTyBDne BngA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1704787552; x=1705392352; h=content-transfer-encoding:autocrypt:subject:from:cc:to :content-language:user-agent:mime-version:date:message-id :x-gm-message-state:from:to:cc:subject:date:message-id:reply-to; bh=CEqr9QrMCey4RTfR3m71tRVavPGwQg0PARsYXTCITQU=; b=r8wuihRHVUyrnCI1nkPBGS/rog5i21z9Xq6zi+4Ghj8x7UENgsEnaUOjzxATUnxV4Z 6I6OVzfUq/VeZe7kMsBp6E82llrbsdbyoHTEULsZWQZgKsTUKgZI4eqfiRN5jTvBn1t8 w72qEYNQjFoy3yJxd2e0wZ+cbP4/vIBx1sVkGcivnJvutfSyhTUJjN0butj5IQMAhkqW VITCnpSoQfwOJot84edgidJ1TrAnu8xkK1Re/Q6dTOKqmKqjFooLEQzq7jZwyLLMfTZi j6aTVpwB4mugy2J3XYYHFNfHfXMFWRwHOLATNsepLwQzEscSHUFW57K6xW7EmcgEi3Ve UmAg== X-Gm-Message-State: AOJu0Yxsj7cszYQBCdnS2jCXZyIWoT798DE8Ynet04dAkOLSK1DvPZDd 4eTCnKOeXU6dp7wQB+kiKbiUP9AqOzI3oqUhZS1lb63nag== X-Google-Smtp-Source: AGHT+IGBN9o/4p+mlY9Ys2VC5UL6Z/xFCKroyp0kFr85ScG/ScerjX05b1jOo/w/M/5MhL9r9VxkZA== X-Received: by 2002:a05:6512:2037:b0:50e:aa03:a50c with SMTP id s23-20020a056512203700b0050eaa03a50cmr967778lfs.113.1704787552501; Tue, 09 Jan 2024 00:05:52 -0800 (PST) Message-ID: Date: Tue, 9 Jan 2024 09:05:48 +0100 MIME-Version: 1.0 User-Agent: Mozilla Thunderbird Content-Language: en-US To: "xen-devel@lists.xenproject.org" Cc: Federico Serafini , Andrew Cooper , George Dunlap , Julien Grall , Stefano Stabellini , Wei Liu , Bertrand Marquis , Michal Orzel From: Jan Beulich Subject: [PATCH] consolidate do_bug_frame() / bug_fn_t Autocrypt: addr=jbeulich@suse.com; keydata= xsDiBFk3nEQRBADAEaSw6zC/EJkiwGPXbWtPxl2xCdSoeepS07jW8UgcHNurfHvUzogEq5xk hu507c3BarVjyWCJOylMNR98Yd8VqD9UfmX0Hb8/BrA+Hl6/DB/eqGptrf4BSRwcZQM32aZK 7Pj2XbGWIUrZrd70x1eAP9QE3P79Y2oLrsCgbZJfEwCgvz9JjGmQqQkRiTVzlZVCJYcyGGsD /0tbFCzD2h20ahe8rC1gbb3K3qk+LpBtvjBu1RY9drYk0NymiGbJWZgab6t1jM7sk2vuf0Py O9Hf9XBmK0uE9IgMaiCpc32XV9oASz6UJebwkX+zF2jG5I1BfnO9g7KlotcA/v5ClMjgo6Gl MDY4HxoSRu3i1cqqSDtVlt+AOVBJBACrZcnHAUSuCXBPy0jOlBhxPqRWv6ND4c9PH1xjQ3NP nxJuMBS8rnNg22uyfAgmBKNLpLgAGVRMZG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Content-Transfer-Encoding: quoted-printable X-ZohoMail-DKIM: pass (identity @suse.com) X-ZM-MESSAGEID: 1704787575237100001 Content-Type: text/plain; charset="utf-8" The type not being used in do_bug_frame() is suspicious. Apparently that's solely because the type uses a pointer-to-const parameter, when run_in_exception_handler() wants functions taking pointer-to-non- const. Drop the const, in turn requiring Arm's do_bug_frame() to also have its const dropped. This then brings that function also closer to the common one, with Arm's use of vaddr_t remaining as a difference. Signed-off-by: Jan Beulich --- This is an alternative proposal to https://lists.xen.org/archives/html/xen-devel/2023-12/msg01385.html, albeit without paving a road towards Andrew's desire of getting rid of show_execution_state_nonconst() again. Retaining (and propagating) the const would imply the need to cast away the const-ness somewhere on (at least) the path to invoking gdb stub code. Personally I'm averse to such casting away of const-ness ... --- a/xen/arch/arm/include/asm/traps.h +++ b/xen/arch/arm/include/asm/traps.h @@ -69,7 +69,7 @@ void do_cp(struct cpu_user_regs *regs, c void do_trap_smc(struct cpu_user_regs *regs, const union hsr hsr); void do_trap_hvc_smccc(struct cpu_user_regs *regs); =20 -int do_bug_frame(const struct cpu_user_regs *regs, vaddr_t pc); +int do_bug_frame(struct cpu_user_regs *regs, vaddr_t pc); =20 void noreturn do_unexpected_trap(const char *msg, const struct cpu_user_regs *regs); --- a/xen/arch/arm/traps.c +++ b/xen/arch/arm/traps.c @@ -1202,7 +1202,7 @@ void do_unexpected_trap(const char *msg, panic("CPU%d: Unexpected Trap: %s\n", smp_processor_id(), msg); } =20 -int do_bug_frame(const struct cpu_user_regs *regs, vaddr_t pc) +int do_bug_frame(struct cpu_user_regs *regs, vaddr_t pc) { const struct bug_frame *bug =3D NULL; const char *prefix =3D "", *filename, *predicate; --- a/xen/common/bug.c +++ b/xen/common/bug.c @@ -63,14 +63,10 @@ int do_bug_frame(struct cpu_user_regs *r =20 if ( id =3D=3D BUGFRAME_run_fn ) { - void (*fn)(struct cpu_user_regs *) =3D bug_ptr(bug); + bug_fn_t *fn =3D bug_ptr(bug); =20 fn(regs); =20 - /* Re-enforce consistent types, because of the casts involved. */ - if ( false ) - run_in_exception_handler(fn); - return id; } =20 --- a/xen/include/xen/bug.h +++ b/xen/include/xen/bug.h @@ -101,12 +101,11 @@ struct bug_frame { #endif =20 struct cpu_user_regs; -typedef void bug_fn_t(const struct cpu_user_regs *regs); +typedef void bug_fn_t(struct cpu_user_regs *regs); =20 #ifndef run_in_exception_handler =20 -static void always_inline run_in_exception_handler( - void (*fn)(struct cpu_user_regs *regs)) +static void always_inline run_in_exception_handler(bug_fn_t *fn) { BUG_FRAME(BUGFRAME_run_fn, 0, fn, 0, NULL); }