From owner-freebsd-current@freebsd.org Thu Nov 26 08:14:16 2020 Return-Path: Delivered-To: freebsd-current@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 563E34A5501 for ; Thu, 26 Nov 2020 08:14:16 +0000 (UTC) (envelope-from wlosh@bsdimp.com) Received: from mail-qk1-x734.google.com (mail-qk1-x734.google.com [IPv6:2607:f8b0:4864:20::734]) (using TLSv1.3 with cipher TLS_AES_128_GCM_SHA256 (128/128 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (2048 bits) client-digest SHA256) (Client CN "smtp.gmail.com", Issuer "GTS CA 1O1" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4ChVsM4YwBz3PFw for ; Thu, 26 Nov 2020 08:14:15 +0000 (UTC) (envelope-from wlosh@bsdimp.com) Received: by mail-qk1-x734.google.com with SMTP id n132so921621qke.1 for ; Thu, 26 Nov 2020 00:14:15 -0800 (PST) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:references:in-reply-to:from:date :message-id:subject:to:cc; bh=ZAIhaEJJ3VTZdnE1c7ccxLWtZxEbnsJlxYyM5G4jlUY=; b=puTLzyt4g2Nu4YyKntE9P4mi7eazpovM8Yp+PJpkRu9jWZgpYaLA+We6153vLZgNXO pE5gWWU++ush0aOqqtJ8xJ+OaHG+tq7KWGRrudct+V4ZStc8w/VDyDuLzP6ctvTbt39R 9WOZdI6diOr5CQFArx2HPKh3ghMjkGaDCTZsa68X/TsIbKftRvXfG6POhnP2T28KQZoS 6uo/HXkbGy+UinsyERj7P3AHMK894STxk2yppQv44en6Ya6pv+JIvCUTasp2Rz5qKmKb NBna8BM2eUykqmYQ7D8c403PNSffbo5KdKJ9SW5KkR05l1nwntn4vRlYnBFajkRHGBHX S5Zw== X-Gm-Message-State: AOAM5309pOC8yDqkoQloqH+Mp0GkUlDBjp8SChbpMv0xsvCb5kYWXT5q knxR7unecHXinfNqtO/9Uu9e5RKQW/PK3MH35XPbbg== X-Google-Smtp-Source: ABdhPJz2rsL3/5/Oj/BbUWaBZEotznkCF6TlLFhH3C1LysQcuO8lvX52tMvYNd4UScWiCCQX1S390MfdKQLzTE932rg= X-Received: by 2002:a37:78c:: with SMTP id 134mr2006468qkh.359.1606378453475; Thu, 26 Nov 2020 00:14:13 -0800 (PST) MIME-Version: 1.0 References: <20201126080724.1cb3a8af@ernst.home> In-Reply-To: <20201126080724.1cb3a8af@ernst.home> From: Warner Losh Date: Thu, 26 Nov 2020 01:14:02 -0700 Message-ID: Subject: Re: possible usb3-connected hard drive spin down causing lag To: Gary Jennejohn Cc: tech-lists , FreeBSD Current X-Rspamd-Queue-Id: 4ChVsM4YwBz3PFw X-Spamd-Bar: --- X-Spamd-Result: default: False [-3.00 / 15.00]; RCVD_TLS_ALL(0.00)[]; ARC_NA(0.00)[]; R_DKIM_ALLOW(-0.20)[bsdimp-com.20150623.gappssmtp.com:s=20150623]; NEURAL_HAM_MEDIUM(-1.00)[-1.000]; FROM_HAS_DN(0.00)[]; RCPT_COUNT_THREE(0.00)[3]; NEURAL_HAM_LONG(-1.00)[-1.000]; MIME_GOOD(-0.10)[multipart/alternative,text/plain]; PREVIOUSLY_DELIVERED(0.00)[freebsd-current@freebsd.org]; DMARC_NA(0.00)[bsdimp.com]; SPAMHAUS_ZRD(0.00)[2607:f8b0:4864:20::734:from:127.0.2.255]; TO_MATCH_ENVRCPT_SOME(0.00)[]; TO_DN_ALL(0.00)[]; DKIM_TRACE(0.00)[bsdimp-com.20150623.gappssmtp.com:+]; NEURAL_HAM_SHORT(-1.00)[-1.000]; RCVD_IN_DNSWL_NONE(0.00)[2607:f8b0:4864:20::734:from]; R_SPF_NA(0.00)[no SPF record]; FREEMAIL_TO(0.00)[gmail.com]; FORGED_SENDER(0.30)[imp@bsdimp.com,wlosh@bsdimp.com]; MIME_TRACE(0.00)[0:+,1:+,2:~]; RBL_DBL_DONT_QUERY_IPS(0.00)[2607:f8b0:4864:20::734:from]; RCVD_COUNT_TWO(0.00)[2]; ASN(0.00)[asn:15169, ipnet:2607:f8b0::/32, country:US]; FROM_NEQ_ENVFROM(0.00)[imp@bsdimp.com,wlosh@bsdimp.com]; MAILMAN_DEST(0.00)[freebsd-current] Content-Type: text/plain; charset="UTF-8" X-Content-Filtered-By: Mailman/MimeDel 2.1.34 X-BeenThere: freebsd-current@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Discussions about the use of FreeBSD-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 26 Nov 2020 08:14:16 -0000 On Thu, Nov 26, 2020 at 1:07 AM Gary Jennejohn wrote: > On Thu, 26 Nov 2020 00:10:40 +0000 > tech-lists wrote: > > > Hi, > > > > I have a usb3-connected harddrive. dmesg shows this: > > [...] > > da0: Fixed Direct Access SPC-4 SCSI device > > [...] > > > > running current-r367806-arm64 > > > > I think it might be auto-spinning-down or auto-sleeping. It's > > making initial interaction lag of 2-3 seconds. Is there a sysctl or > > something somewhere where I can tell it to never sleep? Or is that > > something I'd need to contact the manufacturer about? Or is there > > an alternative strategy like tmpfs. It's not a "green" drive but I > > guess it might be "green" in that it's usb3 powered. > > > > I have vfs.read_max=128 in /etc/sysctl.conf > > zdb has ashift=12 > > > > In case it's relevant, the filesystem on the disk is zfs. Once > > "woken up", inferaction is quick, as expected. > > thanks, > > > > I'd be interested in an answer to this question myself. I have > several USB-attached UFS2 disks which spin down after a few minutes. > > But, based on some quick searches, this behavior is either a "feature" > of the disk itself - seems common with so-called green disks - or of > the controller in the external enclosure or docking station. > > This behavior makes sense for drives used with laptops, but for > desktop computers not so useful. > > There are some sysctl's relevant to spindown, but they appear to only > come into play during suspend or shutdown. The ones relevant to USB > which I found are: > > kern.cam.ada.spindown_suspend: Spin down upon suspend > kern.cam.ada.spindown_shutdown: Spin down upon shutdown > > There may be commands which a user can send the disk/controller to > disable this behavior, but I didn't find any with my simple searches. > For SAS drives, there's a mode page that controls this behavior. You might see if the sysutil/ataidle port/package does what you want. Warner