Skip to contentSkip to conversation

replace bogus -ENOSYS uses

PATCH In review Jan Beulich 4 participants 11 messages Aug 9, 2016 – Sep 6, 2016

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 replace bogus -ENOSYS uses

This doesn't cover all of them, just the ones that I think would most obviously better be -EINVAL or -EOPNOTSUPP.

xen/arch/x86/cpu/mcheck/vmce.c +1 -1
@@ -440,7 +440,7 @@ int unmmap_broken_page(struct domain *d,
         return -EINVAL;
 
     if ( !has_hvm_container_domain(d) || !paging_mode_hap(d) )
-        return -ENOSYS;
+        return -EOPNOTSUPP;
 
     rc = -1;
     r_mfn = get_gfn_query(d, gfn, &pt);
xen/arch/x86/cpu/mtrr/main.c +1 -1
@@ -332,7 +332,7 @@ int mtrr_add_page(unsigned long base, un
 	if ((type == MTRR_TYPE_WRCOMB) && !have_wrcomb()) {
 		printk(KERN_WARNING
 		       "mtrr: your processor doesn't support write-combining\n");
-		return -ENOSYS;
+		return -EOPNOTSUPP;
 	}
 
 	if (!size) {
xen/arch/x86/hvm/hvm.c +2 -2
@@ -5592,7 +5592,7 @@ long do_hvm_op(unsigned long op, XEN_GUE
         break;
 
     case HVMOP_flush_tlbs:
-        rc = guest_handle_is_null(arg) ? hvmop_flush_tlb_all() : -ENOSYS;
+        rc = guest_handle_is_null(arg) ? hvmop_flush_tlb_all() : -EINVAL;
         break;
 
     case HVMOP_track_dirty_vram:
@@ -5832,7 +5832,7 @@ int hvm_debug_op(struct vcpu *v, int32_t
     {
         case XEN_DOMCTL_DEBUG_OP_SINGLE_STEP_ON:
         case XEN_DOMCTL_DEBUG_OP_SINGLE_STEP_OFF:
-            rc = -ENOSYS;
+            rc = -EOPNOTSUPP;
             if ( !cpu_has_monitor_trap_flag )
                 break;
             rc = 0;
xen/arch/x86/mm.c +1 -1
@@ -3565,7 +3565,7 @@ long do_mmuext_op(
             if ( !opt_allow_superpage )
             {
                 MEM_LOG("Superpages disallowed");
-                rc = -ENOSYS;
+                rc = -EOPNOTSUPP;
             }
             else if ( unlikely(d != pg_owner) )
                 rc = -EPERM;
xen/common/compat/memory.c +1 -1
@@ -353,7 +353,7 @@ int compat_memory_op(unsigned int cmd, X
             struct get_reserved_device_memory grdm;
 
             if ( unlikely(start_extent) )
-                return -ENOSYS;
+                return -EINVAL;
 
             if ( copy_from_guest(&grdm.map, compat, 1) ||
                  !compat_handle_okay(grdm.map.buffer, grdm.map.nr_entries) )
xen/common/event_fifo.c +1 -1
@@ -621,7 +621,7 @@ int evtchn_fifo_expand_array(const struc
     int rc;
 
     if ( !d->evtchn_fifo )
-        return -ENOSYS;
+        return -EOPNOTSUPP;
 
     spin_lock(&d->event_lock);
     rc = add_page_to_event_array(d, expand_array->array_gfn);
xen/common/grant_table.c +1 -1
@@ -3025,7 +3025,7 @@ do_grant_table_op(
         return -EINVAL;
 
     if ( (cmd &= GNTTABOP_CMD_MASK) != GNTTABOP_cache_flush && opaque_in )
-        return -ENOSYS;
+        return -EINVAL;
     
     rc = -EFAULT;
     switch ( cmd )
xen/common/memory.c +7 -7
@@ -937,14 +937,14 @@ long do_memory_op(unsigned long cmd, XEN
 
     case XENMEM_exchange:
         if ( unlikely(start_extent) )
-            return -ENOSYS;
+            return -EINVAL;
 
         rc = memory_exchange(guest_handle_cast(arg, xen_memory_exchange_t));
         break;
 
     case XENMEM_maximum_ram_page:
         if ( unlikely(start_extent) )
-            return -ENOSYS;
+            return -EINVAL;
 
         rc = max_page;
         break;
@@ -953,7 +953,7 @@ long do_memory_op(unsigned long cmd, XEN
     case XENMEM_maximum_reservation:
     case XENMEM_maximum_gpfn:
         if ( unlikely(start_extent) )
-            return -ENOSYS;
+            return -EINVAL;
 
         if ( copy_from_guest(&domid, arg, 1) )
             return -EFAULT;
@@ -1077,7 +1077,7 @@ long do_memory_op(unsigned long cmd, XEN
         struct page_info *page;
 
         if ( unlikely(start_extent) )
-            return -ENOSYS;
+            return -EINVAL;
 
         if ( copy_from_guest(&xrfp, arg, 1) )
             return -EFAULT;
@@ -1114,7 +1114,7 @@ long do_memory_op(unsigned long cmd, XEN
 
     case XENMEM_claim_pages:
         if ( unlikely(start_extent) )
-            return -ENOSYS;
+            return -EINVAL;
 
         if ( copy_from_guest(&reservation, arg, 1) )
             return -EFAULT;
@@ -1148,7 +1148,7 @@ long do_memory_op(unsigned long cmd, XEN
         struct vnuma_info tmp;
 
         if ( unlikely(start_extent) )
-            return -ENOSYS;
+            return -EINVAL;
 
         /*
          * Guest passes nr_vnodes, number of regions and nr_vcpus thus
@@ -1280,7 +1280,7 @@ long do_memory_op(unsigned long cmd, XEN
         struct get_reserved_device_memory grdm;
 
         if ( unlikely(start_extent) )
-            return -ENOSYS;
+            return -EINVAL;
 
         if ( copy_from_guest(&grdm.map, arg, 1) ||
              !guest_handle_okay(grdm.map.buffer, grdm.map.nr_entries) )

replace bogus -ENOSYS uses

This doesn't cover all of them, just the ones that I think would most obviously better be -EINVAL or -EOPNOTSUPP.

xen/arch/x86/cpu/mcheck/vmce.c +1 -1
@@ -440,7 +440,7 @@ int unmmap_broken_page(struct domain *d,
         return -EINVAL;
 
     if ( !has_hvm_container_domain(d) || !paging_mode_hap(d) )
-        return -ENOSYS;
+        return -EOPNOTSUPP;
 
     rc = -1;
     r_mfn = get_gfn_query(d, gfn, &pt);
xen/arch/x86/cpu/mtrr/main.c +1 -1
@@ -332,7 +332,7 @@ int mtrr_add_page(unsigned long base, un
 	if ((type == MTRR_TYPE_WRCOMB) && !have_wrcomb()) {
 		printk(KERN_WARNING
 		       "mtrr: your processor doesn't support write-combining\n");
-		return -ENOSYS;
+		return -EOPNOTSUPP;
 	}
 
 	if (!size) {
xen/arch/x86/hvm/hvm.c +2 -2
@@ -5592,7 +5592,7 @@ long do_hvm_op(unsigned long op, XEN_GUE
         break;
 
     case HVMOP_flush_tlbs:
-        rc = guest_handle_is_null(arg) ? hvmop_flush_tlb_all() : -ENOSYS;
+        rc = guest_handle_is_null(arg) ? hvmop_flush_tlb_all() : -EINVAL;
         break;
 
     case HVMOP_track_dirty_vram:
@@ -5832,7 +5832,7 @@ int hvm_debug_op(struct vcpu *v, int32_t
     {
         case XEN_DOMCTL_DEBUG_OP_SINGLE_STEP_ON:
         case XEN_DOMCTL_DEBUG_OP_SINGLE_STEP_OFF:
-            rc = -ENOSYS;
+            rc = -EOPNOTSUPP;
             if ( !cpu_has_monitor_trap_flag )
                 break;
             rc = 0;
xen/arch/x86/mm.c +1 -1
@@ -3565,7 +3565,7 @@ long do_mmuext_op(
             if ( !opt_allow_superpage )
             {
                 MEM_LOG("Superpages disallowed");
-                rc = -ENOSYS;
+                rc = -EOPNOTSUPP;
             }
             else if ( unlikely(d != pg_owner) )
                 rc = -EPERM;
xen/common/compat/memory.c +1 -1
@@ -353,7 +353,7 @@ int compat_memory_op(unsigned int cmd, X
             struct get_reserved_device_memory grdm;
 
             if ( unlikely(start_extent) )
-                return -ENOSYS;
+                return -EINVAL;
 
             if ( copy_from_guest(&grdm.map, compat, 1) ||
                  !compat_handle_okay(grdm.map.buffer, grdm.map.nr_entries) )
xen/common/event_fifo.c +1 -1
@@ -621,7 +621,7 @@ int evtchn_fifo_expand_array(const struc
     int rc;
 
     if ( !d->evtchn_fifo )
-        return -ENOSYS;
+        return -EOPNOTSUPP;
 
     spin_lock(&d->event_lock);
     rc = add_page_to_event_array(d, expand_array->array_gfn);
xen/common/grant_table.c +1 -1
@@ -3025,7 +3025,7 @@ do_grant_table_op(
         return -EINVAL;
 
     if ( (cmd &= GNTTABOP_CMD_MASK) != GNTTABOP_cache_flush && opaque_in )
-        return -ENOSYS;
+        return -EINVAL;
     
     rc = -EFAULT;
     switch ( cmd )
xen/common/memory.c +7 -7
@@ -937,14 +937,14 @@ long do_memory_op(unsigned long cmd, XEN
 
     case XENMEM_exchange:
         if ( unlikely(start_extent) )
-            return -ENOSYS;
+            return -EINVAL;
 
         rc = memory_exchange(guest_handle_cast(arg, xen_memory_exchange_t));
         break;
 
     case XENMEM_maximum_ram_page:
         if ( unlikely(start_extent) )
-            return -ENOSYS;
+            return -EINVAL;
 
         rc = max_page;
         break;
@@ -953,7 +953,7 @@ long do_memory_op(unsigned long cmd, XEN
     case XENMEM_maximum_reservation:
     case XENMEM_maximum_gpfn:
         if ( unlikely(start_extent) )
-            return -ENOSYS;
+            return -EINVAL;
 
         if ( copy_from_guest(&domid, arg, 1) )
             return -EFAULT;
@@ -1077,7 +1077,7 @@ long do_memory_op(unsigned long cmd, XEN
         struct page_info *page;
 
         if ( unlikely(start_extent) )
-            return -ENOSYS;
+            return -EINVAL;
 
         if ( copy_from_guest(&xrfp, arg, 1) )
             return -EFAULT;
@@ -1114,7 +1114,7 @@ long do_memory_op(unsigned long cmd, XEN
 
     case XENMEM_claim_pages:
         if ( unlikely(start_extent) )
-            return -ENOSYS;
+            return -EINVAL;
 
         if ( copy_from_guest(&reservation, arg, 1) )
             return -EFAULT;
@@ -1148,7 +1148,7 @@ long do_memory_op(unsigned long cmd, XEN
         struct vnuma_info tmp;
 
         if ( unlikely(start_extent) )
-            return -ENOSYS;
+            return -EINVAL;
 
         /*
          * Guest passes nr_vnodes, number of regions and nr_vcpus thus
@@ -1280,7 +1280,7 @@ long do_memory_op(unsigned long cmd, XEN
         struct get_reserved_device_memory grdm;
 
         if ( unlikely(start_extent) )
-            return -ENOSYS;
+            return -EINVAL;
 
         if ( copy_from_guest(&grdm.map, arg, 1) ||
              !guest_handle_okay(grdm.map.buffer, grdm.map.nr_entries) )

_______________________________________________
Xen-devel mailing list
[email protected]
https://lists.xen.org/xen-devel

#1 lore raw

xen/arch/x86/cpu/mtrr/main.c int mtrr_add_page(unsigned long base, un · line 335

Quoted 8 lines · Jan Beulich
xen/arch/x86/cpu/mtrr/main.c +1 -1
@@ -332,7 +332,7 @@ int mtrr_add_page(unsigned long base, un
 	if ((type == MTRR_TYPE_WRCOMB) && !have_wrcomb()) {
 		printk(KERN_WARNING
 		       "mtrr: your processor doesn't support write-combining\n");
-		return -ENOSYS;
+		return -EOPNOTSUPP;

Will this break the classic-xen MTRR code? ISTR it was very picky, from the cpuid work. Also, as some further cleanup, that printk should become a print-once.

The others look ok.

~Andrew

_______________________________________________
Xen-devel mailing list
[email protected]
https://lists.xen.org/xen-devel

#2 lore raw
Quoted 14 lines · Andrew Cooper

xen/arch/x86/cpu/mtrr/main.c int mtrr_add_page(unsigned long base, un · line 335

Quoted 8 lines · Jan Beulich
xen/arch/x86/cpu/mtrr/main.c +1 -1
@@ -332,7 +332,7 @@ int mtrr_add_page(unsigned long base, un
 	if ((type == MTRR_TYPE_WRCOMB) && !have_wrcomb()) {
 		printk(KERN_WARNING
 		       "mtrr: your processor doesn't support write-combining\n");
-		return -ENOSYS;
+		return -EOPNOTSUPP;

Will this break the classic-xen MTRR code? ISTR it was very picky, from the cpuid work. Also, as some further cleanup, that printk should become a print-once.

Quoted 1 line

The others look ok.

That does bring up a good general point though -- the return value is part of the ABI. Are you reasonably confident that none of the callers will be confused when this return value changes? If so, a note in the commit message justifying this confidence would be helpful I think.

-George

_______________________________________________
Xen-devel mailing list
[email protected]
https://lists.xen.org/xen-devel

#3 lore raw
Quoted 16 lines
Quoted 1 line
Quoted 1 line · On 12.08.16 at 12:34, <[email protected]> wrote:
Quoted 14 lines · Andrew Cooper

xen/arch/x86/cpu/mtrr/main.c int mtrr_add_page(unsigned long base, un · line 335

Quoted 8 lines · Jan Beulich
xen/arch/x86/cpu/mtrr/main.c +1 -1
@@ -332,7 +332,7 @@ int mtrr_add_page(unsigned long base, un
 	if ((type == MTRR_TYPE_WRCOMB) && !have_wrcomb()) {
 		printk(KERN_WARNING
 		       "mtrr: your processor doesn't support write-combining\n");
-		return -ENOSYS;
+		return -EOPNOTSUPP;

Will this break the classic-xen MTRR code? ISTR it was very picky, from the cpuid work. Also, as some further cleanup, that printk should become a print-once.

Quoted 6 lines
Quoted 1 line

The others look ok.

That does bring up a good general point though -- the return value is part of the ABI. Are you reasonably confident that none of the callers will be confused when this return value changes? If so, a note in the commit message justifying this confidence would be helpful I think.

I don't think specific return values can be considered part of the ABI, or else we couldn't e.g. change the order in which certain checks get performed.

And then please also consider a hypothetical future hypervisor with the MTRR operations simply ripped out - that would return -ENOSYS or -EOPNOTSUPP then too, without a way for the caller to tell that more generic error condition from the more specific one here.

Jan

_______________________________________________
Xen-devel mailing list
[email protected]
https://lists.xen.org/xen-devel

#4 lore raw

Ping: Re: [PATCH] replace bogus -ENOSYS uses

Quoted 1 line
Quoted 1 line
Quoted 1 line · On 12.08.16 at 13:02, <[email protected]> wrote:

Ping:

Quoted 23 lines
Quoted 16 lines
Quoted 1 line
Quoted 1 line · On 12.08.16 at 12:34, <[email protected]> wrote:
Quoted 14 lines · Andrew Cooper

xen/arch/x86/cpu/mtrr/main.c int mtrr_add_page(unsigned long base, un · line 335

Quoted 8 lines · Jan Beulich
xen/arch/x86/cpu/mtrr/main.c +1 -1
@@ -332,7 +332,7 @@ int mtrr_add_page(unsigned long base, un
 	if ((type == MTRR_TYPE_WRCOMB) && !have_wrcomb()) {
 		printk(KERN_WARNING
 		       "mtrr: your processor doesn't support write-combining\n");
-		return -ENOSYS;
+		return -EOPNOTSUPP;

Will this break the classic-xen MTRR code? ISTR it was very picky, from the cpuid work. Also, as some further cleanup, that printk should become a print-once.

Quoted 6 lines
Quoted 1 line

The others look ok.

That does bring up a good general point though -- the return value is part of the ABI. Are you reasonably confident that none of the callers will be confused when this return value changes? If so, a note in the commit message justifying this confidence would be helpful I think.

Quoted 8 lines

I don't think specific return values can be considered part of the ABI, or else we couldn't e.g. change the order in which certain checks get performed.

And then please also consider a hypothetical future hypervisor with the MTRR operations simply ripped out - that would return -ENOSYS or -EOPNOTSUPP then too, without a way for the caller to tell that more generic error condition from the more specific one here.

Does this address your concerns? I'm still hoping to get a formal ack/nak on this one ...

Jan

_______________________________________________
Xen-devel mailing list
[email protected]
https://lists.xen.org/xen-devel

#5 lore raw
In reply to Andrew Cooper
Quoted 13 lines
Quoted 1 line
Quoted 1 line · On 11.08.16 at 20:10, <[email protected]> wrote:

xen/arch/x86/cpu/mtrr/main.c int mtrr_add_page(unsigned long base, un · line 335

Quoted 8 lines · Jan Beulich
xen/arch/x86/cpu/mtrr/main.c +1 -1
@@ -332,7 +332,7 @@ int mtrr_add_page(unsigned long base, un
 	if ((type == MTRR_TYPE_WRCOMB) && !have_wrcomb()) {
 		printk(KERN_WARNING
 		       "mtrr: your processor doesn't support write-combining\n");
-		return -ENOSYS;
+		return -EOPNOTSUPP;

Will this break the classic-xen MTRR code? ISTR it was very picky, from the cpuid work.

There are no -ENOSYS checks in there afaics, and I also can't otherwise see any way for this change to break it.

Quoted 2 lines

Also, as some further cleanup, that printk should
become a print-once.

Well, for a message that presumably would never actually get issued (as I'm unaware of 64-bit capable CPUs not supporting WC) I don't think this sort of cleanup has a really high priority. Certainly not in this patch.

Jan

_______________________________________________
Xen-devel mailing list
[email protected]
https://lists.xen.org/xen-devel

#6 lore raw
Quoted 15 lines · Jan Beulich
Quoted 12 lines
Quoted 1 line
Quoted 1 line · On 11.08.16 at 20:10, <[email protected]> wrote:

xen/arch/x86/cpu/mtrr/main.c int mtrr_add_page(unsigned long base, un · line 335

Quoted 8 lines · Jan Beulich
xen/arch/x86/cpu/mtrr/main.c +1 -1
@@ -332,7 +332,7 @@ int mtrr_add_page(unsigned long base, un
 	if ((type == MTRR_TYPE_WRCOMB) && !have_wrcomb()) {
 		printk(KERN_WARNING
 		       "mtrr: your processor doesn't support write-combining\n");
-		return -ENOSYS;
+		return -EOPNOTSUPP;

Will this break the classic-xen MTRR code? ISTR it was very picky, from the cpuid work.

There are no -ENOSYS checks in there afaics, and I also can't otherwise see any way for this change to break it.

Quoted 6 lines
Quoted 2 lines

Also, as some further cleanup, that printk should
become a print-once.

Well, for a message that presumably would never actually get issued (as I'm unaware of 64-bit capable CPUs not supporting WC) I don't think this sort of cleanup has a really high priority. Certainly not in this patch.

Agreed. This was a TODO note, rather than a request for this patch. I have noticed a few other printk()'s which should become print once.

Sorry for the confusion.

~Andrew

_______________________________________________
Xen-devel mailing list
[email protected]
https://lists.xen.org/xen-devel

#7 lore raw
Quoted 19 lines
Quoted 1 line
Quoted 1 line · On 12.08.16 at 13:49, <[email protected]> wrote:
Quoted 17 lines · Jan Beulich
Quoted 12 lines
Quoted 1 line
Quoted 1 line · On 11.08.16 at 20:10, <[email protected]> wrote:

xen/arch/x86/cpu/mtrr/main.c int mtrr_add_page(unsigned long base, un · line 335

Quoted 8 lines · Jan Beulich
xen/arch/x86/cpu/mtrr/main.c +1 -1
@@ -332,7 +332,7 @@ int mtrr_add_page(unsigned long base, un
 	if ((type == MTRR_TYPE_WRCOMB) && !have_wrcomb()) {
 		printk(KERN_WARNING
 		       "mtrr: your processor doesn't support write-combining\n");
-		return -ENOSYS;
+		return -EOPNOTSUPP;

Will this break the classic-xen MTRR code? ISTR it was very picky, from the cpuid work.

There are no -ENOSYS checks in there afaics, and I also can't otherwise see any way for this change to break it.

Quoted 2 lines

Also, as some further cleanup, that printk should
become a print-once.

Quoted 7 lines
Quoted 4 lines

Well, for a message that presumably would never actually get issued (as I'm unaware of 64-bit capable CPUs not supporting WC) I don't think this sort of cleanup has a really high priority. Certainly not in this patch.

Agreed. This was a TODO note, rather than a request for this patch. I have noticed a few other printk()'s which should become print once.

Btw., with the MTRR concern hopefully addressed, any chance of getting an ack on the x86 pieces here?

Thanks, Jan

_______________________________________________
Xen-devel mailing list
[email protected]
https://lists.xen.org/xen-devel

Acked-by
#8 lore raw
Quoted 19 lines · Jan Beulich
Quoted 19 lines
Quoted 1 line
Quoted 1 line · On 12.08.16 at 13:49, <[email protected]> wrote:
Quoted 17 lines · Jan Beulich
Quoted 12 lines
Quoted 1 line
Quoted 1 line · On 11.08.16 at 20:10, <[email protected]> wrote:

xen/arch/x86/cpu/mtrr/main.c int mtrr_add_page(unsigned long base, un · line 335

Quoted 8 lines · Jan Beulich
xen/arch/x86/cpu/mtrr/main.c +1 -1
@@ -332,7 +332,7 @@ int mtrr_add_page(unsigned long base, un
 	if ((type == MTRR_TYPE_WRCOMB) && !have_wrcomb()) {
 		printk(KERN_WARNING
 		       "mtrr: your processor doesn't support write-combining\n");
-		return -ENOSYS;
+		return -EOPNOTSUPP;

Will this break the classic-xen MTRR code? ISTR it was very picky, from the cpuid work.

There are no -ENOSYS checks in there afaics, and I also can't otherwise see any way for this change to break it.

Quoted 2 lines

Also, as some further cleanup, that printk should
become a print-once.

Quoted 8 lines
Quoted 6 lines
Quoted 4 lines

Well, for a message that presumably would never actually get issued (as I'm unaware of 64-bit capable CPUs not supporting WC) I don't think this sort of cleanup has a really high priority. Certainly not in this patch.

Agreed. This was a TODO note, rather than a request for this patch. I have noticed a few other printk()'s which should become print once.

Btw., with the MTRR concern hopefully addressed, any chance of getting an ack on the x86 pieces here?

_______________________________________________
Xen-devel mailing list
[email protected]
https://lists.xen.org/xen-devel

#9 lore raw

Ping: [PATCH] replace bogus -ENOSYS uses

In reply to Jan Beulich
Quoted 3 lines
Quoted 1 line
Quoted 1 line · On 09.08.16 at 12:40, <[email protected]> wrote:

This doesn't cover all of them, just the ones that I think would most obviously better be -EINVAL or -EOPNOTSUPP.

Ping? There was a little bit of feedback, but non that really resulted in a need to change something (so far at least).

Jan

Quoted 146 lines
xen/arch/x86/cpu/mcheck/vmce.c +1 -1
@@ -440,7 +440,7 @@ int unmmap_broken_page(struct domain *d,
         return -EINVAL;
 
     if ( !has_hvm_container_domain(d) || !paging_mode_hap(d) )
-        return -ENOSYS;
+        return -EOPNOTSUPP;
 
     rc = -1;
     r_mfn = get_gfn_query(d, gfn, &pt);
xen/arch/x86/cpu/mtrr/main.c +1 -1
@@ -332,7 +332,7 @@ int mtrr_add_page(unsigned long base, un
 	if ((type == MTRR_TYPE_WRCOMB) && !have_wrcomb()) {
 		printk(KERN_WARNING
 		       "mtrr: your processor doesn't support write-combining\n");
-		return -ENOSYS;
+		return -EOPNOTSUPP;
 	}
 
 	if (!size) {
xen/arch/x86/hvm/hvm.c +2 -2
@@ -5592,7 +5592,7 @@ long do_hvm_op(unsigned long op, XEN_GUE
         break;
 
     case HVMOP_flush_tlbs:
-        rc = guest_handle_is_null(arg) ? hvmop_flush_tlb_all() : -ENOSYS;
+        rc = guest_handle_is_null(arg) ? hvmop_flush_tlb_all() : -EINVAL;
         break;
 
     case HVMOP_track_dirty_vram:
@@ -5832,7 +5832,7 @@ int hvm_debug_op(struct vcpu *v, int32_t
     {
         case XEN_DOMCTL_DEBUG_OP_SINGLE_STEP_ON:
         case XEN_DOMCTL_DEBUG_OP_SINGLE_STEP_OFF:
-            rc = -ENOSYS;
+            rc = -EOPNOTSUPP;
             if ( !cpu_has_monitor_trap_flag )
                 break;
             rc = 0;
xen/arch/x86/mm.c +1 -1
@@ -3565,7 +3565,7 @@ long do_mmuext_op(
             if ( !opt_allow_superpage )
             {
                 MEM_LOG("Superpages disallowed");
-                rc = -ENOSYS;
+                rc = -EOPNOTSUPP;
             }
             else if ( unlikely(d != pg_owner) )
                 rc = -EPERM;
xen/common/compat/memory.c +1 -1
@@ -353,7 +353,7 @@ int compat_memory_op(unsigned int cmd, X
             struct get_reserved_device_memory grdm;
 
             if ( unlikely(start_extent) )
-                return -ENOSYS;
+                return -EINVAL;
 
             if ( copy_from_guest(&grdm.map, compat, 1) ||
                  !compat_handle_okay(grdm.map.buffer, grdm.map.nr_entries) 

)

xen/common/event_fifo.c +1 -1
@@ -621,7 +621,7 @@ int evtchn_fifo_expand_array(const struc
     int rc;
 
     if ( !d->evtchn_fifo )
-        return -ENOSYS;
+        return -EOPNOTSUPP;
 
     spin_lock(&d->event_lock);
     rc = add_page_to_event_array(d, expand_array->array_gfn);
xen/common/grant_table.c +1 -1
@@ -3025,7 +3025,7 @@ do_grant_table_op(
         return -EINVAL;
 
     if ( (cmd &= GNTTABOP_CMD_MASK) != GNTTABOP_cache_flush && opaque_in )
-        return -ENOSYS;
+        return -EINVAL;
 
     rc = -EFAULT;
     switch ( cmd )
xen/common/memory.c +2 -2
@@ -937,14 +937,14 @@ long do_memory_op(unsigned long cmd, XEN
 
     case XENMEM_exchange:
         if ( unlikely(start_extent) )
-            return -ENOSYS;
+            return -EINVAL;
 
         rc = memory_exchange(guest_handle_cast(arg, 
 xen_memory_exchange_t));
         break;
 
     case XENMEM_maximum_ram_page:
         if ( unlikely(start_extent) )
-            return -ENOSYS;
+            return -EINVAL;
 
         rc = max_page;
         break;
xen/common/memory.c +4 -4
@@ -953,7 +953,7 @@ long do_memory_op(unsigned long cmd, XEN
     case XENMEM_maximum_reservation:
     case XENMEM_maximum_gpfn:
         if ( unlikely(start_extent) )
-            return -ENOSYS;
+            return -EINVAL;
 
         if ( copy_from_guest(&domid, arg, 1) )
             return -EFAULT;
@@ -1077,7 +1077,7 @@ long do_memory_op(unsigned long cmd, XEN
         struct page_info *page;
 
         if ( unlikely(start_extent) )
-            return -ENOSYS;
+            return -EINVAL;
 
         if ( copy_from_guest(&xrfp, arg, 1) )
             return -EFAULT;
@@ -1114,7 +1114,7 @@ long do_memory_op(unsigned long cmd, XEN
 
     case XENMEM_claim_pages:
         if ( unlikely(start_extent) )
-            return -ENOSYS;
+            return -EINVAL;
 
         if ( copy_from_guest(&reservation, arg, 1) )
             return -EFAULT;
@@ -1148,7 +1148,7 @@ long do_memory_op(unsigned long cmd, XEN
         struct vnuma_info tmp;
 
         if ( unlikely(start_extent) )
-            return -ENOSYS;
+            return -EINVAL;
 
         /*
          * Guest passes nr_vnodes, number of regions and nr_vcpus thus

xen/common/memory.c long do_memory_op(unsigned long cmd, XEN · line 1286

Quoted 8 lines
xen/common/memory.c +1 -1
@@ -1280,7 +1280,7 @@ long do_memory_op(unsigned long cmd, XEN
         struct get_reserved_device_memory grdm;
 
         if ( unlikely(start_extent) )
-            return -ENOSYS;
+            return -EINVAL;
 
         if ( copy_from_guest(&grdm.map, arg, 1) ||
              !guest_handle_okay(grdm.map.buffer, grdm.map.nr_entries) )

_______________________________________________
Xen-devel mailing list
[email protected]
https://lists.xen.org/xen-devel

Reviewed-by on v1 1/1
#10 lore raw
In reply to Jan Beulich
Quoted 4 lines · Jan Beulich

This doesn't cover all of them, just the ones that I think would most obviously better be -EINVAL or -EOPNOTSUPP.

FWIW:

Quoted 154 lines
xen/arch/x86/cpu/mcheck/vmce.c +1 -1
@@ -440,7 +440,7 @@ int unmmap_broken_page(struct domain *d,
         return -EINVAL;
 
     if ( !has_hvm_container_domain(d) || !paging_mode_hap(d) )
-        return -ENOSYS;
+        return -EOPNOTSUPP;
 
     rc = -1;
     r_mfn = get_gfn_query(d, gfn, &pt);
xen/arch/x86/cpu/mtrr/main.c +1 -1
@@ -332,7 +332,7 @@ int mtrr_add_page(unsigned long base, un
        if ((type == MTRR_TYPE_WRCOMB) && !have_wrcomb()) {
                printk(KERN_WARNING
                       "mtrr: your processor doesn't support write-combining\n");
-               return -ENOSYS;
+               return -EOPNOTSUPP;
        }
 
        if (!size) {
xen/arch/x86/hvm/hvm.c +2 -2
@@ -5592,7 +5592,7 @@ long do_hvm_op(unsigned long op, XEN_GUE
         break;
 
     case HVMOP_flush_tlbs:
-        rc = guest_handle_is_null(arg) ? hvmop_flush_tlb_all() : -ENOSYS;
+        rc = guest_handle_is_null(arg) ? hvmop_flush_tlb_all() : -EINVAL;
         break;
 
     case HVMOP_track_dirty_vram:
@@ -5832,7 +5832,7 @@ int hvm_debug_op(struct vcpu *v, int32_t
     {
         case XEN_DOMCTL_DEBUG_OP_SINGLE_STEP_ON:
         case XEN_DOMCTL_DEBUG_OP_SINGLE_STEP_OFF:
-            rc = -ENOSYS;
+            rc = -EOPNOTSUPP;
             if ( !cpu_has_monitor_trap_flag )
                 break;
             rc = 0;
xen/arch/x86/mm.c +1 -1
@@ -3565,7 +3565,7 @@ long do_mmuext_op(
             if ( !opt_allow_superpage )
             {
                 MEM_LOG("Superpages disallowed");
-                rc = -ENOSYS;
+                rc = -EOPNOTSUPP;
             }
             else if ( unlikely(d != pg_owner) )
                 rc = -EPERM;
xen/common/compat/memory.c +1 -1
@@ -353,7 +353,7 @@ int compat_memory_op(unsigned int cmd, X
             struct get_reserved_device_memory grdm;
 
             if ( unlikely(start_extent) )
-                return -ENOSYS;
+                return -EINVAL;
 
             if ( copy_from_guest(&grdm.map, compat, 1) ||
                  !compat_handle_okay(grdm.map.buffer, grdm.map.nr_entries) )
xen/common/event_fifo.c +1 -1
@@ -621,7 +621,7 @@ int evtchn_fifo_expand_array(const struc
     int rc;
 
     if ( !d->evtchn_fifo )
-        return -ENOSYS;
+        return -EOPNOTSUPP;
 
     spin_lock(&d->event_lock);
     rc = add_page_to_event_array(d, expand_array->array_gfn);
xen/common/grant_table.c +1 -1
@@ -3025,7 +3025,7 @@ do_grant_table_op(
         return -EINVAL;
 
     if ( (cmd &= GNTTABOP_CMD_MASK) != GNTTABOP_cache_flush && opaque_in )
-        return -ENOSYS;
+        return -EINVAL;
 
     rc = -EFAULT;
     switch ( cmd )
xen/common/memory.c +7 -7
@@ -937,14 +937,14 @@ long do_memory_op(unsigned long cmd, XEN
 
     case XENMEM_exchange:
         if ( unlikely(start_extent) )
-            return -ENOSYS;
+            return -EINVAL;
 
         rc = memory_exchange(guest_handle_cast(arg, xen_memory_exchange_t));
         break;
 
     case XENMEM_maximum_ram_page:
         if ( unlikely(start_extent) )
-            return -ENOSYS;
+            return -EINVAL;
 
         rc = max_page;
         break;
@@ -953,7 +953,7 @@ long do_memory_op(unsigned long cmd, XEN
     case XENMEM_maximum_reservation:
     case XENMEM_maximum_gpfn:
         if ( unlikely(start_extent) )
-            return -ENOSYS;
+            return -EINVAL;
 
         if ( copy_from_guest(&domid, arg, 1) )
             return -EFAULT;
@@ -1077,7 +1077,7 @@ long do_memory_op(unsigned long cmd, XEN
         struct page_info *page;
 
         if ( unlikely(start_extent) )
-            return -ENOSYS;
+            return -EINVAL;
 
         if ( copy_from_guest(&xrfp, arg, 1) )
             return -EFAULT;
@@ -1114,7 +1114,7 @@ long do_memory_op(unsigned long cmd, XEN
 
     case XENMEM_claim_pages:
         if ( unlikely(start_extent) )
-            return -ENOSYS;
+            return -EINVAL;
 
         if ( copy_from_guest(&reservation, arg, 1) )
             return -EFAULT;
@@ -1148,7 +1148,7 @@ long do_memory_op(unsigned long cmd, XEN
         struct vnuma_info tmp;
 
         if ( unlikely(start_extent) )
-            return -ENOSYS;
+            return -EINVAL;
 
         /*
          * Guest passes nr_vnodes, number of regions and nr_vcpus thus
@@ -1280,7 +1280,7 @@ long do_memory_op(unsigned long cmd, XEN
         struct get_reserved_device_memory grdm;
 
         if ( unlikely(start_extent) )
-            return -ENOSYS;
+            return -EINVAL;
 
         if ( copy_from_guest(&grdm.map, arg, 1) ||
              !guest_handle_okay(grdm.map.buffer, grdm.map.nr_entries) )
Quoted 5 lines

_______________________________________________
Xen-devel mailing list
[email protected]
https://lists.xen.org/xen-devel

_______________________________________________
Xen-devel mailing list
[email protected]
https://lists.xen.org/xen-devel