public inbox for linux-mmc@vger.kernel.org
 help / color / mirror / Atom feed
From: Arnd Bergmann <arnd@arndb.de>
To: Holger Schurig <holgerschurig@gmail.com>
Cc: linux-mmc@vger.kernel.org
Subject: Re: eMMC and "mkfs.ext3" hangs without "-E nodiscard"
Date: Tue, 30 Sep 2014 12:16:26 +0200	[thread overview]
Message-ID: <5346694.Izxj5YOVaz@wuerfel> (raw)
In-Reply-To: <CAOpc7mEqcVopJ_RB8GDKJXnHNNuwSr88Q=kguXGf_yfZ=8qetw@mail.gmail.com>

On Tuesday 30 September 2014 09:05:55 Holger Schurig wrote:
> Hmm, after one or two minutes I lost my patience. Also, hitting Ctrl-C
> didn't abort the application. Suspending it with Ctrl-Z doesn't work
> either. I did an strace, and the last few lines look like this:
> 
> stat64("/dev/mmcblk0p1", {st_mode=S_IFBLK|0660, st_rdev=makedev(179,
> 5), ...}) = 0
> open("/dev/mmcblk0p1", O_RDONLY|O_EXCL) = 3
> close(3)                                = 0
> open("/dev/mmcblk0p1", O_RDONLY|O_LARGEFILE) = 3
> uname({sys="Linux", node="mde", ...})   = 0
> ioctl(3, BLKGETSIZE64, 0xbea40610)      = 0
> close(3)                                = 0
> write(1, "fs_types for mke2fs.conf resolut"..., 37fs_types for
> mke2fs.conf resolution: ) = 37
> write(1, "'ext3'", 6'ext3')                   = 6
> write(1, "\n", 1
> )                       = 1
> open("/dev/mmcblk0p1", O_RDONLY|O_LARGEFILE) = 3
> ioctl(3, BLKSSZGET, 0xbea408b8)         = 0
> close(3)                                = 0
> open("/dev/mmcblk0p1", O_RDONLY|O_LARGEFILE) = 3
> ioctl(3, BLKPBSZGET, 0xbea408bc)        = 0
> close(3)                                = 0
> stat64("/dev/mmcblk0p1", {st_mode=S_IFBLK|0660, st_rdev=makedev(179,
> 5), ...}) = 0
> open("/dev/mmcblk0p1", O_RDONLY|O_LARGEFILE) = 3
> fadvise64_64(3, 0, 0, POSIX_FADV_RANDOM) = 0
> fstat64(3, {st_mode=S_IFBLK|0660, st_rdev=makedev(179, 5), ...}) = 0
> uname({sys="Linux", node="mde", ...})   = 0
> ioctl(3, BLKGETSIZE64, 0x53a4b8)        = 0
> ioctl(3, CDROM_GET_CAPABILITY, 0)       = -1 EINVAL (Invalid argument)
> ioctl(3, BLKALIGNOFF, 0xbea40764)       = 0
> ioctl(3, BLKIOMIN, 0xbea40764)          = 0
> ioctl(3, BLKIOOPT, 0xbea40764)          = 0
> ioctl(3, BLKPBSZGET, 0xbea40764)        = 0
> ioctl(3, BLKSSZGET, 0x53a4d0)           = 0
> close(3)                                = 0
> access("/sys/fs/ext4/features/lazy_itable_init", R_OK) = -1 ENOENT (No
> such file or directory)
> open("/dev/mmcblk0p1", O_RDWR|O_EXCL|O_LARGEFILE) = 3
> stat64("/dev/mmcblk0p1", {st_mode=S_IFBLK|0660, st_rdev=makedev(179,
> 5), ...}) = 0
> ioctl(3, BLKDISCARDZEROES, 0xbea40880)  = 0
> ioctl(3, BLKROGET, 0xbea40884)          = 0
> uname({sys="Linux", node="mde", ...})   = 0
> gettimeofday({1403353145, 564428}, NULL) = 0
> gettimeofday({1403353145, 564587}, NULL) = 0
> gettimeofday({1403353145, 564709}, NULL) = 0
> ioctl(3, BLKDISCARD
> 
> Too bad I cannot see the arguments/results from the ioctls ...

This is probably bug in 'strace', it's missing a handler for BLKDISCARD.
I believe, mkfs.ext3 just tries to erase the whole partition, which is
a good idea in principle.

> I also noticed that it takes an awful lot of kernel task time:
> 
> root@mde:~# top | head -n9
> top - 14:09:59 up 2 min,  2 users,  load average: 1.84, 0.79, 0.30
> Tasks:  86 total,   2 running,  84 sleeping,   0 stopped,   0 zombie
> %Cpu(s):  0.3 us, 22.2 sy,  0.0 ni, 54.6 id, 22.5 wa,  0.0 hi,  0.4 si,  0.0 st
> KiB Mem:   1034092 total,    86760 used,   947332 free,     2808 buffers
> KiB Swap:        0 total,        0 used,        0 free,    52128 cached
> 
>   PID USER      PR  NI  VIRT  RES  SHR S  %CPU %MEM    TIME+  COMMAND
>    71 root      20   0     0    0    0 R  99.5  0.0   2:23.54 mmcqd/1
>   323 root      20   0  2640 1640 1304 R   5.5  0.2   0:00.02 top
> 
> Maybe it's hanging in the kernel ?  The whan stays at get_request:
> 
> root@mde:~# ps -a -o pid,f,stat,pcpu,pmem,psr,comm,wchan=WIDE-WCHAN | grep mkfs
>   296 0 D+    0.0  0.1   2 mkfs.ext3       get_request

Right, mkfs is obviously wanting for the ioctl to complete, but that
seems to be stuck looking in mmcqd. It would be helpful to understand
where that kernel thread is stuck, but that is harder to do.

Is this sdhci-esdhc-imx.c? Are you using DMA mode?
 
> > Can you try erasing a smaller region of the device
> 
> Sure, this seems to work.
> 
> root@mde:~# blkdiscard /dev/mmcblk0 0 1
> erasing 0 to 1 on /dev/mmcblk0
> ioctl: Invalid argument
> root@mde:~# blkdiscard /dev/mmcblk0 0 512
> erasing 0 to 512 on /dev/mmcblk0
> root@mde:~# blkdiscard /dev/mmcblk0 0 4096
> erasing 0 to 4096 on /dev/mmcblk0
> root@mde:~# blkdiscard /dev/mmcblk0 0 8192
> erasing 0 to 8192 on /dev/mmcblk0
> root@mde:~# blkdiscard /dev/mmcblk0 0 16384
> erasing 0 to 16386 on /dev/mmcblk0
> ioctl: Invalid argument

16386 is not a multiple of 512, so that fails. Keep trying larger
power-of-two numbers, also using 'time' to see how long they take.
You should be able to erase up to 4GB at a time.

	Arnd

  reply	other threads:[~2014-09-30 10:16 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2014-09-29 13:46 eMMC and "mkfs.ext3" hangs without "-E nodiscard" Holger Schurig
2014-09-29 14:12 ` Arnd Bergmann
2014-09-30  7:05   ` Holger Schurig
2014-09-30 10:16     ` Arnd Bergmann [this message]
2014-10-09 18:44 ` Uwe Kleine-König
2014-10-09 20:40 ` Fabio Estevam

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=5346694.Izxj5YOVaz@wuerfel \
    --to=arnd@arndb.de \
    --cc=holgerschurig@gmail.com \
    --cc=linux-mmc@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