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 Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id E177BC433FE for ; Mon, 17 Oct 2022 15:34:51 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S229597AbiJQPeu (ORCPT ); Mon, 17 Oct 2022 11:34:50 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:36600 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229732AbiJQPet (ORCPT ); Mon, 17 Oct 2022 11:34:49 -0400 Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [170.10.129.124]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id AB23F12D34 for ; Mon, 17 Oct 2022 08:34:47 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1666020886; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=N5Hw3N/yBRvXSb8kCKGLJA5iLp5ZJdPKFLyQnc+d2Vs=; b=U1FrnjWw5prz6irG6FshQ/87Y52T+Hgp/T86CQ919WBAaCAa7CY1PdAgksAVfKuDXEg/U+ lgTO5qliPbVSC4BTD5vjZ2jN6I0nvXoBfDeyigmGUKJAYjIstWKPpjN4PIBru02Jm1pf6L g+AeT04ispUAMH+cqk6b0pBjI6R4UyI= Received: from mail-lf1-f70.google.com (mail-lf1-f70.google.com [209.85.167.70]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.3, cipher=TLS_AES_128_GCM_SHA256) id us-mta-443-SDPW84E7Nb2Q2NRnQ72iyw-1; Mon, 17 Oct 2022 11:34:43 -0400 X-MC-Unique: SDPW84E7Nb2Q2NRnQ72iyw-1 Received: by mail-lf1-f70.google.com with SMTP id p36-20020a05651213a400b004779d806c13so3773882lfa.10 for ; Mon, 17 Oct 2022 08:34:42 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=in-reply-to:content-transfer-encoding:content-disposition :mime-version:references:message-id:subject:cc:to:from:date :x-gm-message-state:from:to:cc:subject:date:message-id:reply-to; bh=N5Hw3N/yBRvXSb8kCKGLJA5iLp5ZJdPKFLyQnc+d2Vs=; b=UyDiu4tjbegyr4a2RYnfk6ztJCViJ+k7TYzYOiBlqlFsM2KOwbYNCJJOxeqEst6lZ+ OiAoP27sUm1WrCJEYiyawSfJQHJ+ydwvL/qam0YYkh0tAwrypzKy2gW8ygqdxXEiajM4 3ERiC087e7dH0Yigw0WNGy+Qq2RwciMlA5uGxr8UX/on7guI5E64TG8boE3IhFqtpMc8 vj4KC465ZLK3Eto7PtYEx/UEk/LW1a8ahB/f729twMDKYh2bYubNpwAniz+jPb4PA+JP ygewVPA5XwXPw4sI6izCs03fUG69J5m4ndlSgKj11nTuzYFI4uBT2jHLDhxn+P3MBPo5 5LZA== X-Gm-Message-State: ACrzQf0Vnw3tGmefrTCEq3DmAS7oPVO40JY5EAXOevCdc/l5WzBnkOOd eDJjb3WWgo88F7v2+lBsUXD5ymCKmi7Q6h1p4AYPa0ZDNO/z/bVxkRV3irsVMHeHaq0uosiAz6M WPzIzNB94Iv5ye6xT X-Received: by 2002:a05:651c:98f:b0:26d:ff18:97c6 with SMTP id b15-20020a05651c098f00b0026dff1897c6mr4533684ljq.375.1666020881549; Mon, 17 Oct 2022 08:34:41 -0700 (PDT) X-Google-Smtp-Source: AMsMyM57wE364GqH9fWnoe0gYe9cPBp5F/31FMQZv9YAdTOl72+aEIDVZL9AQd9N6JQ0iPqlCe8DDA== X-Received: by 2002:a05:651c:98f:b0:26d:ff18:97c6 with SMTP id b15-20020a05651c098f00b0026dff1897c6mr4533677ljq.375.1666020881356; Mon, 17 Oct 2022 08:34:41 -0700 (PDT) Received: from redhat.com (host-90-235-3-243.mobileonline.telia.com. [90.235.3.243]) by smtp.gmail.com with ESMTPSA id u4-20020a05651c140400b0026fbac7468bsm1490240lje.103.2022.10.17.08.34.39 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 17 Oct 2022 08:34:39 -0700 (PDT) Date: Mon, 17 Oct 2022 17:34:37 +0200 From: Jonas =?iso-8859-1?Q?=C5dahl?= To: Simon Ser Cc: dri-devel@lists.freedesktop.org, stable@vger.kernel.org, Daniel Vetter , Lyude Paul Subject: Re: [PATCH 2/2] drm/connector: send hotplug uevent on connector cleanup Message-ID: References: <20221017153150.60675-1-contact@emersion.fr> <20221017153150.60675-2-contact@emersion.fr> MIME-Version: 1.0 Content-Type: text/plain; charset=iso-8859-1 Content-Disposition: inline Content-Transfer-Encoding: 8bit In-Reply-To: <20221017153150.60675-2-contact@emersion.fr> Precedence: bulk List-ID: X-Mailing-List: stable@vger.kernel.org On Mon, Oct 17, 2022 at 03:32:01PM +0000, Simon Ser wrote: > A typical DP-MST unplug removes a KMS connector. However care must > be taken to properly synchronize with user-space. The expected > sequence of events is the following: > > 1. The kernel notices that the DP-MST port is gone. > 2. The kernel marks the connector as disconnected, then sends a > uevent to make user-space re-scan the connector list. > 3. User-space notices the connector goes from connected to disconnected, > disables it. > 4. Kernel handles the the IOCTL disabling the connector. On success, > the very last reference to the struct drm_connector is dropped and > drm_connector_cleanup() is called. > 5. The connector is removed from the list, and a uevent is sent to tell > user-space that the connector disappeared. > > The very last step was missing. As a result, user-space thought the > connector still existed and could try to disable it again. Since the > kernel no longer knows about the connector, that would end up with > EINVAL and confused user-space. > > Fix this by sending a hotplug uevent from drm_connector_cleanup(). > > Signed-off-by: Simon Ser > Cc: stable@vger.kernel.org > Cc: Daniel Vetter > Cc: Lyude Paul > Cc: Jonas Ådahl Tested-by: Jonas Ådahl Jonas 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 Received: from gabe.freedesktop.org (gabe.freedesktop.org [131.252.210.177]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id AD4B3C4332F for ; Mon, 17 Oct 2022 15:34:58 +0000 (UTC) Received: from gabe.freedesktop.org (localhost [127.0.0.1]) by gabe.freedesktop.org (Postfix) with ESMTP id 07C7B10E519; Mon, 17 Oct 2022 15:34:57 +0000 (UTC) Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [170.10.129.124]) by gabe.freedesktop.org (Postfix) with ESMTPS id 0671110E519 for ; Mon, 17 Oct 2022 15:34:52 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1666020891; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=N5Hw3N/yBRvXSb8kCKGLJA5iLp5ZJdPKFLyQnc+d2Vs=; b=DdF3MWqs5FqnSN7VR7AtxhVF/E20BdjK1HvzJaDhUFqbwC/CCdC3OV9X1FSotK8UMBF6ed HRbOsmGtWvgInZ7G9El2EZdHh7eVuMG4OrocNyumPkzuDiOUsct5gLUbw+bpIqvbCJQDGQ BCRFveJaXKoemheZjW0dZsNawrc6rA0= Received: from mail-lf1-f72.google.com (mail-lf1-f72.google.com [209.85.167.72]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.3, cipher=TLS_AES_128_GCM_SHA256) id us-mta-423-ZvVv7_BhPrm0VYZvx8tt4w-1; Mon, 17 Oct 2022 11:34:43 -0400 X-MC-Unique: ZvVv7_BhPrm0VYZvx8tt4w-1 Received: by mail-lf1-f72.google.com with SMTP id s5-20020a056512214500b004a24e8c79ebso3767468lfr.0 for ; Mon, 17 Oct 2022 08:34:42 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=in-reply-to:content-transfer-encoding:content-disposition :mime-version:references:message-id:subject:cc:to:from:date :x-gm-message-state:from:to:cc:subject:date:message-id:reply-to; bh=N5Hw3N/yBRvXSb8kCKGLJA5iLp5ZJdPKFLyQnc+d2Vs=; b=eokx/COI/AGGy0bNMr1PA0/1U6l6/Pnl9+W8vKxRbS03jEoXrkUgeX65y9pe8RkGjp guHUaOW9FyLLBvE2TPm03f4wl630WfX7EWr24hiCf+ZTJehoSQz8MIyJllD8HAJyqhuQ uFIxqepEhf4NUedZNIvt+7Z4z0NKnqSKW7GS6YvsaQhZ39DxyJpwPSFFFINdKovc0FN5 3/2YdPQc2eHtcgXsdf2Bxk5ErvNacOQ4qaEREYRwdwQlolxv9YhLJXxEhyBwlXeKcVjq r7uQgcZjiRpXdaaxQzpf8L3CJszgOBG5V3Ig0Tsu4lyijycx3aLoCLjrYKxWcBw6pDxZ 4rRQ== X-Gm-Message-State: ACrzQf28378ClJeuE6yKF29f9jEvuahIBY9jaBfvekVc2jN0SQ0dxegx qRjph2VYbr9rW2watkBna97BwDamu4l889P3jEABOks3osTMFPkaH4p8Hbpoa0ZGW5z1dGTjtaf K37uNZJQL88pJZOV6kSTUBMgVGh+V X-Received: by 2002:a05:651c:98f:b0:26d:ff18:97c6 with SMTP id b15-20020a05651c098f00b0026dff1897c6mr4533683ljq.375.1666020881549; Mon, 17 Oct 2022 08:34:41 -0700 (PDT) X-Google-Smtp-Source: AMsMyM57wE364GqH9fWnoe0gYe9cPBp5F/31FMQZv9YAdTOl72+aEIDVZL9AQd9N6JQ0iPqlCe8DDA== X-Received: by 2002:a05:651c:98f:b0:26d:ff18:97c6 with SMTP id b15-20020a05651c098f00b0026dff1897c6mr4533677ljq.375.1666020881356; Mon, 17 Oct 2022 08:34:41 -0700 (PDT) Received: from redhat.com (host-90-235-3-243.mobileonline.telia.com. [90.235.3.243]) by smtp.gmail.com with ESMTPSA id u4-20020a05651c140400b0026fbac7468bsm1490240lje.103.2022.10.17.08.34.39 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 17 Oct 2022 08:34:39 -0700 (PDT) Date: Mon, 17 Oct 2022 17:34:37 +0200 From: Jonas =?iso-8859-1?Q?=C5dahl?= To: Simon Ser Subject: Re: [PATCH 2/2] drm/connector: send hotplug uevent on connector cleanup Message-ID: References: <20221017153150.60675-1-contact@emersion.fr> <20221017153150.60675-2-contact@emersion.fr> MIME-Version: 1.0 In-Reply-To: <20221017153150.60675-2-contact@emersion.fr> X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com Content-Type: text/plain; charset=WINDOWS-1252 Content-Disposition: inline Content-Transfer-Encoding: 8bit X-BeenThere: dri-devel@lists.freedesktop.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Direct Rendering Infrastructure - Development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Daniel Vetter , stable@vger.kernel.org, dri-devel@lists.freedesktop.org Errors-To: dri-devel-bounces@lists.freedesktop.org Sender: "dri-devel" On Mon, Oct 17, 2022 at 03:32:01PM +0000, Simon Ser wrote: > A typical DP-MST unplug removes a KMS connector. However care must > be taken to properly synchronize with user-space. The expected > sequence of events is the following: > > 1. The kernel notices that the DP-MST port is gone. > 2. The kernel marks the connector as disconnected, then sends a > uevent to make user-space re-scan the connector list. > 3. User-space notices the connector goes from connected to disconnected, > disables it. > 4. Kernel handles the the IOCTL disabling the connector. On success, > the very last reference to the struct drm_connector is dropped and > drm_connector_cleanup() is called. > 5. The connector is removed from the list, and a uevent is sent to tell > user-space that the connector disappeared. > > The very last step was missing. As a result, user-space thought the > connector still existed and could try to disable it again. Since the > kernel no longer knows about the connector, that would end up with > EINVAL and confused user-space. > > Fix this by sending a hotplug uevent from drm_connector_cleanup(). > > Signed-off-by: Simon Ser > Cc: stable@vger.kernel.org > Cc: Daniel Vetter > Cc: Lyude Paul > Cc: Jonas Ådahl Tested-by: Jonas Ådahl Jonas