Received: by 2002:a05:6a10:206:0:0:0:0 with SMTP id 6csp3626589pxj; Tue, 1 Jun 2021 09:26:10 -0700 (PDT) X-Google-Smtp-Source: ABdhPJxDe7qE5FhPlkI4nIQSCdOqT+Loa6R+y36V577Fr7HUofmLLWSQ1PBUIJxDGIunjtgZtXYl X-Received: by 2002:a05:6402:10cc:: with SMTP id p12mr33826146edu.328.1622564769806; Tue, 01 Jun 2021 09:26:09 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1622564769; cv=none; d=google.com; s=arc-20160816; b=liIUFdMJ1oJ2FMc4edOYYyMz7DKgZxw/uGj4esPUvwG5SO7IM2wWCo6W+LWYQ5ghHK AvWyAZkTcMvxWX6SPGU5PiQcAVP9xa98FZ9RK1gNvHrW8kubxPqTKVMCj05a7mAgRTXN jAFMN1K50gQDqGCH7aMSWRNbESuE9Rt/rbxL3hph5mWSPirVxUjIoyqZ/Jv7Tx7x/KUk lD1DzCAYzgxG2XnStD4/FKF+HmhxFG6e26uEGYFB1haBy/w5iBUfqIw3zFKdeJ2oXeta fDUBtbf8CeDvIMK+8NreSUDuuTKFxpICe1IBk+NWgGCKWRvInV7Q1Zo7a4KCEnJyluSo +Kyw== 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=a+Tv9Ay4ki6fzCru5B5uDZBCMDiZwHl1GhoT7S+ieyE=; b=MkHHkBLzilW+EdzecEVmFP/F+cfJ7/t+Vw9TEzXHmEiL6x0AQFuKIxqx1Qsd4hnwWZ 7P2C3Ng3Xod3ECTY3LD6AuK8Czb9SB2xHTxpO8CmnoT1+KcgBg1EMquLW+ey/+uI+RIc +6x4R9aIkdOjFBUJ1A2GILuSX+ItKbAWQZV+6wiljgLip2iQgRqaGLd+9J8cu3xqz10G siO1ZOqqmBF01x4jNEktVNxydeTZsy4gB/v/XgTdgB8gnhWD+bvEuPdIN3vKkmEpXz+u lTsMRfvE8wd6mlsXLRGuDH6gL302T2IkAoGZ2ieQZpSdY2+dls85VXg41Pn0Eq/NR3vA z7kg== 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 gb26si18127196ejc.3.2021.06.01.09.25.45; Tue, 01 Jun 2021 09:26:09 -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 S234050AbhFAQYc (ORCPT + 99 others); Tue, 1 Jun 2021 12:24:32 -0400 Received: from mail-pf1-f176.google.com ([209.85.210.176]:44957 "EHLO mail-pf1-f176.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S233088AbhFAQYb (ORCPT ); Tue, 1 Jun 2021 12:24:31 -0400 Received: by mail-pf1-f176.google.com with SMTP id u18so1601776pfk.11; Tue, 01 Jun 2021 09:22:50 -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=a+Tv9Ay4ki6fzCru5B5uDZBCMDiZwHl1GhoT7S+ieyE=; b=EhUWLwDXRiHrE71kYsUYkZZaLjy2HiyDKQ/qmLWHG1cPNaJ8Aopd034T3eHTaByToY fqy+OsZLyosKieJ6E1VadWCD+y5w94Nk2r5ZoYevZ6j/wGUomqOp7dkaMZkuKQTOyvPQ ynuRAp0TXoXuDC16+wRpJ9pUlPVyXXSzR1AKRWvv969dEY4dfZ2LBP9k6ghyT02jamrY Mw3Awa9ucvXQdKOmqZbz5gMBwheoCUc5+hdzYoKe50Q3Z7lr7Q4NNqd6doZp+4gtzjRq daBKCCH2h3qLk6YvE5dUrD4BLoHhv7Hbd6MP7awpSbPJ6pKC8BJ0MFFQ7kcYyBaSUbZs BVuQ== X-Gm-Message-State: AOAM532bkfJ1a6hLOOjkZI1LWn2WXPWo3mUhSQDJp/rvZYp10F8uP2Bz kbgX0NA4sS5MAGyhm1aHULA= X-Received: by 2002:a63:1224:: with SMTP id h36mr28862318pgl.296.1622564570126; Tue, 01 Jun 2021 09:22:50 -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 i14sm8589037pgc.57.2021.06.01.09.22.47 (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Tue, 01 Jun 2021 09:22:49 -0700 (PDT) Subject: Re: [PATCH v5 07/10] scsi: ufshpb: Add "Cold" regions timer To: Can Guo , Avri Altman Cc: "James E . J . Bottomley" , "Martin K . Petersen" , "linux-scsi@vger.kernel.org" , "linux-kernel@vger.kernel.org" , "gregkh@linuxfoundation.org" , yongmyung lee , Daejun Park , "alim.akhtar@samsung.com" , "asutoshd@codeaurora.org" , Zang Leigang , Avi Shchislowski , Bean Huo , "stanley.chu@mediatek.com" References: <20210302132503.224670-1-avri.altman@wdc.com> <20210302132503.224670-8-avri.altman@wdc.com> <5dc7f93e6a1b1328fe8b5bb28a9ea34f@codeaurora.org> From: Bart Van Assche Message-ID: <7953c9c3-d30c-496f-9fb3-15aa1a7e3e4a@acm.org> Date: Tue, 1 Jun 2021 09:22:46 -0700 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:78.0) Gecko/20100101 Thunderbird/78.10.2 MIME-Version: 1.0 In-Reply-To: Content-Type: text/plain; charset=utf-8 Content-Language: en-US Content-Transfer-Encoding: 7bit Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On 3/17/21 12:55 AM, Avri Altman wrote: >> On 2021-03-16 17:21, Avri Altman wrote: [ ... ] >>>> And, which lock is protecting rgn->list_expired_rgn? If two >>>> read_to_handler works >>>> are running in parallel, one can be inserting it to its expired_list >>>> while another >>>> can be deleting it. >>> The timeout handler, being a delayed work, is meant to run every >>> polling period. >>> Originally, I had it protected from 2 handlers running concurrently, >>> But I removed it following Daejun's comment, which I accepted, >>> Since it is always scheduled using the same polling period. >> >> But one can set the delay to 0 through sysfs, right? > > Will restore the protection. Thanks. (replying to an email from 2.5 months ago) Hi Can, How can two read_to_handler works run in parallel? How can it make a difference whether or not the delay can be set to zero? Are you aware that since kernel v3.7 (released in 2012) all workqueues are non-reentrant? See also commit dbf2576e37da ("workqueue: make all workqueues non-reentrant"). From the description of that commit: This patch makes all workqueues non-reentrant. If a work item is executing on a different CPU when queueing is requested, it is always queued to that CPU. This guarantees that any given work item can be executing on one CPU at maximum and if a work item is queued and executing, both are on the same CPU. Thanks, Bart.