From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-7.9 required=3.0 tests=BAYES_00, HEADER_FROM_DIFFERENT_DOMAINS,MAILING_LIST_MULTI,NICE_REPLY_A,SPF_HELO_NONE, SPF_PASS,USER_AGENT_SANE_1 autolearn=no autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 13809C433E3 for ; Tue, 25 Aug 2020 22:22:12 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id E07F620767 for ; Tue, 25 Aug 2020 22:22:11 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726645AbgHYWWL (ORCPT ); Tue, 25 Aug 2020 18:22:11 -0400 Received: from mail-pg1-f195.google.com ([209.85.215.195]:36071 "EHLO mail-pg1-f195.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726779AbgHYWWI (ORCPT ); Tue, 25 Aug 2020 18:22:08 -0400 Received: by mail-pg1-f195.google.com with SMTP id p37so8930pgl.3; Tue, 25 Aug 2020 15:22:07 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:subject:to:cc:references:from:autocrypt :message-id:date:user-agent:mime-version:in-reply-to :content-language:content-transfer-encoding; bh=VFYKY6spuVaJ6jGfkYS1+XEwHNCIt2AYyCr2W3bH/H0=; b=GzjBkLwB8bwK+E/jEsApRStoX2hmI1nhK60nHGhIqpUOdDQJPePw6OGBpQYFYSnOFM eHc2re96M3JRBirqklfQZV3ORpnLKg7vaaekPpbxSi7YazFc2SZJx2A0ZbIYUojb6X1k 5Hl/kmzNYxQvqMMa2KGuPCf7KsH8cZec6GSxdcFX6N0XvluROaPNcZEnzSNG8vAosck0 9QgENAiUBXTMfy8vd8VWJJ6Y3LtSPwZBNR7UBGdrSdrlaVeL2NEi0unqKT6vObmcaKj+ tZrhdGI30AvVm3PSYOonW4L/ED3Rl/VAERBmeFHm4fmvfcrCmqay3TvssoKDenuq3Yl8 2ysg== X-Gm-Message-State: AOAM532A7nEhA9DKRy/2c/w/Q5Vl/TmB+EPKakOtZH9StMbLFM+fBXAv D22l9brrLnOcqYnOzjGWIUDEIKYDakQ= X-Google-Smtp-Source: ABdhPJwySdGLvYUx7m5cxQh/SnIlMtgb3vrtw//q1PUJ9GnfMpN0QUvo/pATjwBr07VhuMR7k0/HJQ== X-Received: by 2002:a62:cf85:: with SMTP id b127mr9670310pfg.89.1598394126825; Tue, 25 Aug 2020 15:22:06 -0700 (PDT) Received: from [192.168.3.217] (c-73-241-217-19.hsd1.ca.comcast.net. [73.241.217.19]) by smtp.gmail.com with ESMTPSA id p11sm120433pgh.80.2020.08.25.15.22.04 (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Tue, 25 Aug 2020 15:22:05 -0700 (PDT) Subject: Re: [PATCH] block: Fix a race in the runtime power management code To: Alan Stern , Stanley Chu Cc: Jens Axboe , linux-block@vger.kernel.org, Christoph Hellwig , Ming Lei , stable , Can Guo References: <20200824030607.19357-1-bvanassche@acm.org> <1598346681.10649.8.camel@mtkswgap22> <20200825182423.GB375466@rowland.harvard.edu> From: Bart Van Assche Autocrypt: addr=bvanassche@acm.org; prefer-encrypt=mutual; keydata= mQENBFSOu4oBCADcRWxVUvkkvRmmwTwIjIJvZOu6wNm+dz5AF4z0FHW2KNZL3oheO3P8UZWr LQOrCfRcK8e/sIs2Y2D3Lg/SL7qqbMehGEYcJptu6mKkywBfoYbtBkVoJ/jQsi2H0vBiiCOy fmxMHIPcYxaJdXxrOG2UO4B60Y/BzE6OrPDT44w4cZA9DH5xialliWU447Bts8TJNa3lZKS1 AvW1ZklbvJfA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F0xB3SQ8WVSXA9rrc4EBvZruWQ+5/zjVrhhfUAx12CzL4oQ9Ro2k45daYaonKTANYG22y //x8dLe2Fv1By4SKGhmzwH87uXxbTJAUxiWIi1np0z3/RDnoVyfmfbbL1DY7zf2hYXLLzsJR mSsED/1nlJ9Oq5fALdNEPgDyPUerqHxcmIub+pF0AzJoYHK5punqpqfGmqPbjxrJLPJfHVKy goMj5DlBMoYqEgpbwdUYkH6QdizJJCur4icy8GUNbisFYABeoJ91pnD4IGei3MTdvINSZI5e Message-ID: <1f798c21-241f-59f8-5298-a32fffe2ff01@acm.org> Date: Tue, 25 Aug 2020 15:22:03 -0700 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:68.0) Gecko/20100101 Thunderbird/68.11.0 MIME-Version: 1.0 In-Reply-To: <20200825182423.GB375466@rowland.harvard.edu> Content-Type: text/plain; charset=utf-8 Content-Language: en-US Content-Transfer-Encoding: 7bit Sender: linux-block-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-block@vger.kernel.org On 2020-08-25 11:24, Alan Stern wrote: > A related question concerns the BLK_MQ_REQ_PREEMPT flag. If it is set > then the request is allowed while rpm_status is RPM_SUSPENDING. But in > fact, the only requests which should be allowed at that time are those > created by the lower-layer driver as part of its runtime-suspend > handling; all other requests should be deferred. The BLK_MQ_REQ_PREEMPT > flag doesn't seem like the right way to achieve this. Should we be > using a different flag? I think there is already a flag that is used to mark power management commands, namely RQF_PM. My understanding is that the BLK_MQ_REQ_PREEMPT/RQF_PREEMPT flags are used for the following purposes: * In the SCSI core, scsi_execute() sets the BLK_MQ_PREEMPT flag. As a result, SCSI commands submitted with scsi_execute() are processed in the SDEV_QUIESCE SCSI device state. Since scsi_execute() is only used to submit other than medium access commands, in the SDEV_QUIESCE state medium access commands are paused and commands that do not access the storage medium (e.g. START/STOP commands) are processed. * In the IDE-driver, for making one request preempt another request. From an old IDE commit (not sure if this is still relevant): + * If action is ide_preempt, then the rq is queued at the head of + * the request queue, displacing the currently-being-processed + * request and this function returns immediately without waiting + * for the new rq to be completed. This is VERY DANGEROUS, and is + * intended for careful use by the ATAPI tape/cdrom driver code. Bart.