Received: by 2002:a25:1506:0:0:0:0:0 with SMTP id 6csp2471727ybv; Fri, 14 Feb 2020 19:48:27 -0800 (PST) X-Google-Smtp-Source: APXvYqzSN007yBvYdtMgSofsndYv4zPUxASuoWpeOv2RBk18BwSFAFeib+pBx8JGa8e8BsV0k5e8 X-Received: by 2002:a9d:4d17:: with SMTP id n23mr4801187otf.85.1581738507015; Fri, 14 Feb 2020 19:48:27 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1581738507; cv=none; d=google.com; s=arc-20160816; b=eiC1YwSk2jTsBNeV4w/u7XV9spVcWdif2j34RL3TIf9iX1yyxQT6b0Iuc95koDnvQm cKDGfVZxa4LAfUuFe4ZexefC/f50Mvz1skY6ttmpyDcNoynCGx1rZbIPbmNh7U6flDP7 FYem3AGz6LcO3HaiGJjRbb1DdvUUt0qjTMV02HdPvvKbNbAH5weX4QGzdLbnSN+uPZC1 VNPlVvU3yXwBapEoSRO9PWEN5qdRu19AQQEle2IqjV6Q+8ME0vq4B9+sCsRhY55VDIQI NxM4SXoOdhHjcu0OQ+LXUdTo5q58DirB94m7siKeIPKtawtqgClm/JQyo15oXScpzApx VURg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:user-agent:in-reply-to :content-disposition:mime-version:references:message-id:subject:cc :to:from:date:dkim-signature; bh=hkwg5DEXlLJyMnQCtdrdMz1gYg6CkSO++6/Wb9Fh0qI=; b=NYkTAMtsKkaED6xf0UfX8WnQ9+EhkrvBwNJyr09P7pW+WPYPJAMpHBRXfbp+h0ntnn KKk09lgkSDPUZY9K7/TDsBV6kb3ENwlijGWpc1We9CEWQZraDi2ObNyLYCGaGEoL4Adp kASonzQOACCnc3W1cSsvNO+E6RQzinErFePSe1Y6G+tKQrCAkgrxw7cQ1djol7Y8kUwk PaSSvzBwQpYpFk6eWpukFU5JCQ5MymSTgjZODFyZsxZO3CQwXko4zWpJThjjxgCzJg/5 co5RSR2IEBqQJ14Tkw8V5sDUIqhFONhINe3MNoycN4QCCtYbVftOZNa9huBsJO5Uj5RB XU0Q== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@redhat.com header.s=mimecast20190719 header.b=Q6naduLO; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=redhat.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id e64si3729829oib.4.2020.02.14.19.47.49; Fri, 14 Feb 2020 19:48:26 -0800 (PST) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; dkim=pass header.i=@redhat.com header.s=mimecast20190719 header.b=Q6naduLO; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=redhat.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1727777AbgBODrL (ORCPT + 99 others); Fri, 14 Feb 2020 22:47:11 -0500 Received: from us-smtp-2.mimecast.com ([207.211.31.81]:22516 "EHLO us-smtp-delivery-1.mimecast.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1727705AbgBODrL (ORCPT ); Fri, 14 Feb 2020 22:47:11 -0500 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1581738430; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: in-reply-to:in-reply-to:references:references; bh=hkwg5DEXlLJyMnQCtdrdMz1gYg6CkSO++6/Wb9Fh0qI=; b=Q6naduLOHcGNrcY1IfhlXeqO/iZ4yAL2rDSWSxQqO0+PW9JkcBB9AMSg8WQG6SZ7nwELWf mqqi+/xwdWSH3B7mXFz7dJGiCgPIX49JPMQ7L+kc3u6NMIeK0eZ/bSBBBL6I5bwrksX/EY mLGLQ8MG3vp0GfbQyOZ1cXOnJ/oV3TM= Received: from mimecast-mx01.redhat.com (mimecast-mx01.redhat.com [209.132.183.4]) (Using TLS) by relay.mimecast.com with ESMTP id us-mta-277-ddDc33jVMHSXuRB4w2yvnA-1; Fri, 14 Feb 2020 22:47:06 -0500 X-MC-Unique: ddDc33jVMHSXuRB4w2yvnA-1 Received: from smtp.corp.redhat.com (int-mx06.intmail.prod.int.phx2.redhat.com [10.5.11.16]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx01.redhat.com (Postfix) with ESMTPS id ECBAF800D53; Sat, 15 Feb 2020 03:47:04 +0000 (UTC) Received: from ming.t460p (ovpn-8-16.pek2.redhat.com [10.72.8.16]) by smtp.corp.redhat.com (Postfix) with ESMTPS id CA2895C1C3; Sat, 15 Feb 2020 03:46:57 +0000 (UTC) Date: Sat, 15 Feb 2020 11:46:52 +0800 From: Ming Lei To: Salman Qazi Cc: Ming Lei , Bart Van Assche , Jens Axboe , Christoph Hellwig , Linux Kernel Mailing List , linux-block , Gwendal Grignou , Jesse Barnes Subject: Re: BLKSECDISCARD ioctl and hung tasks Message-ID: <20200215034652.GA19867@ming.t460p> References: <20200213082643.GB9144@ming.t460p> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: User-Agent: Mutt/1.12.1 (2019-06-15) X-Scanned-By: MIMEDefang 2.79 on 10.5.11.16 Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Fri, Feb 14, 2020 at 11:42:32AM -0800, Salman Qazi wrote: > On Fri, Feb 14, 2020 at 1:23 AM Ming Lei wrote: > > > > On Fri, Feb 14, 2020 at 1:50 PM Bart Van Assche wrote: > > > > > > On 2020-02-13 11:21, Salman Qazi wrote: > > > > AFAICT, This is not actually sufficient, because the issuer of the bio > > > > is waiting for the entire bio, regardless of how it is split later. > > > > But, also there isn't a good mapping between the size of the secure > > > > discard and how long it will take. If given the geometry of a flash > > > > device, it is not hard to construct a scenario where a relatively > > > > small secure discard (few thousand sectors) will take a very long time > > > > (multiple seconds). > > > > > > > > Having said that, I don't like neutering the hung task timer either. > > > > > > Hi Salman, > > > > > > How about modifying the block layer such that completions of bio > > > fragments are considered as task activity? I think that bio splitting is > > > rare enough for such a change not to affect performance of the hot path. > > > > Are you sure that the task hung warning won't be triggered in case of > > non-splitting? > > I demonstrated a few emails ago that it doesn't take a very large > secure discard command to trigger this. So, I am sceptical that we > will be able to use splitting to solve this. > > > > > > > > > How about setting max_discard_segments such that a discard always > > > completes in less than half the hung task timeout? This may make > > > discards a bit slower for one particular block driver but I think that's > > > better than hung task complaints. > > > > I am afraid you can't find a golden setting max_discard_segments working > > for every drivers. Even it is found, the performance may have been affected. > > > > So just wondering why not take the simple approach used in blk_execute_rq()? > > My colleague Gwendal pointed out another issue which I had missed: > secure discard is an exclusive command: it monopolizes the device. > Even if we fix this via your approach, it will show up somewhere else, > because other operations to the drive will not make progress for that > length of time. What are the 'other operations'? Are they block IOs? If yes, that is why I suggest to fix submit_bio_wait(), which should cover most of sync bio submission. Anyway, the fix is simple & generic enough, I'd plan to post a formal patch if no one figures out better doable approaches. > > For Chromium OS purposes, if we had a blank slate, this is how I would solve it: > > * Under the assumption that the truly sensitive data is not very big: > * Keep secure data on a separate partition to make sure that those > LBAs have controlled history > * Treat the files in that partition as immutable (i.e. no > overwriting the contents of the file without first secure erasing the > existing contents). > * By never letting more than one version of the file accumulate, > we can guarantee that the secure erase will always be fast for > moderate sized files. > > But for all the existing machines with keys on them, we will need to > do something else. The issue you reported is a generic one, not Chromium only. Thanks, Ming