Received: by 2002:a05:6a10:413:0:0:0:0 with SMTP id 19csp2326540pxp; Fri, 18 Mar 2022 08:14:55 -0700 (PDT) X-Google-Smtp-Source: ABdhPJy059VVi2lIV0gFJtnhZltyaxMuhBKLhNcJfOVCt+9vqoV6zm9WukSH12rwPs6vTnM1VWnA X-Received: by 2002:a63:202:0:b0:37c:4cfc:b89f with SMTP id 2-20020a630202000000b0037c4cfcb89fmr8115410pgc.396.1647616494912; Fri, 18 Mar 2022 08:14:54 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1647616494; cv=none; d=google.com; s=arc-20160816; b=bw9cfMd6HwgbbwVDV39ZzyRcSg6W41a1Brco6Iecgk/dZWW2VgR9Czw9drk2gWW/v1 J0id+dMNmLOCQXStXQ2yrQmnNSQykIaN3UPnvGF1/BjnQLO6rGrvFxVBgIBh7afkgr2u 2rTUh6G1RDuc7UP6BsTnN/0NuYPhamAGYkeInvoZTzYExmgprPzdeVuYFsTdPRYReh3g ger7r6S4IZv9qWzHiOcGr6s9RpizTjj3mZ4m8aR13XgNID855reCbaAJ+Nnx3MPL5DmK FwLua9RpF40I7wdkuJDa2ZWt4mcWOEXxtASfgzN/9mffe9p2FVcx7czrbtscxsUENgAn Lfvw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:in-reply-to:from :references:cc:to:content-language:subject:user-agent:mime-version :date:message-id:dkim-signature; bh=AWYNQnDX8YnIWGanRpBmZOGfO1fixSUAO6G/WP9HYy4=; b=PtFG5ZCXxEJ1g1C4dd8so4kVz5VDYjG22KQydtN/VBRcgxPBgHYMKPdNMSMBxEZjOd DMwnsrxpqT3HZLky1WA3T/c6IFj6KPWAYl2QE+XTZgwqOiXiPZgzrH0rQPnglJaIM/MF uBkmaSacUaFuLhMesy9XhD+ZQOA/gUjPhoT3++NyFbZ3jolycFGfrxvpJWp1gkOCGwAc K92glfgAOAoedOzZWakOmgspTggX1egACPUkYL0dfZEqqZmaV3/AJd8Y1kdPjSxuXHq+ Q/lqGc3hHx7IX4S+s0CCTgg7ABXKf6Y2ap2hakrRquaIF+kcp3mteAW2XSm8MhUWVLNJ k61A== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@collabora.com header.s=mail header.b=iyNSFjkU; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=collabora.com Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id 15-20020a63050f000000b0038222818815si3508586pgf.112.2022.03.18.08.14.38; Fri, 18 Mar 2022 08:14:54 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@collabora.com header.s=mail header.b=iyNSFjkU; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=collabora.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S234962AbiCRKX0 (ORCPT + 99 others); Fri, 18 Mar 2022 06:23:26 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:40034 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S234966AbiCRKXV (ORCPT ); Fri, 18 Mar 2022 06:23:21 -0400 Received: from bhuna.collabora.co.uk (bhuna.collabora.co.uk [46.235.227.227]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 02DB01ED07F for ; Fri, 18 Mar 2022 03:22:02 -0700 (PDT) Received: from [127.0.0.1] (localhost [127.0.0.1]) (Authenticated sender: kholk11) with ESMTPSA id 362351F45DF3 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=collabora.com; s=mail; t=1647598921; bh=W1u39IUbe6otztE9r97TmBCaSkIJMT4WAPdgwQbuLz4=; h=Date:Subject:To:Cc:References:From:In-Reply-To:From; b=iyNSFjkU8INvl3lzVLbYVltGn9Ljcetd9s8dl/V8f5DVEU00xl0ZDrqbXRsL65QYc UoeyDwjqn2KUdwJYnh2luQ44Ht+3XAgexrigTM7hX0WFQwVZFoY6kyhOAHAj7xn1UN uwcXJkRlIm/z0mP82WxrdoYQeCNZ4pjawzoLTPZpRC9vBB4NUFLXMJJIUcJwAp1Rrw 45qYx9I4aN+L8o8FrQ6sR70thPKtHdlYwfCY89nbYDEJMtJkminYYjuULIgIuK6Gsk 5iQbJZfsZDXGcjQckZrH245rhABMCJAiZ+VD9Xae84TfHqV13qmye6VmojaJWYAE8Q m6U05UKxQXLTw== Message-ID: Date: Fri, 18 Mar 2022 11:21:59 +0100 MIME-Version: 1.0 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:91.0) Gecko/20100101 Thunderbird/91.5.1 Subject: Re: [PATCH 1/2 RESEND] drm/bridge: parade-ps8640: avoid race condition on driver unbinding Content-Language: en-US To: =?UTF-8?Q?Ricardo_Ca=c3=b1uelo?= , dri-devel@lists.freedesktop.org Cc: linux-kernel@vger.kernel.org, linux-mediatek@lists.infradead.org, kernel@collabora.com, andrzej.hajda@intel.com, narmstrong@baylibre.com, maarten.lankhorst@linux.intel.com, mripard@kernel.org References: <20220311093406.4068019-1-ricardo.canuelo@collabora.com> <20220311093406.4068019-2-ricardo.canuelo@collabora.com> From: AngeloGioacchino Del Regno In-Reply-To: <20220311093406.4068019-2-ricardo.canuelo@collabora.com> Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 8bit X-Spam-Status: No, score=-2.1 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,NICE_REPLY_A,RCVD_IN_MSPIKE_H2, SPF_HELO_PASS,SPF_PASS,T_SCC_BODY_TEXT_LINE,UNPARSEABLE_RELAY autolearn=ham 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 Il 11/03/22 10:34, Ricardo Cañuelo ha scritto: > When unbinding a DRM master driver there's a race condition that > sometimes results in an invalid vm access when userspace (gnome-shell) > issues a DRM_IOCTL_MODE_GETCONNECTOR ioctl right after a bridge has been > removed from an encoder's bridge chain. > > This means that once a bridge has been disabled and gone through > ps8640_post_disable(), if ps8640_bridge_get_edid() runs afterwards as a > result of that ioctl call it will call drm_bridge_chain_pre_enable() > and drm_bridge_chain_post_disable() again in a bridge that has been > already detached. > > Setting `ps_bridge->pre_enabled = false` at a later stage of the > bringdown path and calling drm_bridge_chain_pre_enable() inside > ps8640_bridge_get_edid() only if needed avoid this, although a proper > subsystem-wide fix would be the proper solution, since the same type of > race conditions might happen somewhere else. > > Tested on an Acer Chromebook R13 (Elm, MT8173) with Debian Sid. > > Signed-off-by: Ricardo Cañuelo Reviewed-by: AngeloGioacchino Del Regno > --- > drivers/gpu/drm/bridge/parade-ps8640.c | 6 +++--- > 1 file changed, 3 insertions(+), 3 deletions(-) >