public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
From: David Howells <dhowells@redhat.com>
To: Linus Torvalds <torvalds@linux-foundation.org>
Cc: dhowells@redhat.com, akpm@linux-foundation.org,
	linux-kernel@vger.kernel.org
Subject: Re: [PATCH 2/2] Use the cut_here() function in AFS, CacheFiles, FS-Cache and RxRPC
Date: Thu, 20 Aug 2009 17:06:31 +0100	[thread overview]
Message-ID: <6149.1250784391@redhat.com> (raw)
In-Reply-To: <alpine.LFD.2.01.0908200816090.3158@localhost.localdomain>

Linus Torvalds <torvalds@linux-foundation.org> wrote:

> instead. And yes, in the long run, I really think we should just extend 
> the current BUG() reporting to have that kind of semantics, but I think 
> your "cut_here()" thing is a horrible hack.

What about situations where I want to print quite a lot of information, say
several lines' worth?

For instance, if you look at cachefiles_mark_object_active() in
fs/cachefiles/namei.c, you'll see something like (which extended by one of my
patches):

wait_for_old_object:
	if (xobject->fscache.state < FSCACHE_OBJECT_DYING) {
		unsigned keylen;
		u8 *keybuf;

		printk(KERN_ERR "\n");
		printk(KERN_ERR "CacheFiles: Error:"
		       " Unexpected object collision\n");
		printk(KERN_ERR "xobject: OBJ%x\n",
		       xobject->fscache.debug_id);
		printk(KERN_ERR "xobjstate=%s\n",
		       fscache_object_states[xobject->fscache.state]);
		printk(KERN_ERR "xobjflags=%lx\n", xobject->fscache.flags);
		printk(KERN_ERR "xobjevent=%lx [%lx]\n",
		       xobject->fscache.events, xobject->fscache.event_mask);
		printk(KERN_ERR "xops=%u inp=%u exc=%u\n",
		       xobject->fscache.n_ops, xobject->fscache.n_in_progress,
		       xobject->fscache.n_exclusive);
		printk(KERN_ERR "xcookie=%p [pr=%p nd=%p fl=%lx]\n",
		       xobject->fscache.cookie,
		       xobject->fscache.cookie->parent,
		       xobject->fscache.cookie->netfs_data,
		       xobject->fscache.cookie->flags);
		printk(KERN_ERR "xparent=%p\n",
		       xobject->fscache.parent);
		printk(KERN_ERR "object: OBJ%x\n",
		       object->fscache.debug_id);
		printk(KERN_ERR "cookie=%p [pr=%p nd=%p fl=%lx]\n",
		       object->fscache.cookie,
		       object->fscache.cookie->parent,
		       object->fscache.cookie->netfs_data,
		       object->fscache.cookie->flags);
		printk(KERN_ERR "parent=%p\n",
		       object->fscache.parent);

		keybuf = kmalloc(512, GFP_NOIO);
		if (keybuf) {
			struct fscache_cookie *cookie;
			unsigned loop;

			cookie = object->fscache.cookie;
			keylen = cookie->def->get_key(cookie->netfs_data,
						      keybuf, 512);
			printk(KERN_ERR "okey=[%u] '", keylen);
			for (loop = 0; loop < keylen; loop++)
				printk("%02x", keybuf[loop]);
			printk("'\n");

			cookie = xobject->fscache.cookie;
			keylen = cookie->def->get_key(cookie->netfs_data,
						      keybuf, 512);
			printk(KERN_ERR "xkey=[%u] '", keylen);
			for (loop = 0; loop < keylen; loop++)
				printk("%02x", keybuf[loop]);
			printk("'\n");

			kfree(keybuf);
		}

		BUG();

With the cut_here() approach, I could put a cut_here() just inside the if-body,
but doing it with your approach and putting the whole lot in one format string
would also be pretty horrible, and risks overrunning the printk buffer.

David


  reply	other threads:[~2009-08-20 16:06 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2009-08-20 10:49 [PATCH 1/2] Allow the 'cut here' oops line to be displayed before calling BUG() David Howells
2009-08-20 10:50 ` [PATCH 2/2] Use the cut_here() function in AFS, CacheFiles, FS-Cache and RxRPC David Howells
2009-08-20 15:32   ` Linus Torvalds
2009-08-20 16:06     ` David Howells [this message]
2009-08-20 16:44       ` Linus Torvalds
2009-08-25 11:36 ` [PATCH 1/2] Allow the 'cut here' oops line to be displayed before calling BUG() Pavel Machek

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=6149.1250784391@redhat.com \
    --to=dhowells@redhat.com \
    --cc=akpm@linux-foundation.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=torvalds@linux-foundation.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox