Received: by 2002:a05:7412:3b8b:b0:fc:a2b0:25d7 with SMTP id nd11csp919465rdb; Fri, 9 Feb 2024 05:21:41 -0800 (PST) X-Forwarded-Encrypted: i=3; AJvYcCWA6fCWI/ggfOW7k9HrtCmUN7sk+6atYlHSMWLBdya2ikJ2eyrvywNt/NIPTDIEU1KAiYLNvNed04nSrFpNwKAyNQj+cwrHukr+GcLbzw== X-Google-Smtp-Source: AGHT+IEn000nxmffzu9pTV+uqMibeSLQ+WxSNmAlIowrKgeld7Ljdq+F10d8b2mwkX1g36EJGoQH X-Received: by 2002:a05:6358:2909:b0:178:a1d9:4a9f with SMTP id y9-20020a056358290900b00178a1d94a9fmr1309052rwb.31.1707484901224; Fri, 09 Feb 2024 05:21:41 -0800 (PST) ARC-Seal: i=2; a=rsa-sha256; t=1707484901; cv=pass; d=google.com; s=arc-20160816; b=yt3PVUjO/JdpS6ZdrRI8K3PFybZ8ThQZYnUHb24oSxJvKhnKzN6wpMcVg7g2tlAY8+ cDIEXaTuTf3g24E8+bSUeaZKd2uiaj1HnsrpXJK1oLTptvjcX3mCPtFMRIKChXMEo910 rJTMsLuJFqvDA23OUSpgsx/1B0ITlD2FkmheTWBHcwHktOVPn0DKhV5zfi+1E2Zao+xh kjqwyv1ZStI6LHM1IsQUj3xZUv8pbVg746b8D/pnu6f9qSwvbuj7Y4ouICzjrtV6uh+1 ikGbceccVc5Ac2GO1RXMwQ0/L/xe6oCuLymV2Q+m9avzTOgsHlpqN65k1AZgjeNfcb3v /k0A== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=in-reply-to:content-transfer-encoding:content-disposition :mime-version:list-unsubscribe:list-subscribe:list-id:precedence :references:mail-followup-to:message-id:subject:cc:to:from:date :dkim-signature; bh=ErqXxs7zcmxaorvJLxeIL8QoDb90GRIEAGPObd8dqj0=; fh=VsuTEtVhMWo12bMxV4NlEDrZ+nikuSzhshBptt4c9mM=; b=yzELNF1EG0jlbX7Y5uwhQc1xJFOc6USvONELtdLVa6y0wAFu4amI0otkPwEv94rCsV zVkzLkW+iscXzd5p37kpP8y+uiABUfxEf2R9e0EP1rGWy9hfuAdlR5BfSX0tIcJaUCPU KWZzQaZj/P9bucMMx7JSOva8LNpAZ3zIaRzaVyUpP4LPu2BdKx2jy0h+27R1lAjTrHDm L+grbHBYrwDObj5VZbkdHNm4FMwnz7lyIMNhRiNHdaPLICG1FlcygLJxF6UPebXrNYEc HELyTXKRoJZBE9xL2vSkgjFCX/klGqJph2aUH0BFvgxrN8AP3j8DyjcyDBHVEt5eHNsL KplA==; dara=google.com ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@ffwll.ch header.s=google header.b=eD5Qn1Je; arc=pass (i=1 dkim=pass dkdomain=ffwll.ch); spf=pass (google.com: domain of linux-kernel+bounces-59259-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:40f1:3f00::1 as permitted sender) smtp.mailfrom="linux-kernel+bounces-59259-linux.lists.archive=gmail.com@vger.kernel.org" X-Forwarded-Encrypted: i=2; AJvYcCUY97kRSAwqgnj10YUz1UInEs6cRHXt1sSLayROCVppsZ4/rathYkLyuwRIh1l64NUcSHGHOD6LAQHW9ebUw4v0ixzjiTKRZZvBF6d6kw== Return-Path: Received: from sy.mirrors.kernel.org (sy.mirrors.kernel.org. [2604:1380:40f1:3f00::1]) by mx.google.com with ESMTPS id k65-20020a633d44000000b005d8c50790d7si1698256pga.447.2024.02.09.05.21.40 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 09 Feb 2024 05:21:41 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel+bounces-59259-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:40f1:3f00::1 as permitted sender) client-ip=2604:1380:40f1:3f00::1; Authentication-Results: mx.google.com; dkim=pass header.i=@ffwll.ch header.s=google header.b=eD5Qn1Je; arc=pass (i=1 dkim=pass dkdomain=ffwll.ch); spf=pass (google.com: domain of linux-kernel+bounces-59259-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:40f1:3f00::1 as permitted sender) smtp.mailfrom="linux-kernel+bounces-59259-linux.lists.archive=gmail.com@vger.kernel.org" Received: from smtp.subspace.kernel.org (wormhole.subspace.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by sy.mirrors.kernel.org (Postfix) with ESMTPS id 2E690B23BBA for ; Fri, 9 Feb 2024 11:00:34 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 52A3428DA5; Fri, 9 Feb 2024 11:00:19 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=ffwll.ch header.i=@ffwll.ch header.b="eD5Qn1Je" Received: from mail-wm1-f50.google.com (mail-wm1-f50.google.com [209.85.128.50]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id ACB3C25601 for ; Fri, 9 Feb 2024 11:00:16 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.128.50 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1707476418; cv=none; b=PUR8Quh0oLdqAUbTJMwxJwboZY3UlEmg74xrJzJwOBzrZHb1hWLzZSBOf3SmZUM8cZ62xMYvVEPFGrpfo+LAK3F5alMGunDsIB+aWDSfEzionHbsdlkpH3M6TSUtJLA4zU3Aj+GhZ3iT0xT0E787sTjGp5fEFgKV+exRKMDoDrI= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1707476418; c=relaxed/simple; bh=pwBkLYkQSQRMvnuL/v4/cC2vr8Anp13gRP0ObxcX4Jg=; h=Date:From:To:Cc:Subject:Message-ID:References:MIME-Version: Content-Type:Content-Disposition:In-Reply-To; b=A2KmZe+ynFTUJd/Kr4XgRVRzaQhHBefUWnXLxoPCxp4enX9LJqqomhVNmpQlfHPsj9KsjVOOPs7/E25LeC23tktXaAndpu0m3pAoeT1u8kFpTLGJ3QyjbMKd96/gNzbvwIXNGEDQrS1ohwYLAW5vFopHtOkCUyUXYkZOCq2KDlQ= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=none (p=none dis=none) header.from=ffwll.ch; spf=none smtp.mailfrom=ffwll.ch; dkim=pass (1024-bit key) header.d=ffwll.ch header.i=@ffwll.ch header.b=eD5Qn1Je; arc=none smtp.client-ip=209.85.128.50 Authentication-Results: smtp.subspace.kernel.org; dmarc=none (p=none dis=none) header.from=ffwll.ch Authentication-Results: smtp.subspace.kernel.org; spf=none smtp.mailfrom=ffwll.ch Received: by mail-wm1-f50.google.com with SMTP id 5b1f17b1804b1-40fb5f5fd84so1885025e9.1 for ; Fri, 09 Feb 2024 03:00:16 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=ffwll.ch; s=google; t=1707476415; x=1708081215; darn=vger.kernel.org; h=in-reply-to:content-transfer-encoding:content-disposition :mime-version:references:mail-followup-to:message-id:subject:cc:to :from:date:from:to:cc:subject:date:message-id:reply-to; bh=ErqXxs7zcmxaorvJLxeIL8QoDb90GRIEAGPObd8dqj0=; b=eD5Qn1Jec+9Qqe660r3AWRgMFg6HfwTbHUYltaAJKhJriZ0uBTxqs5l/hzZ5RPl/2+ 2N+/TYvmhNPfP2SDtt2dBCLJtZtZGUTb3dbYAo4/GH5mgLsPs4x1p2OGIlfITLeSIoKl LiBVKTZxAcP6BS8iM8f26y0qgxI8MVjnQASmU= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1707476415; x=1708081215; h=in-reply-to:content-transfer-encoding:content-disposition :mime-version:references:mail-followup-to:message-id:subject:cc:to :from:date:x-gm-message-state:from:to:cc:subject:date:message-id :reply-to; bh=ErqXxs7zcmxaorvJLxeIL8QoDb90GRIEAGPObd8dqj0=; b=FoM3Qk/mKJVQYpkoHqefBvMbTGNHWO13JmhDhnNyg29Lnl/up0HbNcgPvdlRIOYA27 gqvGlgsjDF7g4LJt5mayr7WAMCljWpGzU4LzwqdH/v08pnx/z7ceT5pjYsn7ZrZEnCkD EIfTPofCpUYKUCqPKO3eVsxy6xVk0+tWGlojAjJb8URgyZogNe7YaoWV0emH3scyy/4u wrtgf6Y95gDN1oVa4ELTt9blwtWkNV48YeNimqcETWxO6CVIDZXijs5pkKx6McP5G3Yv IMePAZgD3HiE0hn3Hw9Mgk+ZhS3yk3hSe9Cx9UMxEaVzbPB5JDe0wwJ+5b+JCzBu6nVQ yyaA== X-Forwarded-Encrypted: i=1; AJvYcCXpHYxoTR02FttLAzy9MYLX5VxoqT8R0v0os7rEEP93Ay0BpUStsUMVZwoYE6cK9ZfuRVPswibYa9j0ewVXRTjmXg0PDgM1hKX26YTF X-Gm-Message-State: AOJu0YwZtWNqV2V2DOpUAWKXUXQNgM4myylfxYDi0Bt/zMNtHqp7bdX7 zJzAk7v1WBTBjpqj43dtdwvGnFd6bydW6kBM7lnkyQSaLUfGrv6Bl2s4JCiDzWw= X-Received: by 2002:a05:6000:38c:b0:33b:5197:7136 with SMTP id u12-20020a056000038c00b0033b51977136mr1111009wrf.2.1707476414599; Fri, 09 Feb 2024 03:00:14 -0800 (PST) X-Forwarded-Encrypted: i=1; AJvYcCUHGQW0GPUdhcR5AQwoTXl3BpkEMSBlqTfxVZFRu6MUe/O4/U+wRxF2qh19k0ClVYO9HHv3DcGLj95tj+GEy1wl+GQYzYSDdQdrlmUJYsMGa9GCyEiDTVoR3IIdBCrNnwRPjjX4g5WNs/vjIl8rAwct71x9ljvYkwzDBeAPDUMXoB1WV9f6JdwiVCnAltzf4i5NRW0DFKIgEHGeGrIylNiJfLeAtFQ1xHxdWuu8NkpGcbvvBm+mJU7Jcw5ifIJzxPdUnREub1HyASwUYtHwh2XgdvkmOod4PYpaExV3YgSrOnEWp5FwrfXoguzfqq8tu+A3mIguzsNS5t1an91pbE+xBjHtFIhj/7pT0CasiePDGV90FU3siIuK19VW0l6vi+A7WNmsARlda2Yhimcb9Ms2zTnCeHXULMJR3cZVGntLwt/lDg7urP5JL2woihym04otl25pjKTW+fLEr0m6vdtl0rhGGK6VqPdFHY3nQtaZt07+oGqdqzwgxCZtDaaKkfLgowpYUvwsC+InwyJ5fzaoyM94w5MLAyVr+d4W0gjGFlHL2iKrw68m+uuIQm0L3Y5v0wJ+K0rayxexGUr10RqQll0skTdOdXz/aXgfF3lBQhZuZ5mOUd0UkNkLedTaCSFLAE7KqyULbLNvacc53qateKluJnQsnxccYcjIWx0rp2paiFWYJMLhk8Wi0L/8NTnox6cztAm2oTG4bF2vGhT3N59mo7afNf16OXpVURJ0KtVGm584unuadqm22xLec9oP6oAlHkZMwPlXWns= Received: from phenom.ffwll.local ([2a02:168:57f4:0:efd0:b9e5:5ae6:c2fa]) by smtp.gmail.com with ESMTPSA id j18-20020adff012000000b0033b44b4da56sm1494073wro.111.2024.02.09.03.00.13 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 09 Feb 2024 03:00:14 -0800 (PST) Date: Fri, 9 Feb 2024 12:00:11 +0100 From: Daniel Vetter To: Christian =?iso-8859-1?Q?K=F6nig?= Cc: Greg Kroah-Hartman , Hamza Mahfooz , linux-kernel@vger.kernel.org, stable@vger.kernel.org, "Rafael J. Wysocki" , Alex Deucher , Christian =?iso-8859-1?Q?K=F6nig?= , "Pan, Xinhui" , David Airlie , Bjorn Helgaas , Mario Limonciello , Lijo Lazar , Srinivasan Shanmugam , Le Ma , =?iso-8859-1?Q?Andr=E9?= Almeida , James Zhu , Aurabindo Pillai , Alex Shi , Jerry Snitselaar , Wei Liu , Robin Murphy , amd-gfx@lists.freedesktop.org, dri-devel@lists.freedesktop.org, linux-pci@vger.kernel.org Subject: Re: [PATCH 3/3] drm/amdgpu: wire up the can_remove() callback Message-ID: Mail-Followup-To: Christian =?iso-8859-1?Q?K=F6nig?= , Greg Kroah-Hartman , Hamza Mahfooz , linux-kernel@vger.kernel.org, stable@vger.kernel.org, "Rafael J. Wysocki" , Alex Deucher , Christian =?iso-8859-1?Q?K=F6nig?= , "Pan, Xinhui" , David Airlie , Bjorn Helgaas , Mario Limonciello , Lijo Lazar , Srinivasan Shanmugam , Le Ma , =?iso-8859-1?Q?Andr=E9?= Almeida , James Zhu , Aurabindo Pillai , Alex Shi , Jerry Snitselaar , Wei Liu , Robin Murphy , amd-gfx@lists.freedesktop.org, dri-devel@lists.freedesktop.org, linux-pci@vger.kernel.org References: <20240202222603.141240-1-hamza.mahfooz@amd.com> <20240202222603.141240-3-hamza.mahfooz@amd.com> <2024020225-faceless-even-e3f8@gregkh> <051a3088-048e-4613-9f22-8ea17f1b9736@gmail.com> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Type: text/plain; charset=iso-8859-1 Content-Disposition: inline Content-Transfer-Encoding: 8bit In-Reply-To: <051a3088-048e-4613-9f22-8ea17f1b9736@gmail.com> X-Operating-System: Linux phenom 6.6.11-amd64 On Tue, Feb 06, 2024 at 07:42:49PM +0100, Christian K?nig wrote: > Am 06.02.24 um 15:29 schrieb Daniel Vetter: > > On Fri, Feb 02, 2024 at 03:40:03PM -0800, Greg Kroah-Hartman wrote: > > > On Fri, Feb 02, 2024 at 05:25:56PM -0500, Hamza Mahfooz wrote: > > > > Removing an amdgpu device that still has user space references allocated > > > > to it causes undefined behaviour. > > > Then fix that please. There should not be anything special about your > > > hardware that all of the tens of thousands of other devices can't handle > > > today. > > > > > > What happens when I yank your device out of a system with a pci hotplug > > > bus? You can't prevent that either, so this should not be any different > > > at all. > > > > > > sorry, but please, just fix your driver. > > fwiw Christian K?nig from amd already rejected this too, I have no idea > > why this was submitted > > Well that was my fault. > > I commented on an internal bug tracker that when sysfs bind/undbind is a > different code path from PCI remove/re-scan we could try to reject it. > > Turned out it isn't a different code path. Yeah it's exactly the same code, and removing the sysfs stuff means we cant test hotunplug without physical hotunplugging stuff anymore. So really not great - if one is buggy so is the other, and sysfs allows us to control the timing a lot better to hit specific issues. -Sima > > since the very elaborate plan I developed with a > > bunch of amd folks was to fix the various lifetime lolz we still have in > > drm. We unfortunately export the world of internal objects to userspace as > > uabi objects with dma_buf, dma_fence and everything else, but it's all > > fixable and we have the plan even documented: > > > > https://dri.freedesktop.org/docs/drm/gpu/drm-uapi.html#device-hot-unplug > > > > So yeah anything that isn't that plan of record is very much no-go for drm > > drivers. Unless we change that plan of course, but that needs a > > documentation patch first and a big discussion. > > > > Aside from an absolute massive pile of kernel-internal refcounting bugs > > the really big one we agreed on after a lot of discussion is that SIGBUS > > on dma-buf mmaps is no-go for drm drivers, because it would break way too > > much userspace in ways which are simply not fixable (since sig handlers > > are shared in a process, which means the gl/vk driver cannot use it). > > > > Otherwise it's bog standard "fix the kernel bugs" work, just a lot of it. > > Ignoring a few memory leaks because of messed up refcounting we actually got > that working quite nicely. > > At least hot unplug / hot add seems to be working rather reliable in our > internal testing. > > So it can't be that messed up. > > Regards, > Christian. > > > > > Cheers, Sima > -- Daniel Vetter Software Engineer, Intel Corporation http://blog.ffwll.ch