Message ID | 20211007085027.13050-5-frankja@linux.ibm.com (mailing list archive) |
---|---|
State | New, archived |
Headers | show |
Series | s390x: Cleanup and maintenance 2 | expand |
On 07/10/2021 10.50, Janosch Frank wrote: > Every time something goes wrong in a way we don't expect, we need to > add debug prints to some UVC to get the unexpected return code. > > Let's just put the printing behind a macro so we can enable it if > needed via a simple switch. > > Signed-off-by: Janosch Frank <frankja@linux.ibm.com> > Reviewed-by: Claudio Imbrenda <imbrenda@linux.ibm.com> > --- > lib/s390x/asm/uv.h | 12 ++++++++++++ > 1 file changed, 12 insertions(+) > > diff --git a/lib/s390x/asm/uv.h b/lib/s390x/asm/uv.h > index 2f099553..16db086d 100644 > --- a/lib/s390x/asm/uv.h > +++ b/lib/s390x/asm/uv.h > @@ -12,6 +12,11 @@ > #ifndef _ASMS390X_UV_H_ > #define _ASMS390X_UV_H_ > > +/* Enables printing of command code and return codes for failed UVCs */ > +#ifndef UVC_ERR_DEBUG > +#define UVC_ERR_DEBUG 0 > +#endif > + > #define UVC_RC_EXECUTED 0x0001 > #define UVC_RC_INV_CMD 0x0002 > #define UVC_RC_INV_STATE 0x0003 > @@ -194,6 +199,13 @@ static inline int uv_call_once(unsigned long r1, unsigned long r2) > : [cc] "=d" (cc) > : [r1] "a" (r1), [r2] "a" (r2) > : "memory", "cc"); > + > + if (UVC_ERR_DEBUG && cc) > + printf("UV call error: call %x rc %x rrc %x\n", > + ((struct uv_cb_header *)r2)->cmd, > + ((struct uv_cb_header *)r2)->rc, > + ((struct uv_cb_header *)r2)->rrc); > + > return cc; > } > > Reviewed-by: Thomas Huth <thuth@redhat.com>
On 10/7/21 10:50, Janosch Frank wrote: > Every time something goes wrong in a way we don't expect, we need to > add debug prints to some UVC to get the unexpected return code. > > Let's just put the printing behind a macro so we can enable it if > needed via a simple switch. > > Signed-off-by: Janosch Frank <frankja@linux.ibm.com> > Reviewed-by: Claudio Imbrenda <imbrenda@linux.ibm.com> > --- > lib/s390x/asm/uv.h | 12 ++++++++++++ > 1 file changed, 12 insertions(+) > > diff --git a/lib/s390x/asm/uv.h b/lib/s390x/asm/uv.h > index 2f099553..16db086d 100644 > --- a/lib/s390x/asm/uv.h > +++ b/lib/s390x/asm/uv.h > @@ -12,6 +12,11 @@ > #ifndef _ASMS390X_UV_H_ > #define _ASMS390X_UV_H_ > > +/* Enables printing of command code and return codes for failed UVCs */ > +#ifndef UVC_ERR_DEBUG > +#define UVC_ERR_DEBUG 0 > +#endif > + > #define UVC_RC_EXECUTED 0x0001 > #define UVC_RC_INV_CMD 0x0002 > #define UVC_RC_INV_STATE 0x0003 > @@ -194,6 +199,13 @@ static inline int uv_call_once(unsigned long r1, unsigned long r2) > : [cc] "=d" (cc) > : [r1] "a" (r1), [r2] "a" (r2) > : "memory", "cc"); > + > + if (UVC_ERR_DEBUG && cc) That needs to check cc == 1... > + printf("UV call error: call %x rc %x rrc %x\n", > + ((struct uv_cb_header *)r2)->cmd, > + ((struct uv_cb_header *)r2)->rc, > + ((struct uv_cb_header *)r2)->rrc); > + > return cc; > } > >
diff --git a/lib/s390x/asm/uv.h b/lib/s390x/asm/uv.h index 2f099553..16db086d 100644 --- a/lib/s390x/asm/uv.h +++ b/lib/s390x/asm/uv.h @@ -12,6 +12,11 @@ #ifndef _ASMS390X_UV_H_ #define _ASMS390X_UV_H_ +/* Enables printing of command code and return codes for failed UVCs */ +#ifndef UVC_ERR_DEBUG +#define UVC_ERR_DEBUG 0 +#endif + #define UVC_RC_EXECUTED 0x0001 #define UVC_RC_INV_CMD 0x0002 #define UVC_RC_INV_STATE 0x0003 @@ -194,6 +199,13 @@ static inline int uv_call_once(unsigned long r1, unsigned long r2) : [cc] "=d" (cc) : [r1] "a" (r1), [r2] "a" (r2) : "memory", "cc"); + + if (UVC_ERR_DEBUG && cc) + printf("UV call error: call %x rc %x rrc %x\n", + ((struct uv_cb_header *)r2)->cmd, + ((struct uv_cb_header *)r2)->rc, + ((struct uv_cb_header *)r2)->rrc); + return cc; }