From owner-freebsd-embedded@freebsd.org Sat Sep 28 19:30:41 2019 Return-Path: Delivered-To: freebsd-embedded@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 8E9B612E4E4 for ; Sat, 28 Sep 2019 19:30:41 +0000 (UTC) (envelope-from ian@freebsd.org) Received: from outbound2m.ore.mailhop.org (outbound2m.ore.mailhop.org [54.149.155.156]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) server-signature RSA-PSS (4096 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 46gf012gyvz4Vk7 for ; Sat, 28 Sep 2019 19:30:41 +0000 (UTC) (envelope-from ian@freebsd.org) ARC-Seal: i=1; a=rsa-sha256; t=1569699039; cv=none; d=outbound.mailhop.org; s=arc-outbound20181012; b=MEMrTct8MIOi0guatnWrZAqP/FE7wWMLwdB1sba6x3aewzUjjuqUp0XA1Hb1xVUC2AOVRfyQSQTFC biMj3QaDL4ktdld227up2xrba9frZIqvS9SZoaqjXi/N/Vd9mtUl1Jl2cD0M6Czh0HYNAcMQpj6DQT xdYBSJH/e4ViHkrMfIDhw0Vw2slgrEzV44nUL3jAE2VYdUA+hbqXlN8xY88V72hIspcba3AABwX0ra 5vgZY4WaNqLJfpuXiaqL/VIDUtZR/A4Ot+vtBUmZPWVQQXn5Xr/wQmhAYRXynzZ87okmzyXCaSkqIc HNYWbXJif5GX4M3jantu/TFWGey6Qwg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=outbound.mailhop.org; s=arc-outbound20181012; h=content-transfer-encoding:mime-version:content-type:references:in-reply-to: date:cc:to:from:subject:message-id:dkim-signature:from; bh=X1v/jdV+lEXtxF2EU87QFgR9hoMMbvSGxG+UVIzTKr8=; b=lEehjVLTkJRchAyZlcS7zvZodxvCmWXu8hIrFJTYomaXuOGb2NQFcWRMwNOZWJFF6JhcKt6QwhQaZ keHPsMuApF41UVq5dsA973OXEWpHzG52/Rb/k9Mhj05b2WBE0NGbXVh8TOHBMjDmCO0vBTb0oFGIBx Y3BVpA3J5XGE1dfHrcMgZgTfgZbB7nQ7+mkTS0nBlYGuagQY2M0UmlBmdM1SWiu5C1PhDqol7tkX5O ieAIalAUUsILUqFLECId8smjN4L6W5kU1cRyIddgfK/ctFKsPdZ2o4JgPk7vMPAQu8ebXpWNdRMjzt IBSCGvBn5ApQ3VH/0e9jw9huWrOvGFg== ARC-Authentication-Results: i=1; outbound4.ore.mailhop.org; spf=softfail smtp.mailfrom=freebsd.org smtp.remote-ip=67.177.211.60; dmarc=none header.from=freebsd.org; arc=none header.oldest-pass=0; DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=outbound.mailhop.org; s=dkim-high; h=content-transfer-encoding:mime-version:content-type:references:in-reply-to: date:cc:to:from:subject:message-id:from; bh=X1v/jdV+lEXtxF2EU87QFgR9hoMMbvSGxG+UVIzTKr8=; b=gyguKDtumBItEK44Y94sr4aANRYmY5nccLSdFwN66pig+Z2+8NQrPskRtbIo8Qvz/in3hZwhAmaQw kszaN5JmkS3+A5lckCk9cYyAc1qYbA7Lm7km7jGJHd9e150jVeeBTcWsuG1PbyFSuvzV3NCARCV6Jw 0HuZQGfLiWBNsaLINwGUu+vj1kUcV9ufB+0HS4czGGFy3rKlURtfrySv8Je978OtsN6cXQ0s2OOxpA 3bV9pjc1q6qQMlfgbSh/H5irTA+YmMbYlUwW2QkOopA7ibQkbKcLOHSrjKgb8R7HiftfxTQvo8reeQ dTYJGcl0hF1R2zPoKxPddTHOCjzrdJA== X-MHO-RoutePath: aGlwcGll X-MHO-User: 72634348-e226-11e9-85ed-13b9aae3a1d2 X-Report-Abuse-To: https://support.duocircle.com/support/solutions/articles/5000540958-duocircle-standard-smtp-abuse-information X-Originating-IP: 67.177.211.60 X-Mail-Handler: DuoCircle Outbound SMTP Received: from ilsoft.org (unknown [67.177.211.60]) by outbound4.ore.mailhop.org (Halon) with ESMTPSA id 72634348-e226-11e9-85ed-13b9aae3a1d2; Sat, 28 Sep 2019 19:30:38 +0000 (UTC) Received: from rev (rev [172.22.42.240]) by ilsoft.org (8.15.2/8.15.2) with ESMTP id x8SJUaWu045110; Sat, 28 Sep 2019 13:30:36 -0600 (MDT) (envelope-from ian@freebsd.org) Message-ID: <817c7ed712d6b7da3015b7312be485a9044b14e1.camel@freebsd.org> Subject: Re: watchdogd stat location From: Ian Lepore To: Warner Losh , mike tancsa Cc: freebsd-embedded Date: Sat, 28 Sep 2019 13:30:36 -0600 In-Reply-To: References: <5eba25eb-9ba4-0c93-27c8-e834491298ad@sentex.net> <83831ae6-9275-4f0c-a23d-c9cca3dc28f4@sentex.net> Content-Type: text/plain; charset="UTF-8" X-Mailer: Evolution 3.28.5 FreeBSD GNOME Team Mime-Version: 1.0 Content-Transfer-Encoding: 7bit X-Rspamd-Queue-Id: 46gf012gyvz4Vk7 X-Spamd-Bar: - Authentication-Results: mx1.freebsd.org; none X-Spamd-Result: default: False [-1.97 / 15.00]; local_wl_from(0.00)[freebsd.org]; NEURAL_HAM_MEDIUM(-0.97)[-0.970,0]; ASN(0.00)[asn:16509, ipnet:54.148.0.0/15, country:US]; NEURAL_HAM_LONG(-1.00)[-1.000,0] X-BeenThere: freebsd-embedded@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Dedicated and Embedded Systems List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 28 Sep 2019 19:30:41 -0000 On Fri, 2019-09-27 at 15:31 -0600, Warner Losh wrote: > On Fri, Sep 27, 2019 at 2:30 PM mike tancsa wrote: > > > On 9/27/2019 3:53 PM, Warner Losh wrote: > > > > > > > > > > I am all for that too. Just something other than /etc or /var > > > which are > > > often mounted on ramdisk. > > > > > > > > > I think that / is too special to cause disk IO to ever happen. > > > Other > > > dirs will sometimes not be in the cache.... The notion here, > > > perhaps > > > bogus, is that we want to check the root FS is sane. The stat(2) > > > is a > > > cheap way to do this that will eventually fail if / goes wonky > > > enough. > > > It's weak. > > > > > > > > > > Would something like this buy any extra sanity ? or not worth it. I > > guess fancier checks belong in a passed program > > > > > > # diff -u watchdogd.c.orig watchdogd.c > > --- watchdogd.c.orig 2019-09-27 16:27:14.456973000 -0400 > > +++ watchdogd.c 2019-09-27 16:27:18.904885000 -0400 > > @@ -364,9 +364,23 @@ > > > > if (test_cmd != NULL) > > failed = system(test_cmd); > > - else > > - failed = stat("/etc", &sb); > > - > > + else { > > + > > + srand(time(NULL)); > > + switch(rand() % 4) { > > + case 0: > > + failed = stat("/", &sb); > > + break; > > + case 1: > > + failed = stat("/bin", &sb); > > + break; > > + case 2: > > + failed = stat("/sbin", > > &sb); > > + break; > > + default: > > + failed = stat("/usr", &sb); > > + } > > + } > > error = watchdog_getuptime(&ts_end); > > if (error) { > > end_program = 1; > > > > I don't think the rand helps at all. I think you'd really rather do > things > sequentially. And this introduces more assumptions about the > underlying > filesystem(s). > > Warner > If we want to be sure to force physical IO, how about dd if=/ of=/dev/null count=1 ? But I question the premise of forcing physical IO as being somehow a better indicator of a non-hung system. I think it's just a better indicator of the sdcard problem that Mike is experiencing. For anyone else, forcing periodic physical IO is going to do annoying things like spin up idle drives. -- Ian