From: "Jan Beulich" Subject: Re: [PATCH v2] xmalloc: add support for checking the pool integrity Date: Mon, 08 Dec 2014 16:23:23 +0000 Message-ID: <5485DE8B020000780004DDEA@mail.emea.novell.com> References: <1418005848-17447-1-git-send-email-mdontu@bitdefender.com> <548588E9020000780004DAF4@mail.emea.novell.com> <20141208180001.086cb5e6@bitdefender.com> Mime-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Return-path: Received: from mail6.bemta5.messagelabs.com ([195.245.231.135]) by lists.xen.org with esmtp (Exim 4.72) (envelope-from ) id 1Xy15t-0000eT-Ap for xen-devel@lists.xenproject.org; Mon, 08 Dec 2014 16:23:29 +0000 In-Reply-To: <20141208180001.086cb5e6@bitdefender.com> Content-Disposition: inline List-Unsubscribe: , List-Post: List-Help: List-Subscribe: , Sender: xen-devel-bounces@lists.xen.org Errors-To: xen-devel-bounces@lists.xen.org To: =?UTF-8?Q?Mihai=20Don=C8=9Bu?= Cc: xen-devel@lists.xenproject.org List-Id: xen-devel@lists.xenproject.org >>> On 08.12.14 at 17:00, wrote: > On Monday 08 December 2014 10:18:01 Jan Beulich wrote: >> >>> On 08.12.14 at 03:30, wrote: >> > +#ifndef NDEBUG >> > +static bool_t xmem_pool_check_size(const struct bhdr *b, int fl, int sl) >> > +{ >> > + while ( b ) >> > + { >> > + int __fl; >> > + int __sl; >> > + >> > + MAPPING_INSERT(b->size, &__fl, &__sl); >> > + if ( __fl != fl || __sl != sl ) >> > + { >> > + printk(XENLOG_ERR "xmem_pool: for block %p size = %u, { fl = > %d, sl = %d } should be { fl = %d, sl = %d }\n", >> >> Quoting my reply to v1: "Long line. Only the format message alone >> is allowed to exceed 80 characters." >> > > Just so I don't send another faulty patch, you would see that printk() > being: > > printk(XENLOG_ERR > "xmem_pool: for block %p size = %u, { fl = %d, sl = %d } should be { fl = %d, sl = %d }\n", > b, b->size, fl, sl, __fl, __sl); > > ? Yes. And I'd also recommend removing the spaces around the = characters in the format string. Considering the message being a debugging one, perhaps the two pairs could be printed without any extras, i.e. just {x,y}. >> Also with there potentially being multiple pools, shouldn't all of the >> log messages the patch issues be extended to allow identifying the >> offending one? >> > > I think I can insert the pool name in that message too. Something like: > > printk(XENLOG_ERR > "xmem_pool: %s: for block [...]\n", > pool->name, b, b->size [...]); > > would do? A quick preview: Yes. I very think that's what the name's for after all. Jan