Received: by 2002:a05:6a10:f3d0:0:0:0:0 with SMTP id a16csp383219pxv; Thu, 24 Jun 2021 09:58:29 -0700 (PDT) X-Google-Smtp-Source: ABdhPJy7oLryJH69BVjjx8pBBEi6w3oySUkq3ohbUWiR1mOlfHtXHN0lBkTEQk+CJRBtYAbQLDDn X-Received: by 2002:a92:d7c8:: with SMTP id g8mr4358151ilq.117.1624553909359; Thu, 24 Jun 2021 09:58:29 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1624553909; cv=none; d=google.com; s=arc-20160816; b=iJHcrq6VCLHMuOsIxWjerV4Fr1eb9YlbZ/tE7t4ELcZG1o3mXJpXN9cxTA2lb54/V/ ZZATabDDNqV7yXR7q5NWK1xAeL1trSXg3/6IxYib6kR5Dh260yegF6rGL+I86PxsXKcn jj055jD6u3d+A4SkipMMMgrLTFf3N69UuV0hw5L0OrFN7Tjcz4vRsojXWmVbnv/785xl TRYKvdmTru+yyJ+BDy8UUn9Jv8csEUJIyxcnCqEl4+MT4+CAKTVs/MhrHkEPKYVqpy3/ rXApzmyu/xF3V8Pmj+il88J6Pa31zhA5E5WtEglAYb4vVqxR7+gNTKy3MiMIRPfaqlac MkfQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:content-language :in-reply-to:mime-version:user-agent:date:message-id:from:references :cc:to:subject; bh=TfRjZvIBnPtJhX/lgcvHWYZI8ch0mIRl4NSCn+C67WM=; b=MOPZeA33v1mAzj/QEm6JY8J4PwAIZPj6WEIUPxJPtM/Y+vBJ+8iYEGYJqPPWtutMFH 6/ULuxPt54WNIo/9iCb5VrcCkYvcPHE6RpODb3jFTySyU7AuYNCI3J1Yqgwp8jTnjG3K Mcp7MulJbkazvrdrP6ohFAZJo9zzVdg32PtUj+rwGGh8bgkMrE8lMsMpFrjq51QkOxBZ ayYKuH/zjF40x/vTw8Ew7dBfutHec5z8svirdLuzU4q+eGveGt6Bzf9T7bNth4mIxj/S WVMBtKeDRK8XXbjp1uJUjmsOpIJlyN8WA8y2rRbAOGyFNNqH2DQ+A18WWVBX55VocEC0 KC2Q== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id e21si4078391jam.39.2021.06.24.09.58.16; Thu, 24 Jun 2021 09:58:29 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S230450AbhFXRAC (ORCPT + 99 others); Thu, 24 Jun 2021 13:00:02 -0400 Received: from mail-pl1-f172.google.com ([209.85.214.172]:41604 "EHLO mail-pl1-f172.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229721AbhFXRAC (ORCPT ); Thu, 24 Jun 2021 13:00:02 -0400 Received: by mail-pl1-f172.google.com with SMTP id y13so3266335plc.8; Thu, 24 Jun 2021 09:57:43 -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:message-id:date :user-agent:mime-version:in-reply-to:content-language :content-transfer-encoding; bh=TfRjZvIBnPtJhX/lgcvHWYZI8ch0mIRl4NSCn+C67WM=; b=Ys+Iyin2PUlvbC8bgxiZog9SBj3J3DPNJ1UnXwwtOIa005SPcB+Gz0JGfhs5svRPQu n+Faaq7PuV+VluOAv5IQBAg8u4Y8ZfslG6Pz6FYHqCGmCxuhA9W0v8ZijQaF8awKfc+n WpSaoCHeKKcXwG4t5RLsqFJUI4eNE7yPcs6ZDmPbUgcNfO4++fWhNtBKm0pwo8NXxvo6 NXNUQjdf/lmtWEzZseKuC0BitD5KE/tG5OzwRJTtN5DPbpLN7Et+MmSuFN9ssMHAElF8 LHReSqHO4/kWbPnTIOU3aQlZWBasS+kGtNGguwEKhxcf95uwQz/6BNGlGEPEUo8jR1iN WQhw== X-Gm-Message-State: AOAM533u8iqnDc9WACfj3OP+r7uR5+sMyRlEySoxyEfrQEzdKGFLn3Vo l96YwUDYInTTlaBD350YTPRUvB/24IU= X-Received: by 2002:a17:90a:6be6:: with SMTP id w93mr6321800pjj.171.1624553862063; Thu, 24 Jun 2021 09:57:42 -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 k20sm8937899pji.3.2021.06.24.09.57.40 (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Thu, 24 Jun 2021 09:57:41 -0700 (PDT) Subject: Re: [PATCH v4 09/10] scsi: ufs: Update the fast abort path in ufshcd_abort() for PM requests To: Can Guo Cc: asutoshd@codeaurora.org, nguyenb@codeaurora.org, hongwus@codeaurora.org, ziqichen@codeaurora.org, linux-scsi@vger.kernel.org, kernel-team@android.com, Alim Akhtar , Avri Altman , "James E.J. Bottomley" , "Martin K. Petersen" , Stanley Chu , Bean Huo , Jaegeuk Kim , open list References: <1624433711-9339-1-git-send-email-cang@codeaurora.org> <1624433711-9339-11-git-send-email-cang@codeaurora.org> <5ff72cfab707b571ef395d52931edd0f@codeaurora.org> From: Bart Van Assche Message-ID: Date: Thu, 24 Jun 2021 09:57:39 -0700 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:78.0) Gecko/20100101 Thunderbird/78.11.0 MIME-Version: 1.0 In-Reply-To: <5ff72cfab707b571ef395d52931edd0f@codeaurora.org> Content-Type: text/plain; charset=utf-8 Content-Language: en-US Content-Transfer-Encoding: 8bit Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On 6/23/21 9:16 PM, Can Guo wrote: > On 2021-06-24 05:33, Bart Van Assche wrote: >> On 6/23/21 12:35 AM, Can Guo wrote: >>> @@ -2737,7 +2737,7 @@ static int ufshcd_queuecommand(struct Scsi_Host >>> *host, struct scsi_cmnd *cmd) >>>           * err handler blocked for too long. So, just fail the scsi cmd >>>           * sent from PM ops, err handler can recover PM error anyways. >>>           */ >>> -        if (hba->wlu_pm_op_in_progress) { >>> +        if (cmd->request->rq_flags & RQF_PM) { >>>              hba->force_reset = true; >>>              set_host_byte(cmd, DID_BAD_TARGET); >>>              cmd->scsi_done(cmd); >> >> I'm still concerned that the above code may trigger data corruption. I >> prefer that the above code is removed instead of being modified. > > Removing the change will lead to deadlock when error handling prepare > calls pm_runtime_get_sync(). > > RQF_PM is only given to requests sent from power management operations, > during which the specific device/LU is suspending/resuming, meaning no > data transaction is ongoing. How can fast failing a PM request trigger > data corruption? Right, the above code only affects power management requests so there is no risk for data corruption. Thanks, Bart.