Received: by 2002:ab2:2994:0:b0:1ef:ca3e:3cd5 with SMTP id n20csp249244lqb; Thu, 14 Mar 2024 10:10:10 -0700 (PDT) X-Forwarded-Encrypted: i=3; AJvYcCXxVzbZg0ytBslWVssbDm/GfCyIqXYh2qUJtRXuFS6xez/ugG54OLHAlPyJH/M7hP0o+VA79mRSNXv/3kUFbzK7tOE+EqQ4iFk0uZfWwA== X-Google-Smtp-Source: AGHT+IHzYtlG/Edgben/vpNA9S5M0Wnj9W3N7FC5Q7B5v4Ea9JbmjYSBMtjN/8lW4tbVUP/PE3fa X-Received: by 2002:a05:6402:2b93:b0:568:a18:2eb3 with SMTP id fj19-20020a0564022b9300b005680a182eb3mr1736683edb.11.1710436209708; Thu, 14 Mar 2024 10:10:09 -0700 (PDT) ARC-Seal: i=2; a=rsa-sha256; t=1710436209; cv=pass; d=google.com; s=arc-20160816; b=dhBwRDfhXLtayUciXlF/FRAUc30wpfapk+Y6a/R5wwdT5UmIM4ulSc0FbIOUSfxvER 2HL9hcAuFxuG25VbbgqjtPyTz6kIXCj8SWB/ORq6FqoakbrdpjBr6zkjeyrymK0ZrkQc 9tM8BRBuY5/UyX3SzPk/1DDwJXow0nBNWqGhqp2WoqwYq4VeRxdcATipMl6PJC6u2V9u Tr7jTqMOQSjx7tdKWFKY2fYqzabZQ1wFdInwz4Y3Hi8l5TYbQ6lngfBKMBC8XZEafpI7 g89h8zO4+ZVVfcl2REfdBhtvXrVh0YFUnOTZUIKB5dl+NxOpqSdXnik5KqeWDSlFBlqc m36Q== 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:message-id:subject:cc:to:from:date:dkim-signature; bh=wq3tDY8BbJifWyupgIyZpzh/9hWKNCkxl+BfruynXAQ=; fh=aa8UoOV3fhnUYjExOoMY7f9Qk94V/F/nqypeYMtrF0k=; b=frIqoxDzSeBKSPSCikQaJhZ0XxPX6yI7KU8aFeiCuOg2Efr97PVen9LKnpO+O3oKLb tdt6uocr07ceZnIBckFWk91T++61zO+Ee9nEaAVc0BwMT7BU8eljFRl3SvwGRW374u/s fbXF1n3d7kutzYsJXoO24VKFqxE+0BnJJ6Ja6hYfK+7ooQZ0oxXyi3pj6aY9GFDIivsP C3keROLosQot3e2o1eHD6CR0/DZrU2Z5tKEgiRdsHmMZcDMdYtt8aY/FpdyQVjcUVi4P PAE+D4+f+7pS/rfKv2W9pt1MZC3880/1lwXFVgl7qP9iLcUiEykKtXJXoHT6RAd4ny38 pFGg==; dara=google.com ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@cmpxchg-org.20230601.gappssmtp.com header.s=20230601 header.b=PkOlADmd; arc=pass (i=1 spf=pass spfdomain=cmpxchg.org dkim=pass dkdomain=cmpxchg-org.20230601.gappssmtp.com dmarc=pass fromdomain=cmpxchg.org); spf=pass (google.com: domain of linux-kernel+bounces-103606-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.80.249 as permitted sender) smtp.mailfrom="linux-kernel+bounces-103606-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=cmpxchg.org Return-Path: Received: from am.mirrors.kernel.org (am.mirrors.kernel.org. [147.75.80.249]) by mx.google.com with ESMTPS id d2-20020aa7ce02000000b005682aa503f0si876945edv.346.2024.03.14.10.10.09 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 14 Mar 2024 10:10:09 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel+bounces-103606-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.80.249 as permitted sender) client-ip=147.75.80.249; Authentication-Results: mx.google.com; dkim=pass header.i=@cmpxchg-org.20230601.gappssmtp.com header.s=20230601 header.b=PkOlADmd; arc=pass (i=1 spf=pass spfdomain=cmpxchg.org dkim=pass dkdomain=cmpxchg-org.20230601.gappssmtp.com dmarc=pass fromdomain=cmpxchg.org); spf=pass (google.com: domain of linux-kernel+bounces-103606-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.80.249 as permitted sender) smtp.mailfrom="linux-kernel+bounces-103606-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=cmpxchg.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 am.mirrors.kernel.org (Postfix) with ESMTPS id 25D0F1F22109 for ; Thu, 14 Mar 2024 17:10:09 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id B0F7F74434; Thu, 14 Mar 2024 17:10:02 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=cmpxchg-org.20230601.gappssmtp.com header.i=@cmpxchg-org.20230601.gappssmtp.com header.b="PkOlADmd" Received: from mail-qv1-f50.google.com (mail-qv1-f50.google.com [209.85.219.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 915D17351C for ; Thu, 14 Mar 2024 17:09:58 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.219.50 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1710436201; cv=none; b=AQwgKzulGvXqteM6W7AxsZ27bOgi8W75HkFnj9tZ9WYUy4dpgbJayzvAvIJhqRYWNGmT8l3aQq0ejncGPEwgSTMSWf5hNMK0OJ+xH8Xpp7Cd3FEvciKVGomc4qGIkkesJxYDsWfr6rYTEP+nOcCv5QjuE/iUXxNO6tCUlzFjchc= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1710436201; c=relaxed/simple; bh=0BnOssXuAHPcjC84J7jWUWt/Nn94F6Ev7bJGrF4SoNE=; h=Date:From:To:Cc:Subject:Message-ID:References:MIME-Version: Content-Type:Content-Disposition:In-Reply-To; b=akynoq8u+5/6gv52KE8oMbpwDrhHndusdYctVje1PwsKiXCn5n1hMjRvk87rQbHP+inw8TIfh9L2+nLglcklV4ib98xj3S2qEh+8Bs4YufaBhvwHERMEDfuIl2vDXNUa79tLPFXwMJdVltB/S/AG7O5WXg+MfTeVIfmekr865yU= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=cmpxchg.org; spf=pass smtp.mailfrom=cmpxchg.org; dkim=pass (2048-bit key) header.d=cmpxchg-org.20230601.gappssmtp.com header.i=@cmpxchg-org.20230601.gappssmtp.com header.b=PkOlADmd; arc=none smtp.client-ip=209.85.219.50 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=cmpxchg.org Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=cmpxchg.org Received: by mail-qv1-f50.google.com with SMTP id 6a1803df08f44-690bff9d4a6so9106076d6.1 for ; Thu, 14 Mar 2024 10:09:58 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=cmpxchg-org.20230601.gappssmtp.com; s=20230601; t=1710436197; x=1711040997; darn=vger.kernel.org; h=in-reply-to:content-transfer-encoding:content-disposition :mime-version:references:message-id:subject:cc:to:from:date:from:to :cc:subject:date:message-id:reply-to; bh=wq3tDY8BbJifWyupgIyZpzh/9hWKNCkxl+BfruynXAQ=; b=PkOlADmdKKSjk3/CLHQ+OJQVw6kF94EC2kOCcRYv8jamLmmbXkWaGNo9dqgzVxkvyJ R3/EmysmZIQyBOymD7P+luFYBTDGkBBOsGP7xT/u3ydOPR414BIdZGnru5bfKwXTrhSe f0B0a0yhkqARRM3TizKUc+euT77D+cKBaGqFMxbvHRSuheKV/S6aHVs1IoL55f4Z7/xZ 5F2I1h7awEm27hghqsYHgcriYpozozfUZw+s2SHBhXYQgb8+fTkB0cCMVN7cXJufHlml E4S1IBS7rxhfglBv3PhznsF7pJc6TPrimO5cNLT5yO3RsyfhhoTb5vFNJQ7WIw9E7ovc 7xuw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1710436197; x=1711040997; 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=wq3tDY8BbJifWyupgIyZpzh/9hWKNCkxl+BfruynXAQ=; b=Y0pZ1EvRiA5PYu4A2lL5QDwKpZqiGlDwpTGwL2jTXekJZKgKKeka/oqbNw1r3WlQQT 72W7lfApj5OvgnID+f29zMyPkYMctnEN4DgFoOxGDB8wYLIJy5tGqOOjmRoeN/ihHYip AcNtLgK71gDh1XFkVi2taTiaZeU1uNsyEfNWvqMU2rf3fnLf69DZGk+6F76IXStq5mTu YVGJNyWxdMra59WL7zc58Tr1PleZiE17eZY8q+vN2jAoCy0O5aJiJRUZo2lkxhNdGmUu xNoD52RXt3cxnSQws8B0xKZZTc17KQFRbBg5yWejj46rkKeSzTI4lkIjJvTonHbwqYSc pCOw== X-Forwarded-Encrypted: i=1; AJvYcCXMRWL6tbHUvz8RkUZ640O7K7KVoj8vdPa5JTWo4RmnX+h00dGS4gp/5O7evuTqOmV+JtcSLNvDq6Jf8LO8C7ZcaAcsBuc5zxUVY0RB X-Gm-Message-State: AOJu0YyVL5Gmb3J5ApWrKKpr/DPVCwa2HPZU1R7Qb35EERm91NmucPZo fY21RJtIxgkhW8BhWxSF1D8m7cI+9KQZLS0wN/ulRkm9Df9O/l4h/pqgWCwPCZg= X-Received: by 2002:a0c:d989:0:b0:691:6dd8:4606 with SMTP id y9-20020a0cd989000000b006916dd84606mr65545qvj.30.1710436197410; Thu, 14 Mar 2024 10:09:57 -0700 (PDT) Received: from localhost (2603-7000-0c01-2716-da5e-d3ff-fee7-26e7.res6.spectrum.com. [2603:7000:c01:2716:da5e:d3ff:fee7:26e7]) by smtp.gmail.com with ESMTPSA id z10-20020a056214040a00b00690d951b7d9sm700131qvx.6.2024.03.14.10.09.56 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 14 Mar 2024 10:09:56 -0700 (PDT) Date: Thu, 14 Mar 2024 13:09:48 -0400 From: Johannes Weiner To: Christian =?iso-8859-1?Q?K=F6nig?= Cc: Alex Deucher , "Sharma, Shashank" , Christian =?iso-8859-1?Q?K=F6nig?= , amd-gfx@lists.freedesktop.org, dri-devel@lists.freedesktop.org, linux-kernel@vger.kernel.org Subject: Re: [PATCH] drm/amdgpu: fix deadlock while reading mqd from debugfs Message-ID: <20240314170948.GA581298@cmpxchg.org> References: <20240307221609.7651-1-hannes@cmpxchg.org> 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: Hello, On Fri, Mar 08, 2024 at 12:32:33PM +0100, Christian K?nig wrote: > Am 07.03.24 um 23:07 schrieb Johannes Weiner: > > Lastly I went with an open loop instead of a memcpy() as I wasn't > > sure if that memory is safe to address a byte at at time. Shashank pointed out to me in private that byte access would indeed be safe. However, after actually trying it it won't work because memcpy() doesn't play nice with mqd being volatile: /home/hannes/src/linux/linux/drivers/gpu/drm/amd/amdgpu/amdgpu_ring.c: In function 'amdgpu_debugfs_mqd_read': /home/hannes/src/linux/linux/drivers/gpu/drm/amd/amdgpu/amdgpu_ring.c:550:22: warning: passing argument 1 of '__builtin_dynamic_object_size' discards 'volatil' qualifier from pointer target type [-Wdiscarded-qualifiers] 550 | memcpy(kbuf, mqd, ring->mqd_size); So I would propose leaving the patch as-is. Shashank, does that sound good to you? (Please keep me CC'd on replies, as I'm not subscribed to the graphics lists.) Thanks!