[XEN PATCH v1] ioreq: allow arch_vcpu_ioreq_completion() to signal an error

Sergiy Kibrik posted 1 patch 10 months, 2 weeks ago
Patches applied successfully (tree, apply log)
git fetch https://gitlab.com/xen-project/patchew/xen tags/patchew/20241220093514.3094521-1-Sergiy._5FKibrik@epam.com
xen/arch/x86/hvm/ioreq.c | 2 +-
xen/include/xen/ioreq.h  | 2 +-
2 files changed, 2 insertions(+), 2 deletions(-)
[XEN PATCH v1] ioreq: allow arch_vcpu_ioreq_completion() to signal an error
Posted by Sergiy Kibrik 10 months, 2 weeks ago
Return false from arch_vcpu_ioreq_completion() when completion is not handled.
According to coding-best-practices.pandoc an error should be propagated to
caller, if caller is expecting to handle it, which seems to the case for
callers of arch_vcpu_ioreq_completion().

Suggested-by: Jan Beulich <jbeulich@suse.com>
Signed-off-by: Sergiy Kibrik <Sergiy_Kibrik@epam.com>
---
This change has been suggested by Jan some time ago during review of another
series, here's link to discussion:
https://lore.kernel.org/xen-devel/952701cd-83d8-4c1f-9f38-ee63ba582d66@suse.com/
---
 xen/arch/x86/hvm/ioreq.c | 2 +-
 xen/include/xen/ioreq.h  | 2 +-
 2 files changed, 2 insertions(+), 2 deletions(-)

diff --git a/xen/arch/x86/hvm/ioreq.c b/xen/arch/x86/hvm/ioreq.c
index 5c3d0c69aa..9b1592d505 100644
--- a/xen/arch/x86/hvm/ioreq.c
+++ b/xen/arch/x86/hvm/ioreq.c
@@ -47,7 +47,7 @@ bool arch_vcpu_ioreq_completion(enum vio_completion completion)
 
     default:
         ASSERT_UNREACHABLE();
-        break;
+        return false;
     }
 
     return true;
diff --git a/xen/include/xen/ioreq.h b/xen/include/xen/ioreq.h
index 29a17e8ff5..2583eca0d5 100644
--- a/xen/include/xen/ioreq.h
+++ b/xen/include/xen/ioreq.h
@@ -118,7 +118,7 @@ bool arch_vcpu_ioreq_completion(enum vio_completion completion);
 static inline bool arch_vcpu_ioreq_completion(enum vio_completion completion)
 {
     ASSERT_UNREACHABLE();
-    return true;
+    return false;
 }
 #endif
 
-- 
2.25.1
Re: [XEN PATCH v1] ioreq: allow arch_vcpu_ioreq_completion() to signal an error
Posted by Stefano Stabellini 10 months ago
On Fri, 20 Dec 2024, Sergiy Kibrik wrote:
> Return false from arch_vcpu_ioreq_completion() when completion is not handled.
> According to coding-best-practices.pandoc an error should be propagated to
> caller, if caller is expecting to handle it, which seems to the case for
> callers of arch_vcpu_ioreq_completion().
> 
> Suggested-by: Jan Beulich <jbeulich@suse.com>
> Signed-off-by: Sergiy Kibrik <Sergiy_Kibrik@epam.com>

Reviewed-by: Stefano Stabellini <sstabellini@kernel.org>


> ---
> This change has been suggested by Jan some time ago during review of another
> series, here's link to discussion:
> https://lore.kernel.org/xen-devel/952701cd-83d8-4c1f-9f38-ee63ba582d66@suse.com/
> ---
>  xen/arch/x86/hvm/ioreq.c | 2 +-
>  xen/include/xen/ioreq.h  | 2 +-
>  2 files changed, 2 insertions(+), 2 deletions(-)
> 
> diff --git a/xen/arch/x86/hvm/ioreq.c b/xen/arch/x86/hvm/ioreq.c
> index 5c3d0c69aa..9b1592d505 100644
> --- a/xen/arch/x86/hvm/ioreq.c
> +++ b/xen/arch/x86/hvm/ioreq.c
> @@ -47,7 +47,7 @@ bool arch_vcpu_ioreq_completion(enum vio_completion completion)
>  
>      default:
>          ASSERT_UNREACHABLE();
> -        break;
> +        return false;
>      }
>  
>      return true;
> diff --git a/xen/include/xen/ioreq.h b/xen/include/xen/ioreq.h
> index 29a17e8ff5..2583eca0d5 100644
> --- a/xen/include/xen/ioreq.h
> +++ b/xen/include/xen/ioreq.h
> @@ -118,7 +118,7 @@ bool arch_vcpu_ioreq_completion(enum vio_completion completion);
>  static inline bool arch_vcpu_ioreq_completion(enum vio_completion completion)
>  {
>      ASSERT_UNREACHABLE();
> -    return true;
> +    return false;
>  }
>  #endif
>  
> -- 
> 2.25.1
>
Re: [XEN PATCH v1] ioreq: allow arch_vcpu_ioreq_completion() to signal an error
Posted by Jan Beulich 10 months ago
On 02.01.2025 20:36, Stefano Stabellini wrote:
> On Fri, 20 Dec 2024, Sergiy Kibrik wrote:
>> Return false from arch_vcpu_ioreq_completion() when completion is not handled.
>> According to coding-best-practices.pandoc an error should be propagated to
>> caller, if caller is expecting to handle it, which seems to the case for
>> callers of arch_vcpu_ioreq_completion().
>>
>> Suggested-by: Jan Beulich <jbeulich@suse.com>
>> Signed-off-by: Sergiy Kibrik <Sergiy_Kibrik@epam.com>
> 
> Reviewed-by: Stefano Stabellini <sstabellini@kernel.org>

Acked-by: Jan Beulich <jbeulich@suse.com>