From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from lists.xenproject.org (lists.xenproject.org [192.237.175.120]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id 3D37BC5478C for ; Wed, 28 Feb 2024 14:33:45 +0000 (UTC) Received: from list by lists.xenproject.org with outflank-mailman.686677.1068969 (Exim 4.92) (envelope-from ) id 1rfL04-0005we-Jq; Wed, 28 Feb 2024 14:33:36 +0000 X-Outflank-Mailman: Message body and most headers restored to incoming version Received: by outflank-mailman (output) from mailman id 686677.1068969; Wed, 28 Feb 2024 14:33:36 +0000 Received: from localhost ([127.0.0.1] helo=lists.xenproject.org) by lists.xenproject.org with esmtp (Exim 4.92) (envelope-from ) id 1rfL04-0005wX-HC; Wed, 28 Feb 2024 14:33:36 +0000 Received: by outflank-mailman (input) for mailman id 686677; Wed, 28 Feb 2024 14:33:35 +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 1rfL03-0005wR-Lq for xen-devel@lists.xenproject.org; Wed, 28 Feb 2024 14:33:35 +0000 Received: from support.bugseng.com (mail.bugseng.com [162.55.131.47]) by se1-gles-sth1.inumbo.com (Halon) with ESMTPS id 59f297c6-d646-11ee-afd8-a90da7624cb6; Wed, 28 Feb 2024 15:33:34 +0100 (CET) Received: from support.bugseng.com (support.bugseng.com [162.55.131.47]) by support.bugseng.com (Postfix) with ESMTPA id CE10D4EE0737; Wed, 28 Feb 2024 15:33:33 +0100 (CET) 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: 59f297c6-d646-11ee-afd8-a90da7624cb6 MIME-Version: 1.0 Date: Wed, 28 Feb 2024 15:33:33 +0100 From: Nicola Vetrini To: Jan Beulich Cc: sstabellini@kernel.org, michal.orzel@amd.com, xenia.ragiadakou@amd.com, ayan.kumar.halder@amd.com, consulting@bugseng.com, andrew.cooper3@citrix.com, roger.pau@citrix.com, bertrand.marquis@arm.com, julien@xen.org, Volodymyr Babchuk , George Dunlap , Wei Liu , xen-devel@lists.xenproject.org Subject: Re: [XEN PATCH] xen: cache clearing and invalidation helpers refactoring In-Reply-To: References: <4f3b3d52a3ba20b05ecfa068b916b804@bugseng.com> Message-ID: <4b8015c51f93ae05ad0748832e06cf8b@bugseng.com> X-Sender: nicola.vetrini@bugseng.com Organization: BUGSENG s.r.l. Content-Type: text/plain; charset=US-ASCII; format=flowed Content-Transfer-Encoding: 7bit On 2024-02-26 11:51, Jan Beulich wrote: > On 23.02.2024 08:58, Nicola Vetrini wrote: >> On 2024-02-19 16:14, Nicola Vetrini wrote: >>> The cache clearing and invalidation helpers in x86 and Arm didn't >>> comply with MISRA C Rule 17.7: "The value returned by a function >>> having non-void return type shall be used". On Arm they >>> were always returning 0, while some in x86 returned -EOPNOTSUPP >>> and in common/grant_table the return value is saved. >>> >>> As a consequence, a common helper arch_grant_cache_flush that returns >>> an integer is introduced, so that each architecture can choose >>> whether >>> to >>> return an error value on certain conditions, and the helpers have >>> either >>> been changed to return void (on Arm) or deleted entirely (on x86). >>> >>> Signed-off-by: Julien Grall >>> Signed-off-by: Nicola Vetrini >>> --- >>> The original refactor idea came from Julien Grall in [1]; I edited >>> that >>> proposal >>> to fix build errors. >>> >>> I did introduce a cast to void for the call to flush_area_local on >>> x86, >>> because >>> even before this patch the return value of that function wasn't >>> checked >>> in all >>> but one use in x86/smp.c, and in this context the helper (perhaps >>> incidentally) >>> ignored the return value of flush_area_local. >>> >>> [1] >>> https://lore.kernel.org/xen-devel/09589e8f-77b6-47f7-b5bd-cf485e4b60f1@xen.org/ >>> --- >>> xen/arch/arm/include/asm/page.h | 33 >>> ++++++++++++++++++----------- >>> xen/arch/x86/include/asm/flushtlb.h | 23 ++++++++++---------- >>> xen/common/grant_table.c | 9 +------- >>> 3 files changed, 34 insertions(+), 31 deletions(-) >>> >> >> I'll put this patch in the backlog at the moment: too many intricacies >> while trying to untangle xen/flushtlb from xen/mm.h, and there are >> easier cases that can be done faster. If someone is interested I can >> post the partial work I've done so far, even though it doesn't >> build on x86. > > This > https://lists.xen.org/archives/html/xen-devel/2024-02/msg01513.html > may be of interest to you in the context here. > I'll take a look, thanks. -- Nicola Vetrini, BSc Software Engineer, BUGSENG srl (https://bugseng.com)