mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: "Denis Efremov (Oracle)" <efremov@linux.com>
To: linux-block@vger.kernel.org
Cc: linux-kernel@vger.kernel.org,
	"Denis Efremov (Oracle)" <efremov@linux.com>
Subject: [PATCH] floppy: remove is_alive()
Date: Fri,  9 Oct 2026 14:47:07 +0400	[thread overview]
Message-ID: <20261009104707.309842-1-efremov@linux.com> (raw)

is_alive() prints "timeout handler died" when fdc_busy is set,
command_status is below 2 and fd_timeout is not pending. The driver
passes through that state on every FDC handover:

 - lock_fdc() and floppy_queue_rq() set fdc_busy before they arm
   fd_timeout, with set_fdc() in between since "floppy: select FDC before
   arming timeout work";
 - unlock_fdc() cancels fd_timeout before it clears fdc_busy;
 - fd_timeout is not pending while floppy_shutdown() runs, and without a
   cont floppy_shutdown() only queues redo_fd_request(), which arms
   fd_timeout or releases the FDC later.

None of the callers excludes these windows, so each of them can report a
dead timeout handler while the driver works normally:

 - floppy_queue_rq() returns BLK_STS_RESOURCE while the FDC is busy, and
   blk-mq re-runs the queue every 3 ms, so it samples other contexts'
   handovers hundreds of times per second;
 - floppy_interrupt() checks after schedule_bh(), when the next step may
   already run on another CPU, and also when the interrupt arrives while
   floppy_shutdown() runs;
 - floppy_shutdown() checks right after it queued redo_fd_request() in
   the "no cont in shutdown!" case.

The check also cannot report the hang it describes. With the FDC held and
no timeout armed, floppy_shutdown() never runs, and floppy_interrupt()
runs only if the controller interrupts. Only the blk-mq retries in
floppy_queue_rq() would keep checking, among their false reports. When
fd_timeout does fire, show_floppy() already prints fdc_busy,
command_status and whether fd_timeout is pending.

Remove is_alive() and its callers.

Signed-off-by: Denis Efremov (Oracle) <efremov@linux.com>
---
 drivers/block/floppy.c | 14 --------------
 1 file changed, 14 deletions(-)

diff --git a/drivers/block/floppy.c b/drivers/block/floppy.c
index f04397b8e381..e354ea61f23d 100644
--- a/drivers/block/floppy.c
+++ b/drivers/block/floppy.c
@@ -635,15 +635,6 @@ static inline void debugt(const char *func, const char *msg) { }
 static DECLARE_DELAYED_WORK(fd_timeout, floppy_shutdown);
 static const char *timeout_message;
 
-static void is_alive(const char *func, const char *message)
-{
-	/* this routine checks whether the floppy driver is "alive" */
-	if (test_bit(0, &fdc_busy) && command_status < 2 &&
-	    !delayed_work_pending(&fd_timeout)) {
-		DPRINT("%s: timeout handler died.  %s\n", func, message);
-	}
-}
-
 static void (*do_floppy)(void) = NULL;
 
 #define OLOGSIZE 20
@@ -1727,7 +1718,6 @@ irqreturn_t floppy_interrupt(int irq, void *dev_id)
 		pr_info("DOR0=%x\n", fdc_state[0].dor);
 		pr_info("floppy interrupt on bizarre fdc %d\n", current_fdc);
 		pr_info("handler=%ps\n", handler);
-		is_alive(__func__, "bizarre fdc");
 		return IRQ_NONE;
 	}
 
@@ -1762,7 +1752,6 @@ irqreturn_t floppy_interrupt(int irq, void *dev_id)
 		return IRQ_NONE;
 	}
 	schedule_bh(handler);
-	is_alive(__func__, "normal interrupt end");
 
 	/* FIXME! Was it really for us? */
 	return IRQ_HANDLED;
@@ -1890,7 +1879,6 @@ static void floppy_shutdown(struct work_struct *arg)
 		pr_info("no cont in shutdown!\n");
 		process_fd_request();
 	}
-	is_alive(__func__, "");
 }
 
 /* start motor, check media-changed condition and write protection */
@@ -2863,7 +2851,6 @@ static blk_status_t floppy_queue_rq(struct blk_mq_hw_ctx *hctx,
 	if (test_and_set_bit(0, &fdc_busy)) {
 		/* fdc busy, this new request will be treated when the
 		   current one is done */
-		is_alive(__func__, "old request running");
 		return BLK_STS_RESOURCE;
 	}
 
@@ -2875,7 +2862,6 @@ static blk_status_t floppy_queue_rq(struct blk_mq_hw_ctx *hctx,
 	__reschedule_timeout(MAXTIMEOUT, "fd_request");
 	set_fdc(0);
 	process_fd_request();
-	is_alive(__func__, "");
 	return BLK_STS_OK;
 }
 

base-commit: af32da41b0327b9c6a37856ba82b6760d6c8d10e
-- 
2.56.0


                 reply	other threads:[~2026-10-09 10:47 UTC|newest]

Thread overview: [no followups] expand[flat|nested]  mbox.gz  Atom feed

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=20261009104707.309842-1-efremov@linux.com \
    --to=efremov@linux.com \
    --cc=linux-block@vger.kernel.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

all inboxes | Powered by JetHome®