public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
From: Takashi Iwai <tiwai@suse.de>
To: "Jörn Engel" <joern@logfs.org>
Cc: linux-kernel@vger.kernel.org,
	Andrew Morton <akpm@linux-foundation.org>,
	Borislav Petkov <bp@alien8.de>, Jeff Moyer <jmoyer@redhat.com>
Subject: Re: [PATCH 0/9] Add blockconsole version 1.1 (try 2)
Date: Thu, 07 Mar 2013 19:46:50 +0100	[thread overview]
Message-ID: <s5hk3pjm4it.wl%tiwai@suse.de> (raw)
In-Reply-To: <20130306194950.GA19938@logfs.org>

At Wed, 6 Mar 2013 14:49:50 -0500,
Jörn Engel wrote:
> 
> On Tue, 5 March 2013 18:36:41 +0100, Takashi Iwai wrote:
> > 
> > Another thing I noticed is that the panic handler calls bcon_write(),
> > and it doesn't write to the device by itself.  Is it really supposed
> > to work?
> 
> Clearly it is supposed to work.  In reality it sometimes does and
> sometimes does not.  Patches to improve the success rate are welcome.

What I thought is to driver submit_bio in the panic handler itself
so that no scheduling is involved, like the patch below.  But I'm not
sure whether it would actually work...

> 
> > Meanwhile I hacked the code to allow it being built as a module.
> > If anyone is interested, I'll send a patch series.  It's pretty
> > hackish, so likely need more brush up, though.
> 
> I am interested.

OK, I'll send a patch series.  It'll be built on top of my previous
patches.  And I wrote it after merging to 3.9-rc1, so might be
slightly fuzzy to your tree.


thanks,

Takashi

---
diff --git a/drivers/block/blockconsole.c b/drivers/block/blockconsole.c
index 5fc192a..5042a5a 100644
--- a/drivers/block/blockconsole.c
+++ b/drivers/block/blockconsole.c
@@ -361,6 +361,16 @@ static void bcon_writesector(struct blockconsole *bc, int index)
 	submit_bio(WRITE, bio);
 }
 
+static void bcon_do_writeback(struct blockconsole *bc)
+{
+	while (bcon_write_sector(bc) != bcon_console_sector(bc)) {
+		bcon_writesector(bc, bcon_write_sector(bc));
+		bcon_advance_write_bytes(bc, SECTOR_SIZE);
+		if (bcon_write_sector(bc) == 0)
+			bcon_erase_segment(bc);
+	}
+}
+
 static int bcon_writeback(void *_bc)
 {
 	struct blockconsole *bc = _bc;
@@ -373,12 +383,7 @@ static int bcon_writeback(void *_bc)
 		schedule();
 		if (kthread_should_stop())
 			break;
-		while (bcon_write_sector(bc) != bcon_console_sector(bc)) {
-			bcon_writesector(bc, bcon_write_sector(bc));
-			bcon_advance_write_bytes(bc, SECTOR_SIZE);
-			if (bcon_write_sector(bc) == 0)
-				bcon_erase_segment(bc);
-		}
+		bcon_do_writeback(bc);
 	}
 	return 0;
 }
@@ -476,7 +481,7 @@ static int blockconsole_panic(struct notifier_block *this, unsigned long event,
 	n = SECTOR_SIZE - bcon_console_ofs(bc);
 	if (n != SECTOR_SIZE)
 		bcon_advance_console_bytes(bc, n);
-	bcon_writeback(bc);
+	bcon_do_writeback(bc);
 	return NOTIFY_DONE;
 }
 


  reply	other threads:[~2013-03-07 18:46 UTC|newest]

Thread overview: 37+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2013-02-28 21:39 [PATCH 0/9] Add blockconsole version 1.1 (try 2) Joern Engel
2013-02-28 21:39 ` [PATCH 1/9] do_mounts: constify name_to_dev_t parameter Joern Engel
2013-02-28 21:39 ` [PATCH 2/9] add blockconsole version 1.1 Joern Engel
2013-02-28 21:39 ` [PATCH 3/9] printk: add CON_ALLDATA console flag Joern Engel
2013-03-01 14:52   ` Jeff Moyer
2013-03-01 14:58     ` Borislav Petkov
2013-03-01 15:08       ` Jeff Moyer
2013-03-01 15:31         ` Borislav Petkov
2013-03-01 15:42           ` Jeff Moyer
2013-03-01 15:58             ` Borislav Petkov
2013-03-01 16:15         ` Jörn Engel
2013-02-28 21:39 ` [PATCH 4/9] netconsole: use CON_ALLDATA Joern Engel
2013-02-28 21:39 ` [PATCH 5/9] blockconsole: " Joern Engel
2013-03-01 16:11   ` Jeff Moyer
2013-03-01 16:20     ` Jörn Engel
2013-03-01 17:52       ` Borislav Petkov
2013-03-01 16:31         ` Jörn Engel
2013-03-01 17:56           ` Borislav Petkov
2013-02-28 21:39 ` [PATCH 6/9] bcon: add a release work struct Joern Engel
2013-02-28 21:40 ` [PATCH 7/9] bcon: check for hdparm in bcon_tail Joern Engel
2013-02-28 21:40 ` [PATCH 8/9] blockconsole: Allow to pass a device file path to bcon_tail Joern Engel
2013-02-28 21:40 ` [PATCH 9/9] bcon: remove version 1.0 support Joern Engel
2013-03-01 17:15 ` [PATCH 0/9] Add blockconsole version 1.1 (try 2) Takashi Iwai
2013-03-01 16:22   ` Jörn Engel
2013-03-05 17:36     ` Takashi Iwai
2013-03-06 19:49       ` Jörn Engel
2013-03-07 18:46         ` Takashi Iwai [this message]
2013-03-07 18:51           ` [PATCH 0/3] blockconsole: make it a module Takashi Iwai
2013-03-07 18:51             ` [PATCH 1/3] Export sched_setscheduler_nocheck() Takashi Iwai
2013-03-07 18:51             ` [PATCH 2/3] block/partitions: Support dynamic addition of partition checkers Takashi Iwai
2013-03-07 18:51             ` [PATCH 3/3] blockconsole: Allow to be a module Takashi Iwai
2013-03-01 17:17   ` [PATCH 1/3] blockconsole: Fix undefined MAX_RT_PRIO Takashi Iwai
2013-03-01 17:17     ` [PATCH 2/3] blockconsole: Rename device_lock with bc_device_lock Takashi Iwai
2013-03-01 17:17     ` [PATCH 3/3] blockconsole: Mark a local work struct static Takashi Iwai
2013-03-20 22:52 ` [PATCH 0/9] Add blockconsole version 1.1 (try 2) Borislav Petkov
2013-03-21  6:30   ` Takashi Iwai
  -- strict thread matches above, loose matches on Subject: below --
2013-05-09 20:42 [PATCH 00/14] Add blockconsole version 1.1 (try 3) Joern Engel
2013-05-09 20:43 ` [PATCH 0/9] Add blockconsole version 1.1 (try 2) Joern Engel

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=s5hk3pjm4it.wl%tiwai@suse.de \
    --to=tiwai@suse.de \
    --cc=akpm@linux-foundation.org \
    --cc=bp@alien8.de \
    --cc=jmoyer@redhat.com \
    --cc=joern@logfs.org \
    --cc=linux-kernel@vger.kernel.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