Received: by 2002:a05:6a10:413:0:0:0:0 with SMTP id 19csp1692262pxp; Thu, 17 Mar 2022 14:41:00 -0700 (PDT) X-Google-Smtp-Source: ABdhPJxOgZgK9Ih67tM0niCgz2FZlnQugPL1bvXV0qUgg4BCWRuYyqI3yQ79I0A/zVm6YPqIcAmB X-Received: by 2002:a05:6a00:16c7:b0:4f7:e497:69c7 with SMTP id l7-20020a056a0016c700b004f7e49769c7mr6696890pfc.7.1647553260328; Thu, 17 Mar 2022 14:41:00 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1647553260; cv=none; d=google.com; s=arc-20160816; b=G3VbBQEL2OmWhfYIuwxpvWbBdgsBaZ6+Wha59Ngq8IaY0PM5weaKj5GeWZ8cmzpImp 0iZ48Rg5c8ZAiZ0HMR1j+5nLh9l8ZCutsgmJn/XSLCN7Y6+hQ8aBx1+rG4MQXXbHmri+ Gm3NGu64hweL3n3gu8rSiVNYptbVkfsDJspoLxqLPa4SbKLGZcLIlBiavY2XoRwzVu6o p1GEtVjmIdCtDEwmkrHQnjmSkLF/otCEfz8y3PXt84ZROa77t3mRXnEwTxizLAC53jcD +3bwDhk/lvxuGC6H+xrwMS73Ovjnei1hqB0Y+thbqeM1biW2ER4v28jpoUEwM/ByHkiQ 3WBA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:cc:to:subject:message-id:date:from:in-reply-to :references:mime-version:dkim-signature; bh=a2ti8g/ld+9idqGBypq+3jGDET4QNV1EIOi7rZI8SYg=; b=mFZ1gx+YYY1ARgssleSvthfW7tBB4Yt2ysS2JrEADKAtODXqtC0wLsszZMStG2IGbY ahPCQ7sZtIU/hCN07KdNS1F8vN5iDABvh4+IRaASqiMct5QgL+X8qE+qEPJMGK1g+EMp RbO+PPilM+pDt+iPCLCaYCZ+U2gQTqw6Uk+JuyYNsvCA+uT8PRiw1J/yheJ5ryTw60Vl VtoLZq3DIUA0kiGjvgkRvpDhC5wKfXpPabR4tnK6gNyYbl20jGh/LbleyfduL6EDA/oc 6Jgk1pgTLGc+0GOwUVe3AYHLh3+k23FwCUI1nP0cycDQCYmn4MYIegND1G/krZk79HHT ctQg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@gmail.com header.s=20210112 header.b=pUelORlA; spf=softfail (google.com: domain of transitioning linux-kernel-owner@vger.kernel.org does not designate 23.128.96.19 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Return-Path: Received: from lindbergh.monkeyblade.net (lindbergh.monkeyblade.net. [23.128.96.19]) by mx.google.com with ESMTPS id d4-20020a170902b70400b00153b2d16549si234292pls.337.2022.03.17.14.41.00 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 17 Mar 2022 14:41:00 -0700 (PDT) Received-SPF: softfail (google.com: domain of transitioning linux-kernel-owner@vger.kernel.org does not designate 23.128.96.19 as permitted sender) client-ip=23.128.96.19; Authentication-Results: mx.google.com; dkim=pass header.i=@gmail.com header.s=20210112 header.b=pUelORlA; spf=softfail (google.com: domain of transitioning linux-kernel-owner@vger.kernel.org does not designate 23.128.96.19 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by lindbergh.monkeyblade.net (Postfix) with ESMTP id A0448186890; Thu, 17 Mar 2022 14:07:23 -0700 (PDT) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S230041AbiCQVIa (ORCPT + 99 others); Thu, 17 Mar 2022 17:08:30 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:48994 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229989AbiCQVIX (ORCPT ); Thu, 17 Mar 2022 17:08:23 -0400 Received: from mail-wm1-x334.google.com (mail-wm1-x334.google.com [IPv6:2a00:1450:4864:20::334]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id AC662184B67; Thu, 17 Mar 2022 14:07:05 -0700 (PDT) Received: by mail-wm1-x334.google.com with SMTP id r64so3809163wmr.4; Thu, 17 Mar 2022 14:07:05 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112; h=mime-version:references:in-reply-to:from:date:message-id:subject:to :cc; bh=a2ti8g/ld+9idqGBypq+3jGDET4QNV1EIOi7rZI8SYg=; b=pUelORlA+hm0f6QAqGhfMd+zAAK4W9I/TgVm7PB9Md7nIvrbt3PcHoNvZUCXiD/Of4 IzZGDAe8mOXsZrX/H4Ga4rd05sI1XXryJZUIDZYZTf+M2lQLEABbwXjwzlGwb888J744 WwFMOQt6RN/TSkhfA+C8zoeBPLM4s7U9WynBrp5kSeKfvZ1Xnt/ktBSn0BZM4sd9u/Tg YdBOTPRMNsbe5tBoAk3Pru5qV1EGo10C5my5vr/baLjU21gOA1FBLyIJDxnAL4bn+HD6 7ZQfrMOc8YGRPXnb7Wb8xm2H61WjsJ/uxsEtJZfUUzm7UgdqHS6r6a0Z+cXVZ89njTiU Itvg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:mime-version:references:in-reply-to:from:date :message-id:subject:to:cc; bh=a2ti8g/ld+9idqGBypq+3jGDET4QNV1EIOi7rZI8SYg=; b=L1uPHyMlpHRBoYdEibaBwgvo0ZGvHZyVX7ndP/EDbYsQb+ePkrgN34LElKcYNjJmzu KfPfapYDb7OqSxJ2MoypthZPwI6s0Dq/iQM4mdQEJ8/o5u8mMjilSvy0WS6FTNHOvvZE I5xtGZHYbvmwC5KHIoQ90lE1G9DxM7oNBbs8WnS4YPCNw57xN2oVnzOd93tOpUq1Xoiy RwAmyaHhbK6hdDYLsjdG2EHNPo/EL1ocfGY87vsVxvkRIxAF+6EuWjSTDDj3LVJt4QJr pv1gGzQOmHeBKF3xlkf6T/MXa4wysSqCYlRxGwQVmGdAzC0ZZNyUIKCYPXvc9s91vxgT kwTg== X-Gm-Message-State: AOAM532qmI0hxPGOik35T+ja18ENu7LicDnqxlv+/O/3G3VLkduG8Pbh tem1BG0VFJr9uNrE8JSE3JRe/6n9Ztz5wpGjxWY= X-Received: by 2002:a05:600c:600a:b0:38c:6c9e:f9c7 with SMTP id az10-20020a05600c600a00b0038c6c9ef9c7mr9210334wmb.26.1647551224066; Thu, 17 Mar 2022 14:07:04 -0700 (PDT) MIME-Version: 1.0 References: <20220310234611.424743-1-robdclark@gmail.com> <20220310234611.424743-4-robdclark@gmail.com> <3b066b63-c180-09c6-e39f-b408464b5bc1@quicinc.com> In-Reply-To: <3b066b63-c180-09c6-e39f-b408464b5bc1@quicinc.com> From: Rob Clark Date: Thu, 17 Mar 2022 14:07:45 -0700 Message-ID: Subject: Re: [Freedreno] [PATCH 3/3] drm/msm/gpu: Remove mutex from wait_event condition To: Akhil P Oommen Cc: dri-devel , Rob Clark , Jonathan Marek , David Airlie , linux-arm-msm , Vladimir Lypak , Abhinav Kumar , Bjorn Andersson , Sean Paul , Daniel Vetter , freedreno , open list , AngeloGioacchino Del Regno Content-Type: text/plain; charset="UTF-8" X-Spam-Status: No, score=-1.7 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,FREEMAIL_FORGED_FROMDOMAIN,FREEMAIL_FROM, HEADER_FROM_DIFFERENT_DOMAINS,MAILING_LIST_MULTI,RDNS_NONE, SPF_HELO_NONE,T_SCC_BODY_TEXT_LINE autolearn=no autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Thu, Mar 17, 2022 at 1:45 PM Akhil P Oommen wrote: > > On 3/11/2022 5:16 AM, Rob Clark wrote: > > From: Rob Clark > > > > The mutex wasn't really protecting anything before. Before the previous > > patch we could still be racing with the scheduler's kthread, as that is > > not necessarily frozen yet. Now that we've parked the sched threads, > > the only race is with jobs retiring, and that is harmless, ie. > > > > Signed-off-by: Rob Clark > > --- > > drivers/gpu/drm/msm/adreno/adreno_device.c | 11 +---------- > > 1 file changed, 1 insertion(+), 10 deletions(-) > > > > diff --git a/drivers/gpu/drm/msm/adreno/adreno_device.c b/drivers/gpu/drm/msm/adreno/adreno_device.c > > index 0440a98988fc..661dfa7681fb 100644 > > --- a/drivers/gpu/drm/msm/adreno/adreno_device.c > > +++ b/drivers/gpu/drm/msm/adreno/adreno_device.c > > @@ -607,15 +607,6 @@ static int adreno_runtime_resume(struct device *dev) > > return gpu->funcs->pm_resume(gpu); > > } > > > > -static int active_submits(struct msm_gpu *gpu) > > -{ > > - int active_submits; > > - mutex_lock(&gpu->active_lock); > > - active_submits = gpu->active_submits; > > - mutex_unlock(&gpu->active_lock); > I assumed that this lock here was to ensure proper barriers while > reading active_submits. Is that not required? There is a spinlock in prepare_to_wait_event() ahead of checking the condition, which AFAIU is a sufficient barrier BR, -R > > -Akhil. > > - return active_submits; > > -} > > - > > static int adreno_runtime_suspend(struct device *dev) > > { > > struct msm_gpu *gpu = dev_to_gpu(dev); > > @@ -669,7 +660,7 @@ static int adreno_system_suspend(struct device *dev) > > suspend_scheduler(gpu); > > > > remaining = wait_event_timeout(gpu->retire_event, > > - active_submits(gpu) == 0, > > + gpu->active_submits == 0, > > msecs_to_jiffies(1000)); > > if (remaining == 0) { > > dev_err(dev, "Timeout waiting for GPU to suspend\n"); >