Received: by 2002:a25:1506:0:0:0:0:0 with SMTP id 6csp2113887ybv; Fri, 14 Feb 2020 11:43:22 -0800 (PST) X-Google-Smtp-Source: APXvYqzYJ8AdFx9mhZzNDczxoL8jKYdDcolhqRYdppr+jXIetIW/8/4OlZDj3DHutGr02ta5IiYe X-Received: by 2002:aca:5258:: with SMTP id g85mr3036894oib.80.1581709402265; Fri, 14 Feb 2020 11:43:22 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1581709402; cv=none; d=google.com; s=arc-20160816; b=xDsY/guY1eC7TqmbewU8SZZmAEEMtdtLAfFABW4fmGwF8k34RN71TyyV+1mcl2xV89 DI9TEN4zeaw33t+ZI9BsLf/x16WCOYdvmOV/Gnj5UNG0wf8MBMHXqRzWUZPzj4U4oeHk Zpjvhs/6//FpDWzQCuD0OaZAapuz3NTXHBU8DBzM/P/jytHUOrkwT9lFNtPqVOeeaWja lTBPFxk6yCps81wqcJxJUOCzCO4TFyqRtFefjPaW3Uz2nGjYbx6Fju3/5TF/1/8yzDzi Dt0BAP5FEECX/wCkFp5UhAXSz6MLYDXTJx1u+7dZlytNlnt0ByJe+7gzQSYVeNg9nWR2 bQAQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:cc:to:subject:message-id:date:from :in-reply-to:references:mime-version:dkim-signature; bh=F9lKhkJG1SEh5Pys1eJu5aR0S9IH7RxfHuDYsnTzNDA=; b=tg7ieKPEIcuBaMObsAzRkK0zo+d/KAVeMjp9TEVP8SmUj6rxMDujCT/81IvD8ttgtL BSh4W1p/QXM6eyVKhEWjsCUlFmu6YJ2F4f0CIOZNdxpe6G1ZmREHRcAluv8yeYM9F0uY LcjJwQdbyLlwrj+vZsKflIMrWLMtCNgsY8jICYHpR8H5R6JIy/pj1SSD2D91ElLvIeeI CsTza/ya8IAA1M932OLRD1eBpW6BID1Qf6oq7yykbzk4TF+qiaRpvDoRn/tng0jWQZOD nnyv04TrGWBxuoGujsdzr238cer4mO99drorVmUI2NVXSGw6DrXtvmdTN189ONLtU3gR vFbA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@google.com header.s=20161025 header.b=sCTWvjx2; 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=REJECT sp=REJECT dis=NONE) header.from=google.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id f190si3282220oig.229.2020.02.14.11.43.10; Fri, 14 Feb 2020 11:43:22 -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=@google.com header.s=20161025 header.b=sCTWvjx2; 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=REJECT sp=REJECT dis=NONE) header.from=google.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S2388273AbgBNTmo (ORCPT + 99 others); Fri, 14 Feb 2020 14:42:44 -0500 Received: from mail-io1-f47.google.com ([209.85.166.47]:43189 "EHLO mail-io1-f47.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S2387571AbgBNTmo (ORCPT ); Fri, 14 Feb 2020 14:42:44 -0500 Received: by mail-io1-f47.google.com with SMTP id n21so11769723ioo.10 for ; Fri, 14 Feb 2020 11:42:44 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20161025; h=mime-version:references:in-reply-to:from:date:message-id:subject:to :cc; bh=F9lKhkJG1SEh5Pys1eJu5aR0S9IH7RxfHuDYsnTzNDA=; b=sCTWvjx2wV809VMBb9QOcB5aTNrexqJYXfMwhaj8TNiZaYHGj3Cku8IlFZlzZLzMx+ KC/uNSbltbfBGBDMRsOyCwJ8MOpO4sgY8WvLRN7/LupfUwsxtlh05QAdR5NHjYMk0/vs FZB4pl+coQmXuz1rvUe+oxNMHgPlVoYzF0dikvn9LvkXj8h7LCUovEY1J0ffH+oMScfl 5xm03TRLOumre+BfWxQxQu13kXse3Y5lE4AkaT4SMi3FYq9wEGnp52/IjX0Q2r8oztE4 yzH8J1NOISdtLh+gegj6HQqwBpzoLx3drwY9mV4emNa1ABjS72La8yzj+Hty1rrJIv2Z yLmA== 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=F9lKhkJG1SEh5Pys1eJu5aR0S9IH7RxfHuDYsnTzNDA=; b=SD8/cbkp9NOLmSJUwacXIewdBeTk+5CZdony2CqVcpOLfivxdEOdrKP1HZ//7Cjudo ohcS95LH0dMw3gD/MV6y8rhU3vRwCSiUiLxudsk2RWNeFdqR+ArwgO2129lwyPA2jABE WcqgR/mUMdrZA1ZlLz4VztVfGZiGb+mNFH+B1Bx7zxVq1SRgDAvMKr2jB6tMscwC9nSv 5vMtUguOcvOF5CjM82LW29R2rqMBrsnZvxjYK0LDXENCU0Bke2lxb7c6y7P2Ypk1ENBx HgbdHIKzKDDmeMuma75MXYOKo7FwIvky5MR35P6bDIHEbyWFJVHMYBtL4aQXm1kH+kwF SQ6Q== X-Gm-Message-State: APjAAAV+xgw1IGW/YHMePv7JzqxP6Ymg+/2GihAKgiNVrb6WFrEuqtK8 NmVgBKsQ35hU/IWP1T9fr8QNZgYcRR8MHZAc/yiC2w== X-Received: by 2002:a6b:108:: with SMTP id 8mr3690162iob.70.1581709363693; Fri, 14 Feb 2020 11:42:43 -0800 (PST) MIME-Version: 1.0 References: <20200213082643.GB9144@ming.t460p> In-Reply-To: From: Salman Qazi Date: Fri, 14 Feb 2020 11:42:32 -0800 Message-ID: Subject: Re: BLKSECDISCARD ioctl and hung tasks To: Ming Lei Cc: Bart Van Assche , Ming Lei , Jens Axboe , Christoph Hellwig , Linux Kernel Mailing List , linux-block , Gwendal Grignou , Jesse Barnes Content-Type: text/plain; charset="UTF-8" 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 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. 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. > > Thanks, > Ming Lei