[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [Xen-devel] xen-ringwatch issues



Hi Ian,

OK, I have followed your suggestions and created a new patch

this new patch does fix the issue fully for the negative numbers

I didnt run the patch on 64bit OS since xenserver has 32bit Dom0

but i think it is safe to add

here is the patch in case you or anyone want to have look at and if you have comments on before i send it
*** xen-ringwatch.old  2015-01-09 17:05:55.000000000 -0500
--- xen-ringwatch.new  2015-01-09 17:06:14.000000000 -0500
***************
*** 238,244 ****
       match = cls._pattern.search(line)
       if not match:
         raise Exception, "Malformed %s input: %s" % \
! Â Â Â Â Â Â Â Â Â Â (cls.__name__, repr(s))

       i = iter(match.groups())
       for k in i:
--- 238,244 ----
       match = cls._pattern.search(line)
       if not match:
         raise Exception, "Malformed %s input: %s" % \
! Â Â Â Â Â Â Â Â Â Â (cls.__name__, repr(line))

       i = iter(match.groups())
       for k in i:
***************
*** 251,263 ****

   class Req(Queue):

! Â Â Â Â _pattern = Pattern("req (prod) (\d+) (cons) (\d+) (event) (\d+)")

     def __init__(self, prod, cons, event, **d):
       RingState.Queue.__init__(self, **d)
       self.prod Â= int(prod)
       self.cons Â= int(cons)
       self.event = int(event)

     def __repr__(self):
       return "%s(prod=%d, cons=%d, event=%d)" % \
--- 251,270 ----

   class Req(Queue):

! Â Â Â Â _pattern = Pattern("req (prod) (\d+) (cons) ([-]*\d+) (event) (\d+)")

     def __init__(self, prod, cons, event, **d):
       RingState.Queue.__init__(self, **d)
       self.prod Â= int(prod)
       self.cons Â= int(cons)
       self.event = int(event)
+
+ Â Â Â Â Â Â if self.cons < 0:
+ Â Â Â Â Â Â Â Â Âself.cons = 4294967296 + self.cons
+ Â Â Â Â Â Â if self.prod < 0:
+ Â Â Â Â Â Â Â Â Âself.prod = 4294967296 + self.prod
+ Â Â Â Â Â Â if self.event < 0:
+ Â Â Â Â Â Â Â Â Âself.event = 4294967296 + self.event

     def __repr__(self):
       return "%s(prod=%d, cons=%d, event=%d)" % \
***************
*** 274,287 ****

   class Rsp(Queue):

! Â Â Â Â _pattern = Pattern("rsp (prod) (\d+) (pvt) (\d+) (event) (\d+)")

     def __init__(self, prod, pvt, event, **d):
       RingState.Queue.__init__(self, **d)
       self.prod Â= int(prod)
       self.pvt  = int(pvt)
       self.event = int(event)
!
     def __repr__(self):
       return "%s(prod=%d, pvt=%d, event=%d)" % \
         (type(self).__name__, self.prod, self.pvt, self.event)
--- 281,301 ----

   class Rsp(Queue):

! Â Â Â Â _pattern = Pattern("rsp (prod) (\d+) (pvt) ([-]*\d+) (event) (\d+)")

     def __init__(self, prod, pvt, event, **d):
       RingState.Queue.__init__(self, **d)
       self.prod Â= int(prod)
       self.pvt  = int(pvt)
       self.event = int(event)
!
! Â Â Â Â Â Â if self.pvt < 0:
! Â Â Â Â Â Â Â Â Âself.pvt = 4294967296 + self.pvt
! Â Â Â Â Â Â if self.prod < 0:
! Â Â Â Â Â Â Â Â Âself.prod = 4294967296 + self.prod
! Â Â Â Â Â Â if self.event < 0:
! Â Â Â Â Â Â Â Â Âself.event = 4294967296 + self.event
!
     def __repr__(self):
       return "%s(prod=%d, pvt=%d, event=%d)" % \
         (type(self).__name__, self.prod, self.pvt, self.event)


Thanks


On Fri, Jan 9, 2015 at 5:10 AM, Ian Campbell <Ian.Campbell@xxxxxxxxxx> wrote:
On Thu, 2015-01-08 at 14:07 -0500, moftah moftah wrote:
> Hi All,
> We are using Xenserver 6.2

FYI xenserver is developed as a separate project over at
www.xenserver.org, so in general you should be reporting
issue/requesting help over on their forums and lists etc.

However, since xen-ringwatch is shipped by upstream Xen we can at least
try and help with that bit here.

[...]
> so after searching around we changed the file xen-ringwatch in order
> to see the real issue the changes are

Those look sensible, please could you send with a changelog message and
a Signed-off-by as described in
http://wiki.xen.org/wiki/Submitting_Xen_Patches . The S-o-b in
particular is required in order to be able to accept a code
contribution.

> --- /usr/sbin/xen-ringwatch  Â2013-07-22 13:52:19.000000000 +0200
> +++ /usr/sbin/xen-ringwatch  Â2013-07-22 13:52:30.000000000 +0200
> @@ -238,7 +238,7 @@
>Â Â Â Â Â Â Â match = cls._pattern.search(line)
>Â Â Â Â Â Â Â if not match:
>Â Â Â Â Â Â Â Â Â raise Exception, "Malformed %s input: %s" % \
> -Â Â Â Â Â Â Â Â Â Â (cls.__name__, repr(s))
> +Â Â Â Â Â Â Â Â Â Â (cls.__name__, repr(line))
>
>Â Â Â Â Â Â Â i = iter(match.groups())
>Â Â Â Â Â Â Â for k in i:
>
> now the issue we see is like this
> Exception: Malformed Req input: 'req prod 3412900880 cons -882066416 event 3412900881'

I bet the negative number is confusing things (ah, which you also said
further down).

Really the kernel ought to be printing these as unsigned (for which
you'll need to speak to the xenserver.org folks, I think)

But the python code could also deal with them more gracefully when it
sees them. You'd need to start by allowing the regex used for the match
to accept an optional leading "-" on the numbers.

You probably also want to cast the result to the unsigned value during
the subsequent parsing, my Python-fu isn't sufficient to know off hand
how one would do that.

Ian.



_______________________________________________
Xen-devel mailing list
Xen-devel@xxxxxxxxxxxxx
http://lists.xen.org/xen-devel

 


Rackspace

Lists.xenproject.org is hosted with RackSpace, monitoring our
servers 24x7x365 and backed by RackSpace's Fanatical Support®.