All the mail mirrored from lore.kernel.org
 help / color / mirror / Atom feed
From: Tiezhu Yang <yangtiezhu@loongson.cn>
To: James.Bottomley@HansenPartnership.com, martin.petersen@oracle.com
Cc: linux-scsi@vger.kernel.org, linux-kernel@vger.kernel.org
Subject: Problem and solution about SCSI configs
Date: Mon, 29 Apr 2024 17:29:02 +0800	[thread overview]
Message-ID: <ce58178c-7f26-a9a1-443a-71577162c814@loongson.cn> (raw)

Hi all,

In the current code, if the rootfs is located on a SCSI device and root=
/dev/sda3 is specified as boot option in grub.cfg, kernel boots failed
with CONFIG_SCSI=y and CONFIG_BLK_DEV_SD=m when there is no initrd, here
are the boot messages via the serial console:

   /dev/root: Can't open blockdev
   VFS: Cannot open root device "/dev/sda3" or unknown-block(0,0): error -6
   Please append a correct "root=" boot option; here are the available 
partitions:
   ...
   Kernel panic - not syncing: VFS: Unable to mount root fs on 
unknown-block(0,0)

Set CONFIG_BLK_DEV_SD=y can solve the above issue, but in order to avoid
the potential failure, it is better to restrict the configs.

Here are some backgrounds according to Documentation/scsi/scsi.rst and
drivers/scsi/Kconfig:

The SCSI support in the Linux kernel can be modularized in a number of
different ways depending upon the needs of the end user.

The scsi-core (also known as the "mid level") contains the core of SCSI
support. Without it you can do nothing with any of the other SCSI drivers.
The SCSI core support can be a module, or it can be built into the kernel.
If the core is a module, it must be the first SCSI module loaded, and if
you unload the modules, it will have to be the last one unloaded.

The individual upper and lower level drivers can be loaded in any order
once the SCSI core is present in the kernel (either compiled in or loaded
as a module). The disk driver, CD-ROM driver, tape driver and SCSI generics
driver represent the upper level drivers to support the various assorted
devices which can be controlled.  You can for example load the tape driver
to use the tape drive, and then unload it once you have no further need for
the driver (and release the associated memory).

However, do not compile the SCSI disk driver as a module if your root file
system is located on a SCSI device. In this case, do not compile the driver
for your SCSI host adapter as a module either.

That is to say, if you want to use an ATA hard disk as root device, config
ATA will be set as y and select CONFIG_SCSI, then CONFIG_BLK_DEV_SD should
be set as y and it can not be modified as m through the defconfig or make
menuconfig if CONFIG_SCSI is y, the simple way is to let CONFIG_SCSI select
CONFIG_BLK_DEV_SD if CONFIG_SCSI is y.

Could you please let me know are you OK with the following change?

-- >8 --
diff --git a/drivers/scsi/Kconfig b/drivers/scsi/Kconfig
index 634f2f501c6c..3e59e3e59e79 100644
--- a/drivers/scsi/Kconfig
+++ b/drivers/scsi/Kconfig
@@ -25,6 +25,7 @@ config SCSI
         select SG_POOL
         select SCSI_COMMON
         select BLK_DEV_BSG_COMMON if BLK_DEV_BSG
+       select BLK_DEV_SD if SCSI=y
         help
           If you want to use a SCSI hard disk, SCSI tape drive, SCSI 
CD-ROM or
           any other SCSI device under Linux, say Y and make sure that 
you know

If yes, I will post a formal patch later.

Thanks,
Tiezhu


             reply	other threads:[~2024-04-29  9:29 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2024-04-29  9:29 Tiezhu Yang [this message]
2024-04-29 12:33 ` Problem and solution about SCSI configs James Bottomley

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=ce58178c-7f26-a9a1-443a-71577162c814@loongson.cn \
    --to=yangtiezhu@loongson.cn \
    --cc=James.Bottomley@HansenPartnership.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-scsi@vger.kernel.org \
    --cc=martin.petersen@oracle.com \
    /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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.