From nobody Tue Dec 16 23:43:01 2025 Received: from mail-wr1-f53.google.com (mail-wr1-f53.google.com [209.85.221.53]) (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 26A1A524C for ; Wed, 24 Jan 2024 03:00:10 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.221.53 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1706065212; cv=none; b=N2IzPlEsDfkHKlH9ZcRxmIaeHgoljUVCUoc2USWiJukfibkpb6M3pZu1DgU26gEK5zzCGGI7+ExI9iuM6+otgbcbgKiCW2UX/d8dBzb6bSeLkI9aKRCiwHmog4zBjcVVZhChKs/gJnIv7niBaEnGo0vsTEWoSfdrJa3h9JWl1U4= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1706065212; c=relaxed/simple; bh=WBAYWOzQrbynmcMq5FlSAIF+vKVyihci8yxoGQ6j4w4=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=dsE4DAMry/peMyitQTGKg7cjoTP58KZTgZQZEFD+cdjsMyBCQYfhBibTrtUVWnKrP3CUFs6YWpAljkwTSaX8GIVGEaVpB3qJGFoQToC7jK/in0VrFFmNwvkPceuUOueEpicGccuZar7rjFPwRREmwI9l8WkqHUOH4WoXkZR2edk= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=gmail.com; spf=pass smtp.mailfrom=gmail.com; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b=DkIFnIGN; arc=none smtp.client-ip=209.85.221.53 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=gmail.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=gmail.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b="DkIFnIGN" Received: by mail-wr1-f53.google.com with SMTP id ffacd0b85a97d-337cc8e72f5so4567033f8f.1 for ; Tue, 23 Jan 2024 19:00:10 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1706065209; x=1706670009; darn=vger.kernel.org; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=2lKvsANFUcNVxLXJxZjgiBTj8Zdtr64bBDmNrQ/dGYc=; b=DkIFnIGNQDtfNae+yjEMkg7iZZtj7u2TmhVHPZWJAwHA8SpJZD4FvhhjRnOyvsMG/Y lONFa96d1POwZD9IypxrjK4d3aiMP4m07E1KIfCsmF8iEI2nVAJW0r4TlOK6THfqAldJ zSmz6RGIkz3BKRuHWu35izLVeEleQrSAA5T7eorQ8380FORBqnf/zoi4fVetydQrsSK2 s9VclITpziQ7/HpWTJjZVH0515gO0x9vcgDy49S5jZogvOEa2u1EvUNQbERJGbqa4PdQ rbM0Ta5O/zWUAhjU9HlHVexKQbj7N5yasAQUM8Yd6hb15++gaOQ3+G8TIStouI8JeQsa r+SA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1706065209; x=1706670009; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=2lKvsANFUcNVxLXJxZjgiBTj8Zdtr64bBDmNrQ/dGYc=; b=o9QTAeZOtHwSjLjbbbCBn0cn0x7T3XMB8XWsmqCI2rkt/8z+cViUyzbZUxsaoXDlbm QIM0sRDL4doNVyFTPoB/MjRhhl23YkX2TW29/+jEfE0BibxbDq+vNZvXofKBnkmcND2Z By+rWX5uuZCX2WMwkFMgsWigE13OVngWym7gLp2IjRsU5ABOwQ0SjvPK6cQZQvpcMLm2 N/9e3bD2zvztOJxJCBh0dhsrH0dmFKldQOL6VCXrLQ269scB7WoVE0JUQkE9uCl68Xde khZ22E4ydH1u2UoEQ0i7Dkhk1fOHFVTzC+50ndaKYmIyrCbPkIikLzzCTcL9QSM+Q9wm MEYw== X-Gm-Message-State: AOJu0YxM0MvuxBk/G0tua7hJtTaCAkmyroKR4RiDINm1dcLZwNK5rrZt N5XIA9Oc6dq4wlJSTFqBB72VL9tOhlD6TDw1crjx7NUAMgk58wyg X-Google-Smtp-Source: AGHT+IFZ8JyJ3TC2xfMqcNV5Q5aHuhj3gsNkRM4/2otX+tMjwjVWKRVsJK9h8YN3NMi+Ch1oqtildg== X-Received: by 2002:a05:600c:5399:b0:40e:9675:8416 with SMTP id hg25-20020a05600c539900b0040e96758416mr721099wmb.169.1706065209410; Tue, 23 Jan 2024 19:00:09 -0800 (PST) Received: from mosaic.enunes.eu (ip-78-45-66-209.bb.vodafone.cz. [78.45.66.209]) by smtp.gmail.com with ESMTPSA id dj17-20020a05640231b100b00559bb146ecbsm9637914edb.6.2024.01.23.19.00.08 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 23 Jan 2024 19:00:08 -0800 (PST) From: Erico Nunes To: Qiang Yu , anarsoul@gmail.com, christian.koenig@amd.com, dri-devel@lists.freedesktop.org, lima@lists.freedesktop.org Cc: Maarten Lankhorst , Maxime Ripard , Thomas Zimmermann , David Airlie , Daniel Vetter , Sumit Semwal , linux-kernel@vger.kernel.org, Erico Nunes Subject: [PATCH v2 1/8] drm/lima: reset async_reset on pp hard reset Date: Wed, 24 Jan 2024 03:59:40 +0100 Message-ID: <20240124025947.2110659-2-nunes.erico@gmail.com> X-Mailer: git-send-email 2.43.0 In-Reply-To: <20240124025947.2110659-1-nunes.erico@gmail.com> References: <20240124025947.2110659-1-nunes.erico@gmail.com> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Content-Type: text/plain; charset="utf-8" Lima pp jobs use an async reset to avoid having to wait for the soft reset right after a job. The soft reset is done at the end of a job and a reset_complete flag is expected to be set at the next job. However, in case the user runs into a job timeout from any application, a hard reset is issued to the hardware. This hard reset clears the reset_complete flag, which causes an error message to show up before the next job. This is probably harmless for the execution but can be very confusing to debug, as it blames a reset timeout on the next application to submit a job. Reset the async_reset flag when doing the hard reset so that we don't get that message. Signed-off-by: Erico Nunes Reviewed-by: Vasily Khoruzhick --- drivers/gpu/drm/lima/lima_pp.c | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/drivers/gpu/drm/lima/lima_pp.c b/drivers/gpu/drm/lima/lima_pp.c index a5c95bed08c0..a8f8f63b8295 100644 --- a/drivers/gpu/drm/lima/lima_pp.c +++ b/drivers/gpu/drm/lima/lima_pp.c @@ -191,6 +191,13 @@ static int lima_pp_hard_reset(struct lima_ip *ip) pp_write(LIMA_PP_PERF_CNT_0_LIMIT, 0); pp_write(LIMA_PP_INT_CLEAR, LIMA_PP_IRQ_MASK_ALL); pp_write(LIMA_PP_INT_MASK, LIMA_PP_IRQ_MASK_USED); + + /* + * if there was an async soft reset queued, + * don't wait for it in the next job + */ + ip->data.async_reset =3D false; + return 0; } =20 --=20 2.43.0 From nobody Tue Dec 16 23:43:01 2025 Received: from mail-wm1-f49.google.com (mail-wm1-f49.google.com [209.85.128.49]) (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 49421290A for ; Wed, 24 Jan 2024 03:00:12 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.128.49 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1706065213; cv=none; b=Fap8sMjWxzSvlcvTHOlCu3gh577AmYFsaWcje0Y0Nd7B2JoSQC3lWMQwZu2A0voVGEwT5DpcGslJC649k9iHqcHyOIU6aAlvNd9694GW8bS9HvTbsgNBTUWv4T+qbhJIxA54v9lB6Jj6QaQr0TwBect8VKDTHI0zQV+0+SvBp9A= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1706065213; c=relaxed/simple; bh=J2Ku4zUqtPoQnOkUOB5TlnuoIop2sLljbl7vXV1zRx0=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=VVfN5LZoYpQ1iUKIAoE5PszSB4nuj2SCwRqUKWbzme4qSLj/9Z9FY80/dXt2WGDlNGBh5KKwFM8Pbch/rQEPnbbahSbpz6kGCz1KkLVmCps+Ezwl74wVjdFdOfA8XOLN4A6vmOkR9AKp7oSFELO5eNHpigLLBq1EaH8RkK+tstM= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=gmail.com; spf=pass smtp.mailfrom=gmail.com; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b=K6OApORt; arc=none smtp.client-ip=209.85.128.49 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=gmail.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=gmail.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b="K6OApORt" Received: by mail-wm1-f49.google.com with SMTP id 5b1f17b1804b1-40e60e137aaso55015285e9.0 for ; Tue, 23 Jan 2024 19:00:11 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1706065210; x=1706670010; darn=vger.kernel.org; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=BaTJtCWzAa42d+m/EougaGDz2r//03gZrDKzLfNv26E=; b=K6OApORtQ+gK/JgcDY3vT2q2mS0q7L8/imp0FF5pLsrYYGVoeByCy8OOrFWtIfgTQR X2hNFhvw94nh9KguHwovLF9GgjfDgKnU43QmtAaf559nkqFABu60z6bnaWdisfiRDyPh f+zp4k2R3ao10PJzsEfcBXKZQSyuYRjzdudpqK8uC5XE73Fx5hsfz3kJRNME6x3k4TQN 4MwXkJ1vi/Ng6iSHKfbdIEYi0sL1aHGdwyDnOvcSMHeGakzXiQfGmDpYtA2NbSY4tdJb 9PgDAUH5QPg2WXtrn5kAwAB1sc08vc3vUJE6Qv/T0Z9IDwCgHyrVIWlojRH8pvSl4W2f S1PQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1706065210; x=1706670010; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=BaTJtCWzAa42d+m/EougaGDz2r//03gZrDKzLfNv26E=; b=jVgp4n8A/sM+0QEOoOSxHwXYb2xEmvdgOn53C5HXdSW2zOj3ZTeXP94Q46bl3Tf7lz s2ksJWNBX/vpRMiPhTFTBcXWUtliAGhoHKWP7BoZXXarmHQBpfRzur9jfHdvRC5Vf/IR PTaIeRNAqAR0ZeFXATfyxDEC3/htTLG/OgVBHlhOMr9OqRmffQBEDt0ZcGuSmKTdCcKz UcHncGkWdNm/oJmyF+fAUfZH9mEIswpFKGf+IcwBijcVLz4M3VC8tZNHa8paJ1tgSUWR pg3PttDqLIrpuvKcu5FrQSxMvTIfXWEzZLD/xvti9Tm4eKogLDq+8TNhc789UA/DrwgT AZow== X-Gm-Message-State: AOJu0YwuBXpWV7qLolaYG2GduprkZq8o3m1G4PjcJMJ2s8i1pTVDk62e LKE4rtacpvz+aI6QNmBmCozRW//s+39lGcbn/J+mpzZ1X3Zh1HDp X-Google-Smtp-Source: AGHT+IFwR+0PHlmlGEWSlXVj5MQPq5ymiWct8wa0quwiQCc/blJhRIrth30UAoMURGBv8vL3XTjvRA== X-Received: by 2002:a05:600c:5115:b0:40e:b6d0:82d8 with SMTP id o21-20020a05600c511500b0040eb6d082d8mr1030534wms.88.1706065210383; Tue, 23 Jan 2024 19:00:10 -0800 (PST) Received: from mosaic.enunes.eu (ip-78-45-66-209.bb.vodafone.cz. [78.45.66.209]) by smtp.gmail.com with ESMTPSA id dj17-20020a05640231b100b00559bb146ecbsm9637914edb.6.2024.01.23.19.00.09 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 23 Jan 2024 19:00:09 -0800 (PST) From: Erico Nunes To: Qiang Yu , anarsoul@gmail.com, christian.koenig@amd.com, dri-devel@lists.freedesktop.org, lima@lists.freedesktop.org Cc: Maarten Lankhorst , Maxime Ripard , Thomas Zimmermann , David Airlie , Daniel Vetter , Sumit Semwal , linux-kernel@vger.kernel.org, Erico Nunes Subject: [PATCH v2 2/8] drm/lima: reset async_reset on gp hard reset Date: Wed, 24 Jan 2024 03:59:41 +0100 Message-ID: <20240124025947.2110659-3-nunes.erico@gmail.com> X-Mailer: git-send-email 2.43.0 In-Reply-To: <20240124025947.2110659-1-nunes.erico@gmail.com> References: <20240124025947.2110659-1-nunes.erico@gmail.com> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Content-Type: text/plain; charset="utf-8" Lima gp jobs use an async reset to avoid having to wait for the soft reset right after a job. The soft reset is done at the end of a job and a reset_complete flag is expected to be set at the next job. However, in case the user runs into a job timeout from any application, a hard reset is issued to the hardware. This hard reset clears the reset_complete flag, which causes an error message to show up before the next job. This is probably harmless for the execution but can be very confusing to debug, as it blames a reset timeout on the next application to submit a job. Reset the async_reset flag when doing the hard reset so that we don't get that message. Signed-off-by: Erico Nunes --- drivers/gpu/drm/lima/lima_gp.c | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/drivers/gpu/drm/lima/lima_gp.c b/drivers/gpu/drm/lima/lima_gp.c index 8dd501b7a3d0..b9a06e701a33 100644 --- a/drivers/gpu/drm/lima/lima_gp.c +++ b/drivers/gpu/drm/lima/lima_gp.c @@ -189,6 +189,13 @@ static int lima_gp_hard_reset(struct lima_ip *ip) gp_write(LIMA_GP_PERF_CNT_0_LIMIT, 0); gp_write(LIMA_GP_INT_CLEAR, LIMA_GP_IRQ_MASK_ALL); gp_write(LIMA_GP_INT_MASK, LIMA_GP_IRQ_MASK_USED); + + /* + * if there was an async soft reset queued, + * don't wait for it in the next job + */ + ip->data.async_reset =3D false; + return 0; } =20 --=20 2.43.0 From nobody Tue Dec 16 23:43:01 2025 Received: from mail-ed1-f49.google.com (mail-ed1-f49.google.com [209.85.208.49]) (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 4B7025C98 for ; Wed, 24 Jan 2024 03:00:13 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.208.49 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1706065214; cv=none; b=i0EfzCOXk3SsS1yKd1Uy5U3hMR9hN6XA69/P04qA3WMlNlv+jVAWlGGM9X51URRhhAQOZpJZtN+Gv9dH03/0oJv4ZkKBWL3IRJSTPeyjH/sokTcFnvMq5GJgayWniYUF6bPC/yZnYF3BoEbQTFtCKtTVO2QrjrqbeswB9ZNY+fU= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1706065214; c=relaxed/simple; bh=CVjjsZ0uumGs6h3s4OXvwxAu5l8bqVGMKkJlDxOzz48=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=dV6hDrwnq1NDkEy1WU7AJwJCbmscXl5HIyVj+GI3uzrKgKliG09Sl1yBwHx3LoZTgANt3pOkqNOY0Bq/FOj4rEEjGlXIA3yZJSihJTSdUmji0LIHSkhj+bjXhJ6EXZbmsBdHcqQbv6U2+M0mgoFMI0ti7v14mK260E9sRYboMo0= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=gmail.com; spf=pass smtp.mailfrom=gmail.com; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b=IryTTyXO; arc=none smtp.client-ip=209.85.208.49 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=gmail.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=gmail.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b="IryTTyXO" Received: by mail-ed1-f49.google.com with SMTP id 4fb4d7f45d1cf-55783b7b47aso5581164a12.0 for ; Tue, 23 Jan 2024 19:00:12 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1706065211; x=1706670011; darn=vger.kernel.org; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=oZ2AGx4llgOQpbQHqy+lTWRZ3MYwi41F2EIG/DZLPtI=; b=IryTTyXOKcvmtZ/HLDzcIzXxh/NPXOSwSXlnGENKTXpqUSSU/U3vVpEG5AaVZxrQcx bNqdZbY8iTGSUAn3IbehOmm+ffLqa8nJLxkxiyK47ZMqA173KAyTYeKVW+ILltsC047F oARyxMt7IiPSgmjOf8errj30giDwAPPGtZPPqz8TMrikUUuNB9m2fevwavWx8CYMJb1f iiZFLPVcyJwI0QzwcCMtCOqlyCdlWBRy1RnEEmqF2tBhxvF+EM6gCiJ8gWiSXD5yG4yA eUyBcRCzC1XnjRPlN3nqyjR9YuuqOwX4CI/toED72e02I5ZpJB2eXSjuMt+SiE9wyLcx QpWg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1706065211; x=1706670011; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=oZ2AGx4llgOQpbQHqy+lTWRZ3MYwi41F2EIG/DZLPtI=; b=jtzBpwXaakCYMU4Ug89HKpce4o8VVMNqKfU8Uncr6RhVVTtZjFdQKZoc7+GRFLlBUq bZRSTsqs+tQ34epB4jbiYjKEG6lzMjjRn1bXdlc+6ufsuturXE7HTVkD6PnHbtyocyXV OO20xQLJqModYt0GX3nfbGYC1V3ncGOmxpQpCkiLQGRiPuBQMsF1Yo0tFM9JIiMStNvO ey1dXnh4flOXVQhtzjeHRyiRLN83NX6tZPBgwxycpfDUClqCmGRZnR+Q/JX8Mu1M4URR Ps1MLNx69tMTU9dSQ5bEskcnVg9G8Y66Z6o8a/5JLVqpZFqvyfvkDJpVGAg4jiguUIFk 79xg== X-Gm-Message-State: AOJu0YxbAhp9P6BRD+w+IRKPEUfOY4lLOmxtk7qbRHkA9LpdsTyCV+zo fmeePF7Nj1QMlXwImJmpOK+1LVbvCJJwWKCcr8LIvtN8WeIzfzdT X-Google-Smtp-Source: AGHT+IFY/xUjRd5C81Nvba31ogUlvGsjSOuyHLhEZHoYYl7MqACrgkHcV+dOKD+vbkGVhH1TYy4G0w== X-Received: by 2002:a50:ee03:0:b0:559:70d5:5dd9 with SMTP id g3-20020a50ee03000000b0055970d55dd9mr1494752eds.67.1706065211426; Tue, 23 Jan 2024 19:00:11 -0800 (PST) Received: from mosaic.enunes.eu (ip-78-45-66-209.bb.vodafone.cz. [78.45.66.209]) by smtp.gmail.com with ESMTPSA id dj17-20020a05640231b100b00559bb146ecbsm9637914edb.6.2024.01.23.19.00.10 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 23 Jan 2024 19:00:10 -0800 (PST) From: Erico Nunes To: Qiang Yu , anarsoul@gmail.com, christian.koenig@amd.com, dri-devel@lists.freedesktop.org, lima@lists.freedesktop.org Cc: Maarten Lankhorst , Maxime Ripard , Thomas Zimmermann , David Airlie , Daniel Vetter , Sumit Semwal , linux-kernel@vger.kernel.org, Erico Nunes Subject: [PATCH v2 3/8] drm/lima: set pp bus_stop bit before hard reset Date: Wed, 24 Jan 2024 03:59:42 +0100 Message-ID: <20240124025947.2110659-4-nunes.erico@gmail.com> X-Mailer: git-send-email 2.43.0 In-Reply-To: <20240124025947.2110659-1-nunes.erico@gmail.com> References: <20240124025947.2110659-1-nunes.erico@gmail.com> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Content-Type: text/plain; charset="utf-8" This is required for reliable hard resets. Otherwise, doing a hard reset while a task is still running (such as a task which is being stopped by the drm_sched timeout handler) may result in random mmu write timeouts or lockups which cause the entire gpu to hang. Signed-off-by: Erico Nunes Reviewed-by: Vasily Khoruzhick --- drivers/gpu/drm/lima/lima_pp.c | 13 +++++++++++++ 1 file changed, 13 insertions(+) diff --git a/drivers/gpu/drm/lima/lima_pp.c b/drivers/gpu/drm/lima/lima_pp.c index a8f8f63b8295..ac097dd75072 100644 --- a/drivers/gpu/drm/lima/lima_pp.c +++ b/drivers/gpu/drm/lima/lima_pp.c @@ -168,6 +168,11 @@ static void lima_pp_write_frame(struct lima_ip *ip, u3= 2 *frame, u32 *wb) } } =20 +static int lima_pp_bus_stop_poll(struct lima_ip *ip) +{ + return !!(pp_read(LIMA_PP_STATUS) & LIMA_PP_STATUS_BUS_STOPPED); +} + static int lima_pp_hard_reset_poll(struct lima_ip *ip) { pp_write(LIMA_PP_PERF_CNT_0_LIMIT, 0xC01A0000); @@ -181,6 +186,14 @@ static int lima_pp_hard_reset(struct lima_ip *ip) =20 pp_write(LIMA_PP_PERF_CNT_0_LIMIT, 0xC0FFE000); pp_write(LIMA_PP_INT_MASK, 0); + + pp_write(LIMA_PP_CTRL, LIMA_PP_CTRL_STOP_BUS); + ret =3D lima_poll_timeout(ip, lima_pp_bus_stop_poll, 10, 100); + if (ret) { + dev_err(dev->dev, "pp %s bus stop timeout\n", lima_ip_name(ip)); + return ret; + } + pp_write(LIMA_PP_CTRL, LIMA_PP_CTRL_FORCE_RESET); ret =3D lima_poll_timeout(ip, lima_pp_hard_reset_poll, 10, 100); if (ret) { --=20 2.43.0 From nobody Tue Dec 16 23:43:01 2025 Received: from mail-wm1-f41.google.com (mail-wm1-f41.google.com [209.85.128.41]) (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 3C392AD4F for ; Wed, 24 Jan 2024 03:00:14 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.128.41 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1706065215; cv=none; b=ER+ctGAGrUaTOXUTi9r0TA7eKfuWK5CcN9oxL06MClLbrh3ke5JFyWVQGtIg0cvsTQRceHkERGXxIG4TEgMKFr1A7fCdhy8fRVpzUc9uUFTi3ZT8wTEnIgrHo9dLFvi8ffOWnBJbSDyUBOIbNEzUxz5aNw5z2CCRzoh1wNjfccc= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1706065215; c=relaxed/simple; bh=tjzpl8DTYuIIfNlzPxH7Jx6xrDkUHp92OzBp4ixJk0A=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=PNKcMmrPk46SxjZcUhQrsr7hMo00pBPjfnI/JJWJfdBGBJgcZFp7leWDkKHeRGlyocsNBjeEpJ4wImjJ24xIE/r67WfBTrBJ2vDSuHbDHrp66b9kLpgSz2w4RNz/aMiRWugi2oOuhAqi754Zvtz1uqru75jMbwEARanX5/ZSQiE= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=gmail.com; spf=pass smtp.mailfrom=gmail.com; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b=X/hGtN9j; arc=none smtp.client-ip=209.85.128.41 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=gmail.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=gmail.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b="X/hGtN9j" Received: by mail-wm1-f41.google.com with SMTP id 5b1f17b1804b1-40eb99a72dcso14183085e9.1 for ; Tue, 23 Jan 2024 19:00:13 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1706065212; x=1706670012; darn=vger.kernel.org; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=xsH0t0Mo3703I7xwFyS+NhUyDq/CWLVJL75Yu+tXQAA=; b=X/hGtN9jqGEdQHHjl+NgUasnrircYSwZXay74lpXWXjMBzagF4fXnQ1eTqIzY1nijY sB13vZTDh167/eVEMWtqADv/CgTlXDflcY92PaIEEcqhX6yzUCvL70ggJPLwU3zAaAAZ qleyvDhZ3xy75ojeEtBxF+nqjKS5g2bsYFK7kRk2NGPlnn+nVxvhLDtDq/N3oIL6LFAQ adK6Ef9V92kDwPoJBxWusfZMhzsq/8Z4TKAVKWcVI/YVYxRodOJ6G/rzlajwGgXB0c8G kchmpPPNx2e/uXJEdRThrh5AxL1bdwMuOp2LAeKxVhwk6yS4gQKj42veTyQJVmZoG6Qd LQkw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1706065212; x=1706670012; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=xsH0t0Mo3703I7xwFyS+NhUyDq/CWLVJL75Yu+tXQAA=; b=MbHotWVg8moO+xTq4vRMFPh2UemYW/0XDejzwB+09vioLBjTAQ5noqZGulsdZdTvSf 7gDg52gFtxJeC+i4bvHFtSOhb4oUC7ahasY/52fG4r33eLYid6qCJ+Ds+XNnx74+LNqW veunGsaADgT9S83xpFvLdg0tAhxqwDmcfaR90580ZZUjTzsBgpERrDh8918bpC62AkIh krNergSg4zmjtC8VhMJYPwREh4OGrtRuJCWhI2mq81SBYbFj/rDVlVfABaoBcVKcg4Ac cOjeg+ultf2ZE+M6MLOPSolf474rdhYW/voeRnMXPFLXziYa3JdgcH0NADOHvJgIxvEr /kPA== X-Gm-Message-State: AOJu0YzJoEFBlpcsJLuL65A9cH7dhTK3gOGxLUNyWcxNpZez/qL/3mvZ FfEIKkcC5FDWncTsnX2Bd6jmXXKC2jlReeVdSnDAdLdC9Li1Hwjy X-Google-Smtp-Source: AGHT+IG56fGRQ4TmapP4DZAXI1KdXrMXihzbtQnGB0VIMwwJOsKunjx1HQl/TwRycRUsmO8GmBJLiw== X-Received: by 2002:a05:600c:4214:b0:40e:afa6:5e00 with SMTP id x20-20020a05600c421400b0040eafa65e00mr620087wmh.168.1706065212421; Tue, 23 Jan 2024 19:00:12 -0800 (PST) Received: from mosaic.enunes.eu (ip-78-45-66-209.bb.vodafone.cz. [78.45.66.209]) by smtp.gmail.com with ESMTPSA id dj17-20020a05640231b100b00559bb146ecbsm9637914edb.6.2024.01.23.19.00.11 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 23 Jan 2024 19:00:11 -0800 (PST) From: Erico Nunes To: Qiang Yu , anarsoul@gmail.com, christian.koenig@amd.com, dri-devel@lists.freedesktop.org, lima@lists.freedesktop.org Cc: Maarten Lankhorst , Maxime Ripard , Thomas Zimmermann , David Airlie , Daniel Vetter , Sumit Semwal , linux-kernel@vger.kernel.org, Erico Nunes Subject: [PATCH v2 4/8] drm/lima: set gp bus_stop bit before hard reset Date: Wed, 24 Jan 2024 03:59:43 +0100 Message-ID: <20240124025947.2110659-5-nunes.erico@gmail.com> X-Mailer: git-send-email 2.43.0 In-Reply-To: <20240124025947.2110659-1-nunes.erico@gmail.com> References: <20240124025947.2110659-1-nunes.erico@gmail.com> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Content-Type: text/plain; charset="utf-8" This is required for reliable hard resets. Otherwise, doing a hard reset while a task is still running (such as a task which is being stopped by the drm_sched timeout handler) may result in random mmu write timeouts or lockups which cause the entire gpu to hang. Signed-off-by: Erico Nunes --- drivers/gpu/drm/lima/lima_gp.c | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/drivers/gpu/drm/lima/lima_gp.c b/drivers/gpu/drm/lima/lima_gp.c index b9a06e701a33..4355fa7b17f4 100644 --- a/drivers/gpu/drm/lima/lima_gp.c +++ b/drivers/gpu/drm/lima/lima_gp.c @@ -166,6 +166,11 @@ static void lima_gp_task_run(struct lima_sched_pipe *p= ipe, gp_write(LIMA_GP_CMD, cmd); } =20 +static int lima_gp_bus_stop_poll(struct lima_ip *ip) +{ + return !!(gp_read(LIMA_GP_STATUS) & LIMA_GP_STATUS_BUS_STOPPED); +} + static int lima_gp_hard_reset_poll(struct lima_ip *ip) { gp_write(LIMA_GP_PERF_CNT_0_LIMIT, 0xC01A0000); @@ -179,6 +184,13 @@ static int lima_gp_hard_reset(struct lima_ip *ip) =20 gp_write(LIMA_GP_PERF_CNT_0_LIMIT, 0xC0FFE000); gp_write(LIMA_GP_INT_MASK, 0); + + gp_write(LIMA_GP_CMD, LIMA_GP_CMD_STOP_BUS); + ret =3D lima_poll_timeout(ip, lima_gp_bus_stop_poll, 10, 100); + if (ret) { + dev_err(dev->dev, "%s bus stop timeout\n", lima_ip_name(ip)); + return ret; + } gp_write(LIMA_GP_CMD, LIMA_GP_CMD_RESET); ret =3D lima_poll_timeout(ip, lima_gp_hard_reset_poll, 10, 100); if (ret) { --=20 2.43.0 From nobody Tue Dec 16 23:43:01 2025 Received: from mail-wm1-f45.google.com (mail-wm1-f45.google.com [209.85.128.45]) (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 2B97DC158 for ; Wed, 24 Jan 2024 03:00:15 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.128.45 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1706065216; cv=none; b=leuRoMt+gGMtpOapvYRGHVdng2PHHJqgqtDoGVoN4ErKKD0D/WWE7ORil/6BpFTWPhedcld/X5jBEDMxzEPxqpneosG4iEhWJF7tZQxlfV222xKnMMceNrsDKPqDhCqfmnzeKXvgAB7ER7Uw6d9hm8nVJ1J2+MC8x/+zZdawOCY= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1706065216; c=relaxed/simple; bh=kU8GnjmVHoPQSpbhEVkW73vEGzbs7ySfOs49yLSu1c0=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=eIl+yNRy+Vpl2x9/nJOaPEE8xcOLyoJGQ1gLMhdzZV8va73CJgYP3ciu62U83Ruhg+4zeGIVlcyj0rivHoBFrprjNyA+1NPjn8JinlVKW/NMGA8Vj8Ma1VylpBJUd24eonbzgP99GPGocxO61Y1D202PQOF9hKQEqSLqV+GFn+M= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=gmail.com; spf=pass smtp.mailfrom=gmail.com; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b=cmHwAlz8; arc=none smtp.client-ip=209.85.128.45 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=gmail.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=gmail.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b="cmHwAlz8" Received: by mail-wm1-f45.google.com with SMTP id 5b1f17b1804b1-40e9101b5f9so55373355e9.3 for ; Tue, 23 Jan 2024 19:00:14 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1706065213; x=1706670013; darn=vger.kernel.org; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=opZYreiEG2AcFzWD38eEu/SQH9nltnXulQyDLOx9jXo=; b=cmHwAlz8nwXXrZYhK4uXlwICZmrwaNMxA0xv8ZBlQEADPDQFPkKls+PVMeUEvzgx/9 ntlRSkhjST7kQn1a1stjN8YyXLXh2G6APiG3TZ3XPiXw95u3oGjdT/OSV9JFUEoda2KO dYAL6nK0Ow4k9/3O7sU8KQh0MOTENae92s82ShOf4cuZhTwXpIG10DCD3MMTQDC/FsRt fSTtz9JZSfdQATZZaxtK2O1OsqzNwHiTAgFr5R+7IwD46AcH1ON2yFyTqe6bxJs5bq1E aDTeEh7zIF0SdP8U8SwVHZasDRDA7CaFsGVKN3x/vrXPXw+y+fXYr4gzM/hr0/KeoqWS HaWg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1706065213; x=1706670013; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=opZYreiEG2AcFzWD38eEu/SQH9nltnXulQyDLOx9jXo=; b=PcPg85rjFS5l1KgWdzaeAZnWNFIKa2Brka0wHKfaL+OAdf4e0n4RtYThQv2l60NHlu OKWYCt5J4iUw5CJu6dopVJ9VMNwDZ0K2HoSzJRLwkIiOHXvTGOfwKLhZmPLDfIonurEp Slo+eMmx1DIUw6wiv73Lz7DqAkkec2QyiAHLYDmHRWw4Bq2UBMrnCviPNhh9mF9QyzSX gq6s49xoHyGuOPqcquVCdWh4E0VXmBOujYPSFFiBGKnNgQkMO9SBALweKdYQkV8+hCOP xORFQiibunwhwH+AkJ+KR5s6NZEU2mtyGx77G1Se/oWkO6ZsBN0/KmdU9GeMP9rZ6Q6m Hz5A== X-Gm-Message-State: AOJu0Yx0+H8Zvqd6OnTcRjYM4kpuMbkvKLcJ+p/thZ1BbOFz17BW4B7d 3/g6C8OwSkvkeNENG8xF4fQdNUv7fLulJ+qfSMN9O0QzS5sTS2qL X-Google-Smtp-Source: AGHT+IFSHthVhbNG0Qfb0DDYrPsBvJwa1h3gBSGkCx5GOfjIWDgE++7W0fC/TiEr/1O0wANexbQlPQ== X-Received: by 2002:a05:600c:1705:b0:40e:ab2a:25a0 with SMTP id c5-20020a05600c170500b0040eab2a25a0mr683615wmn.181.1706065213437; Tue, 23 Jan 2024 19:00:13 -0800 (PST) Received: from mosaic.enunes.eu (ip-78-45-66-209.bb.vodafone.cz. [78.45.66.209]) by smtp.gmail.com with ESMTPSA id dj17-20020a05640231b100b00559bb146ecbsm9637914edb.6.2024.01.23.19.00.12 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 23 Jan 2024 19:00:12 -0800 (PST) From: Erico Nunes To: Qiang Yu , anarsoul@gmail.com, christian.koenig@amd.com, dri-devel@lists.freedesktop.org, lima@lists.freedesktop.org Cc: Maarten Lankhorst , Maxime Ripard , Thomas Zimmermann , David Airlie , Daniel Vetter , Sumit Semwal , linux-kernel@vger.kernel.org, Erico Nunes Subject: [PATCH v2 5/8] drm/lima: handle spurious timeouts due to high irq latency Date: Wed, 24 Jan 2024 03:59:44 +0100 Message-ID: <20240124025947.2110659-6-nunes.erico@gmail.com> X-Mailer: git-send-email 2.43.0 In-Reply-To: <20240124025947.2110659-1-nunes.erico@gmail.com> References: <20240124025947.2110659-1-nunes.erico@gmail.com> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Content-Type: text/plain; charset="utf-8" There are several unexplained and unreproduced cases of rendering timeouts with lima, for which one theory is high IRQ latency coming from somewhere else in the system. This kind of occurrence may cause applications to trigger unnecessary resets of the GPU or even applications to hang if it hits an issue in the recovery path. Panfrost already does some special handling to account for such "spurious timeouts", it makes sense to have this in lima too to reduce the chance that it hit users. Signed-off-by: Erico Nunes --- drivers/gpu/drm/lima/lima_sched.c | 31 ++++++++++++++++++++++++++++--- 1 file changed, 28 insertions(+), 3 deletions(-) diff --git a/drivers/gpu/drm/lima/lima_sched.c b/drivers/gpu/drm/lima/lima_= sched.c index c3bf8cda8498..814428564637 100644 --- a/drivers/gpu/drm/lima/lima_sched.c +++ b/drivers/gpu/drm/lima/lima_sched.c @@ -1,6 +1,7 @@ // SPDX-License-Identifier: GPL-2.0 OR MIT /* Copyright 2017-2019 Qiang Yu */ =20 +#include #include #include #include @@ -401,9 +402,35 @@ static enum drm_gpu_sched_stat lima_sched_timedout_job= (struct drm_sched_job *job struct lima_sched_pipe *pipe =3D to_lima_pipe(job->sched); struct lima_sched_task *task =3D to_lima_task(job); struct lima_device *ldev =3D pipe->ldev; + struct lima_ip *ip =3D pipe->processor[0]; + int i; + + /* + * If the GPU managed to complete this jobs fence, the timeout is + * spurious. Bail out. + */ + if (dma_fence_is_signaled(task->fence)) { + DRM_WARN("%s spurious timeout\n", lima_ip_name(ip)); + return DRM_GPU_SCHED_STAT_NOMINAL; + } + + /* + * Lima IRQ handler may take a long time to process an interrupt + * if there is another IRQ handler hogging the processing. + * In order to catch such cases and not report spurious Lima job + * timeouts, synchronize the IRQ handler and re-check the fence + * status. + */ + for (i =3D 0; i < pipe->num_processor; i++) + synchronize_irq(pipe->processor[i]->irq); + + if (dma_fence_is_signaled(task->fence)) { + DRM_WARN("%s unexpectedly high interrupt latency\n", lima_ip_name(ip)); + return DRM_GPU_SCHED_STAT_NOMINAL; + } =20 if (!pipe->error) - DRM_ERROR("lima job timeout\n"); + DRM_ERROR("%s job timeout\n", lima_ip_name(ip)); =20 drm_sched_stop(&pipe->base, &task->base); =20 @@ -417,8 +444,6 @@ static enum drm_gpu_sched_stat lima_sched_timedout_job(= struct drm_sched_job *job if (pipe->bcast_mmu) lima_mmu_page_fault_resume(pipe->bcast_mmu); else { - int i; - for (i =3D 0; i < pipe->num_mmu; i++) lima_mmu_page_fault_resume(pipe->mmu[i]); } --=20 2.43.0 From nobody Tue Dec 16 23:43:01 2025 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 474F4DDD6 for ; Wed, 24 Jan 2024 03: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=1706065218; cv=none; b=Mmrf0m+BUzcdw+msAxcJCbPclxngrcUhRUTVwQj6N2d0BarChm36RSBrtqODnGVfbrF/6x+RBGWNItBoMp1T+i463sTXaikC556qNQ7Dnl42lkRqRc4oyQM82QWSHplgxgqOAwmyPTtZ15O5VAMLUxTZ9jxACLIg9F4NZF4JnIo= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1706065218; c=relaxed/simple; bh=CAAyd6m6zHz9mQ5m5c51BGdzwELNqXW4ebqMAmJGEBE=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version:Content-Type; b=c+hac85C6sfkMhT7DyDbK45m9URhN+JfMi9Nfx43tqm2nVoTElGeZwbLRU1soI0zIubFVI1AG4XNsQs6202TsJYXqg5gCDwTFEV3erHNOgVgAVH6SLQVLjnmZDJcgz4SlJOsSDwLEfTu9gE2e4ofq62Ck9UsmbpoC1oVmloiGOE= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=gmail.com; spf=pass smtp.mailfrom=gmail.com; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b=EgXtL6ly; arc=none smtp.client-ip=209.85.128.50 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=gmail.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=gmail.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b="EgXtL6ly" Received: by mail-wm1-f50.google.com with SMTP id 5b1f17b1804b1-40eb99a72dcso14183315e9.1 for ; Tue, 23 Jan 2024 19:00:15 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1706065214; x=1706670014; darn=vger.kernel.org; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=CPOuKECiwusygEzLYMH/0TGCGdxpS/EWgBvieVarlTc=; b=EgXtL6lyP/SnIbHjYdglYO8uOyygJM53ibpBl4MZkwObBHC2PtuLMpGSlpA9XNLzgd W7e4yi0T97LzPhnEH1MsyQrbJvA/aAxWmgZDkDT3OMiFPgRvv0L4ncIHIRgvHbtogXZO 6eO6ROPsOw3jobbsXO1vgQpJf9qtUPDr6vC+E89YiFZr/3hiimOc8Ly8VpiUmWCMUftE Q1BIekkQIDsN3hkaGak2EYgGeu0ArE46Ncig35dEp0H8tkWR4kWE1vAtLRYQhU0QRVRP ONbZlqd5wl0gORT6Ka8s/KxQ4CahqwZTpQ1BBvmp6wIvD3AZMbMwjEdzrdeBqIzkXlIA 91DA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1706065214; x=1706670014; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=CPOuKECiwusygEzLYMH/0TGCGdxpS/EWgBvieVarlTc=; b=O/oDRg1W8YBWqE5sELz16D5ZiVUlhxLRzVRorvmXQEzhTThuSZahrAIlwh0HNeyWZM rzDes0Ew/uoIUkeg6soVPU+/4Qi70mRW8wr8/LRyIswZ8CTX8x/EZKj3cIKiBWQUYRAy dShXeOvJsLw3peOO1sfJFLweoIw99ZzdgLgPlTD6b4I3y6vgq1H6rgC0/S2f+mm3GLz7 pnaJniEh6rQHXk7FIqiAMs7DiDMyaXZVB6aBrjPjrFcZn7kFXnmy8fbDMKZGoLgLd7TO xf7R4A8RzoCE2RHrENJtgnwwYEcVEHg/8IzxY8xRnzjaQ6qBlsLmFuY6/fsaKshfdUwt bIqQ== X-Gm-Message-State: AOJu0YzEpeFWaeqhtytWVIAwi2fBz7dOyBuVnfHaRebecHAc3pXS1DVZ 4SGzBaqsX3LbCJuU/cLd8lzb4y0GTwYnxW8TApieTOHcGmdhnCH+ X-Google-Smtp-Source: AGHT+IH9nwxT639jdbbzp4/DS6PQHGpdpzVCBa61wucVXmalZ7SmRPk+J63hGBQfS46wwyrTbkMVXQ== X-Received: by 2002:a05:600c:45c9:b0:40e:6238:e9e8 with SMTP id s9-20020a05600c45c900b0040e6238e9e8mr642304wmo.1.1706065214435; Tue, 23 Jan 2024 19:00:14 -0800 (PST) Received: from mosaic.enunes.eu (ip-78-45-66-209.bb.vodafone.cz. [78.45.66.209]) by smtp.gmail.com with ESMTPSA id dj17-20020a05640231b100b00559bb146ecbsm9637914edb.6.2024.01.23.19.00.13 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 23 Jan 2024 19:00:13 -0800 (PST) From: Erico Nunes To: Qiang Yu , anarsoul@gmail.com, christian.koenig@amd.com, dri-devel@lists.freedesktop.org, lima@lists.freedesktop.org Cc: Maarten Lankhorst , Maxime Ripard , Thomas Zimmermann , David Airlie , Daniel Vetter , Sumit Semwal , linux-kernel@vger.kernel.org, Erico Nunes Subject: [PATCH v2 6/8] drm/lima: remove guilty drm_sched context handling Date: Wed, 24 Jan 2024 03:59:45 +0100 Message-ID: <20240124025947.2110659-7-nunes.erico@gmail.com> X-Mailer: git-send-email 2.43.0 In-Reply-To: <20240124025947.2110659-1-nunes.erico@gmail.com> References: <20240124025947.2110659-1-nunes.erico@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="utf-8" Content-Transfer-Encoding: quoted-printable Marking the context as guilty currently only makes the application which hits a single timeout problem to stop its rendering context entirely. All jobs submitted later are dropped from the guilty context. Lima runs on fairly underpowered hardware for modern standards and it is not entirely unreasonable that a rendering job may time out occasionally due to high system load or too demanding application stack. In this case it would be generally preferred to report the error but try to keep the application going. Other similar embedded GPU drivers don't make use of the guilty context flag. Now that there are reliability improvements to the lima timeout recovery handling, drop the guilty contexts to let the application keep running in this case. Signed-off-by: Erico Nunes Acked-by: Christian K=C3=B6nig Reviewed-by: Vasily Khoruzhick --- drivers/gpu/drm/lima/lima_ctx.c | 2 +- drivers/gpu/drm/lima/lima_ctx.h | 1 - drivers/gpu/drm/lima/lima_sched.c | 5 ++--- drivers/gpu/drm/lima/lima_sched.h | 3 +-- 4 files changed, 4 insertions(+), 7 deletions(-) diff --git a/drivers/gpu/drm/lima/lima_ctx.c b/drivers/gpu/drm/lima/lima_ct= x.c index 8389f2d7d021..0e668fc1e0f9 100644 --- a/drivers/gpu/drm/lima/lima_ctx.c +++ b/drivers/gpu/drm/lima/lima_ctx.c @@ -19,7 +19,7 @@ int lima_ctx_create(struct lima_device *dev, struct lima_= ctx_mgr *mgr, u32 *id) kref_init(&ctx->refcnt); =20 for (i =3D 0; i < lima_pipe_num; i++) { - err =3D lima_sched_context_init(dev->pipe + i, ctx->context + i, &ctx->g= uilty); + err =3D lima_sched_context_init(dev->pipe + i, ctx->context + i); if (err) goto err_out0; } diff --git a/drivers/gpu/drm/lima/lima_ctx.h b/drivers/gpu/drm/lima/lima_ct= x.h index 74e2be09090f..5b1063ce968b 100644 --- a/drivers/gpu/drm/lima/lima_ctx.h +++ b/drivers/gpu/drm/lima/lima_ctx.h @@ -13,7 +13,6 @@ struct lima_ctx { struct kref refcnt; struct lima_device *dev; struct lima_sched_context context[lima_pipe_num]; - atomic_t guilty; =20 /* debug info */ char pname[TASK_COMM_LEN]; diff --git a/drivers/gpu/drm/lima/lima_sched.c b/drivers/gpu/drm/lima/lima_= sched.c index 814428564637..c2e78605e43e 100644 --- a/drivers/gpu/drm/lima/lima_sched.c +++ b/drivers/gpu/drm/lima/lima_sched.c @@ -154,13 +154,12 @@ void lima_sched_task_fini(struct lima_sched_task *tas= k) } =20 int lima_sched_context_init(struct lima_sched_pipe *pipe, - struct lima_sched_context *context, - atomic_t *guilty) + struct lima_sched_context *context) { struct drm_gpu_scheduler *sched =3D &pipe->base; =20 return drm_sched_entity_init(&context->base, DRM_SCHED_PRIORITY_NORMAL, - &sched, 1, guilty); + &sched, 1, NULL); } =20 void lima_sched_context_fini(struct lima_sched_pipe *pipe, diff --git a/drivers/gpu/drm/lima/lima_sched.h b/drivers/gpu/drm/lima/lima_= sched.h index 6a11764d87b3..6bd4f3b70109 100644 --- a/drivers/gpu/drm/lima/lima_sched.h +++ b/drivers/gpu/drm/lima/lima_sched.h @@ -91,8 +91,7 @@ int lima_sched_task_init(struct lima_sched_task *task, void lima_sched_task_fini(struct lima_sched_task *task); =20 int lima_sched_context_init(struct lima_sched_pipe *pipe, - struct lima_sched_context *context, - atomic_t *guilty); + struct lima_sched_context *context); void lima_sched_context_fini(struct lima_sched_pipe *pipe, struct lima_sched_context *context); struct dma_fence *lima_sched_context_queue_task(struct lima_sched_task *ta= sk); --=20 2.43.0 From nobody Tue Dec 16 23:43:01 2025 Received: from mail-ed1-f53.google.com (mail-ed1-f53.google.com [209.85.208.53]) (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 33D2DF50D for ; Wed, 24 Jan 2024 03:00:17 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.208.53 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1706065218; cv=none; b=jY8io438dhqq5jSLoynNymfFVM/5ZbkwijseZQMB/9k8WONp3jpeHA2hjDpJhfRRypTcgE2f5MKgme7Q6WEDhYTaA9ekzQqIottiqoRE1uoVvhq8082aGK+JRtyds59glae9e8rzNOkGTkPzuGMsA56p2/JHKUG+KNxnfRbDQWM= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1706065218; c=relaxed/simple; bh=HDzhIKnDvEUadsba0NpYfaBhPDReAp3kSNvQfFXIXDc=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=AsQipdrUhjIDGbzEQWBu/M+ZtDui177kX3/xRtBGuoj2vWPwD6YMVb1FZViuvWpQrmAdaT4n3WNgdcIhSI3SHoUO/3mj5L0hKvchhXKMA9x1kCCB6DsmItjp6RjKF69YWTFTAc5nfDarp6UFY6sv3Ae2xnz0TF3SmXxGZ7nkYto= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=gmail.com; spf=pass smtp.mailfrom=gmail.com; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b=jhsC9YGB; arc=none smtp.client-ip=209.85.208.53 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=gmail.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=gmail.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b="jhsC9YGB" Received: by mail-ed1-f53.google.com with SMTP id 4fb4d7f45d1cf-55a8fd60af0so4172947a12.1 for ; Tue, 23 Jan 2024 19:00:16 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1706065215; x=1706670015; darn=vger.kernel.org; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=gUjnB5UXcV+HhJdRxnmUySO0sKgHXE4jTknvXI2h7ds=; b=jhsC9YGBg2AfPeyHWmKQamMTsMcOZaKGKM85BXI9o6Up/vT4iSkyF9p42Hb+CDuTiT 39BUzyDms6lX6MRFzeOAKdbUEQO4W7OYQWDMG/DyR04tp8koqzj3wN3I0ugSjEx2uR+7 EN86gEqhhr4LS97xk0AqMr0itU3+HC1iL5MN/vFYsc+9y2bhxal4l/O4bEetzjAGxIib 3jABMwjQiCJOXAGQnC5TLdzz0eq5liWwErVXQDN7HHfmvvywA0lTX0nOw8KBP10FE1Pf 3TVfaMKXwwhqxp3U/BzDkHV9qhnt/2y02ZV78i9myeh7BFds7Dv+MZ2yS2AF6HWXzVZl Fmdw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1706065215; x=1706670015; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=gUjnB5UXcV+HhJdRxnmUySO0sKgHXE4jTknvXI2h7ds=; b=LehKr9O39sRSv0KBiC6d1D6Nb4xKminFDLhaaWYERDyMG3JRFKwmV68Ba7eEkaim/T ij7R2lB1zV7yyeIWCV9NUL2JxUuyGqg8Ki9GFVfV0AXPMFH3TZAF+aNupQgJczDbNpBG leDUA49Thbmm/lPtTt8XcJKZTn4CnZdSta7mr1+1K4PTQ9Uw67PogXn/y0QaevBrFHSE SP9zNSIn6nq5ZYHe+noidZMmirLfQ+/SC7femKes7Gp/MGe49Ow+iC4ZyQGsPm459mMn HqMCY9lNYsUdtaUSdiRVwTJfYcoKRv1Y8MEbwT5wMGPoaqC4kotpcRZBlwOX9Lh4oSN4 xicg== X-Gm-Message-State: AOJu0YxMQqkV9w+YEW7+1d2PTxRXb0hX0EqVJKxHa3Sc2bt6XIU4+7jO +8sTYsEm69RVUoosCI7+fyXVe8zOu6ADGgWgHPACfjeAmpvMNVAx/2ec/ujxG6Y= X-Google-Smtp-Source: AGHT+IHg5LrHSVYVuCNSXsc0+hEAvO6xwpPVT8afKP9CgCtUEsSJwOjoz5XuLPsY9rpygEFUeDJYEw== X-Received: by 2002:a05:6402:358c:b0:55c:74f2:44de with SMTP id y12-20020a056402358c00b0055c74f244demr846902edc.108.1706065215429; Tue, 23 Jan 2024 19:00:15 -0800 (PST) Received: from mosaic.enunes.eu (ip-78-45-66-209.bb.vodafone.cz. [78.45.66.209]) by smtp.gmail.com with ESMTPSA id dj17-20020a05640231b100b00559bb146ecbsm9637914edb.6.2024.01.23.19.00.14 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 23 Jan 2024 19:00:14 -0800 (PST) From: Erico Nunes To: Qiang Yu , anarsoul@gmail.com, christian.koenig@amd.com, dri-devel@lists.freedesktop.org, lima@lists.freedesktop.org Cc: Maarten Lankhorst , Maxime Ripard , Thomas Zimmermann , David Airlie , Daniel Vetter , Sumit Semwal , linux-kernel@vger.kernel.org, Erico Nunes Subject: [PATCH v2 7/8] drm/lima: increase default job timeout to 10s Date: Wed, 24 Jan 2024 03:59:46 +0100 Message-ID: <20240124025947.2110659-8-nunes.erico@gmail.com> X-Mailer: git-send-email 2.43.0 In-Reply-To: <20240124025947.2110659-1-nunes.erico@gmail.com> References: <20240124025947.2110659-1-nunes.erico@gmail.com> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Content-Type: text/plain; charset="utf-8" The previous 500ms default timeout was fairly optimistic and could be hit by real world applications. Many distributions targeting devices with a Mali-4xx already bumped this timeout to a higher limit. We can be generous here with a high value as 10s since this should mostly catch buggy jobs like infinite loop shaders, and these don't seem to happen very often in real applications. Signed-off-by: Erico Nunes --- drivers/gpu/drm/lima/lima_sched.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers/gpu/drm/lima/lima_sched.c b/drivers/gpu/drm/lima/lima_= sched.c index c2e78605e43e..00b19adfc888 100644 --- a/drivers/gpu/drm/lima/lima_sched.c +++ b/drivers/gpu/drm/lima/lima_sched.c @@ -505,7 +505,7 @@ static void lima_sched_recover_work(struct work_struct = *work) int lima_sched_pipe_init(struct lima_sched_pipe *pipe, const char *name) { unsigned int timeout =3D lima_sched_timeout_ms > 0 ? - lima_sched_timeout_ms : 500; + lima_sched_timeout_ms : 10000; =20 pipe->fence_context =3D dma_fence_context_alloc(1); spin_lock_init(&pipe->fence_lock); --=20 2.43.0 From nobody Tue Dec 16 23:43:01 2025 Received: from mail-ed1-f45.google.com (mail-ed1-f45.google.com [209.85.208.45]) (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 44E9EF9EB for ; Wed, 24 Jan 2024 03:00:18 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.208.45 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1706065220; cv=none; b=p/RNHESHW0XluYiMO3yaVQQmIA9sj51qiEjcqNBfPQ1VRMT9wIbCVKFrJddDJzn5gZLUZtHaaL7QTv0eylogbK+BnzHQydF+HT37KaBkMdUwBDsKWLTOyI5aPKJzLmmUaNBeCfr7nNHiqq5A0HYRnVnZeANqJLgmKy2JZSQ7/RI= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1706065220; c=relaxed/simple; bh=3BC2F6xZE6oGPR5HTxu2FCWMFh6XofuXNdXWJ+WqSHE=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=TojDI0F3mzmOpVeqJnPak3Rbgy1AQlewkYmicNboyYK6HmYaa0HbwZEyorPK3UyeOvIX9sK+Tp74ei04pNDxOqMSS5Mq9Loa95y9P4eB+4fLJ/0cDaJyxJ/D0H4L2xfKxJwIH72Aqu8OB2rR3zGxrIaEjxtfWz8+PFJnP1KkCcs= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=gmail.com; spf=pass smtp.mailfrom=gmail.com; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b=IMveMR92; arc=none smtp.client-ip=209.85.208.45 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=gmail.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=gmail.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b="IMveMR92" Received: by mail-ed1-f45.google.com with SMTP id 4fb4d7f45d1cf-559cef15db5so10611550a12.0 for ; Tue, 23 Jan 2024 19:00:17 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1706065216; x=1706670016; darn=vger.kernel.org; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=7t4g0dsSRdpeLCYs8MxmtMoFxRmps4SUlUHmKsZELwE=; b=IMveMR9239WW6q/MG9tQbZoyf1DRUPJQVE00StLK0+vi7ZVOGLDZg4ewyVEF3AB+mA 3nL+0FHPq6NhqaE+/yZwvtmnw/rGztZm9Jh0NXCr2ehppre9D4HAzQYggaclJR6BOon9 teq8aX6QaiszGsE729mH0Da1j0Aw1uD68gicok+EOM7m+A0bnFknVON9Kg6T6mIAppWr xmKJidXp4JJ3u+EmJdaYdrBRk/kQ5FI4xfC8zAvh8MDL5WItfN2NO0/mk3pwGgNM/Fij 5jrI2kqrbSogCA4pV8OrS+bk4OrSLzPhnhGxyWYplAkVDdAsT5eNXkql/TLKKTI80OFt srAg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1706065216; x=1706670016; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=7t4g0dsSRdpeLCYs8MxmtMoFxRmps4SUlUHmKsZELwE=; b=EyWoSsx7U1rPA61uc8vC5jlNIj+vKrXumgAfwldtLGEsB6dSwEM8B1sfYzVXJCZgaA 8KFaDT14OR5uxDKk0EuZO3SLOI6LDmPzZFu64Bl+oVxjFGQAcw6P+uKDsUsM+awUiv9L rIfHBjPF/bk6bY11kpbhN61Huy2LaF1RIQvpAjn3tcBN287IABmytbajw9TdbNkB1TY/ JF3oXTzj+Ww9AVEqwEgV1zpfB6jb41BNyQvVV6dicy+FD6mYvwjmlqGzDPC3XY0VpdTm kHgnCFtPT2s1/Z00cFDFFnH6/r1yx7ZyD2ifm/9s1wsgZWW2TUjY5dR3UFv0RBeNxa4N 6YwQ== X-Gm-Message-State: AOJu0Yx5y4fZIBqaBZyyXU6mDpy31dBc/A2/0DmV1golgQdV/CklueVJ RDV1JI4vLKLsgYGKjf5WpWF8w2Ed0NkPb5Qqysy7fW65P6k9/taO X-Google-Smtp-Source: AGHT+IEqm4FeloylkgEyETEhp1HlT+xVHaBlzFpBrcRgGswpJ3yK7Jf9LdlNlQ1dmrLktikKiUiZ/w== X-Received: by 2002:a50:fc04:0:b0:55c:7d37:7d9d with SMTP id i4-20020a50fc04000000b0055c7d377d9dmr481849edr.2.1706065216428; Tue, 23 Jan 2024 19:00:16 -0800 (PST) Received: from mosaic.enunes.eu (ip-78-45-66-209.bb.vodafone.cz. [78.45.66.209]) by smtp.gmail.com with ESMTPSA id dj17-20020a05640231b100b00559bb146ecbsm9637914edb.6.2024.01.23.19.00.15 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 23 Jan 2024 19:00:15 -0800 (PST) From: Erico Nunes To: Qiang Yu , anarsoul@gmail.com, christian.koenig@amd.com, dri-devel@lists.freedesktop.org, lima@lists.freedesktop.org Cc: Maarten Lankhorst , Maxime Ripard , Thomas Zimmermann , David Airlie , Daniel Vetter , Sumit Semwal , linux-kernel@vger.kernel.org, Erico Nunes Subject: [PATCH v2 8/8] drm/lima: standardize debug messages by ip name Date: Wed, 24 Jan 2024 03:59:47 +0100 Message-ID: <20240124025947.2110659-9-nunes.erico@gmail.com> X-Mailer: git-send-email 2.43.0 In-Reply-To: <20240124025947.2110659-1-nunes.erico@gmail.com> References: <20240124025947.2110659-1-nunes.erico@gmail.com> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Content-Type: text/plain; charset="utf-8" Some debug messages carried the ip name, or included "lima", or included both the ip name and then the numbered ip name again. Make the messages more consistent by always looking up and showing the ip name first. Signed-off-by: Erico Nunes --- drivers/gpu/drm/lima/lima_gp.c | 20 +++++++++++--------- drivers/gpu/drm/lima/lima_l2_cache.c | 6 ++++-- drivers/gpu/drm/lima/lima_mmu.c | 18 +++++++++--------- drivers/gpu/drm/lima/lima_pmu.c | 3 ++- drivers/gpu/drm/lima/lima_pp.c | 19 ++++++++++--------- 5 files changed, 36 insertions(+), 30 deletions(-) diff --git a/drivers/gpu/drm/lima/lima_gp.c b/drivers/gpu/drm/lima/lima_gp.c index 4355fa7b17f4..6b354e2fb61d 100644 --- a/drivers/gpu/drm/lima/lima_gp.c +++ b/drivers/gpu/drm/lima/lima_gp.c @@ -34,11 +34,11 @@ static irqreturn_t lima_gp_irq_handler(int irq, void *d= ata) if (state & LIMA_GP_IRQ_MASK_ERROR) { if ((state & LIMA_GP_IRQ_MASK_ERROR) =3D=3D LIMA_GP_IRQ_PLBU_OUT_OF_MEM) { - dev_dbg(dev->dev, "gp out of heap irq status=3D%x\n", - status); + dev_dbg(dev->dev, "%s out of heap irq status=3D%x\n", + lima_ip_name(ip), status); } else { - dev_err(dev->dev, "gp error irq state=3D%x status=3D%x\n", - state, status); + dev_err(dev->dev, "%s error irq state=3D%x status=3D%x\n", + lima_ip_name(ip), state, status); if (task) task->recoverable =3D false; } @@ -89,7 +89,8 @@ static int lima_gp_soft_reset_async_wait(struct lima_ip *= ip) v & LIMA_GP_IRQ_RESET_COMPLETED, 0, 100); if (err) { - dev_err(dev->dev, "gp soft reset time out\n"); + dev_err(dev->dev, "%s soft reset time out\n", + lima_ip_name(ip)); return err; } =20 @@ -194,7 +195,7 @@ static int lima_gp_hard_reset(struct lima_ip *ip) gp_write(LIMA_GP_CMD, LIMA_GP_CMD_RESET); ret =3D lima_poll_timeout(ip, lima_gp_hard_reset_poll, 10, 100); if (ret) { - dev_err(dev->dev, "gp hard reset timeout\n"); + dev_err(dev->dev, "%s hard reset timeout\n", lima_ip_name(ip)); return ret; } =20 @@ -220,8 +221,9 @@ static void lima_gp_task_error(struct lima_sched_pipe *= pipe) { struct lima_ip *ip =3D pipe->processor[0]; =20 - dev_err(ip->dev->dev, "gp task error int_state=3D%x status=3D%x\n", - gp_read(LIMA_GP_INT_STAT), gp_read(LIMA_GP_STATUS)); + dev_err(ip->dev->dev, "%s task error int_state=3D%x status=3D%x\n", + lima_ip_name(ip), gp_read(LIMA_GP_INT_STAT), + gp_read(LIMA_GP_STATUS)); =20 lima_gp_hard_reset(ip); } @@ -324,7 +326,7 @@ int lima_gp_init(struct lima_ip *ip) err =3D devm_request_irq(dev->dev, ip->irq, lima_gp_irq_handler, IRQF_SHARED, lima_ip_name(ip), ip); if (err) { - dev_err(dev->dev, "gp %s fail to request irq\n", + dev_err(dev->dev, "%s fail to request irq\n", lima_ip_name(ip)); return err; } diff --git a/drivers/gpu/drm/lima/lima_l2_cache.c b/drivers/gpu/drm/lima/li= ma_l2_cache.c index c4080a02957b..184106ce55f8 100644 --- a/drivers/gpu/drm/lima/lima_l2_cache.c +++ b/drivers/gpu/drm/lima/lima_l2_cache.c @@ -21,7 +21,8 @@ static int lima_l2_cache_wait_idle(struct lima_ip *ip) !(v & LIMA_L2_CACHE_STATUS_COMMAND_BUSY), 0, 1000); if (err) { - dev_err(dev->dev, "l2 cache wait command timeout\n"); + dev_err(dev->dev, "%s wait command timeout\n", + lima_ip_name(ip)); return err; } return 0; @@ -83,7 +84,8 @@ int lima_l2_cache_init(struct lima_ip *ip) spin_lock_init(&ip->data.lock); =20 size =3D l2_cache_read(LIMA_L2_CACHE_SIZE); - dev_info(dev->dev, "l2 cache %uK, %u-way, %ubyte cache line, %ubit extern= al bus\n", + dev_info(dev->dev, "%s %uK, %u-way, %ubyte cache line, %ubit external bus= \n", + lima_ip_name(ip), 1 << (((size >> 16) & 0xff) - 10), 1 << ((size >> 8) & 0xff), 1 << (size & 0xff), diff --git a/drivers/gpu/drm/lima/lima_mmu.c b/drivers/gpu/drm/lima/lima_mm= u.c index a1ae6c252dc2..e18317c5ca8c 100644 --- a/drivers/gpu/drm/lima/lima_mmu.c +++ b/drivers/gpu/drm/lima/lima_mmu.c @@ -22,7 +22,8 @@ cond, 0, 100); \ if (__ret) \ dev_err(dev->dev, \ - "mmu command %x timeout\n", cmd); \ + "%s command %x timeout\n", \ + lima_ip_name(ip), cmd); \ __ret; \ }) =20 @@ -40,14 +41,13 @@ static irqreturn_t lima_mmu_irq_handler(int irq, void *= data) if (status & LIMA_MMU_INT_PAGE_FAULT) { u32 fault =3D mmu_read(LIMA_MMU_PAGE_FAULT_ADDR); =20 - dev_err(dev->dev, "mmu page fault at 0x%x from bus id %d of type %s on %= s\n", - fault, LIMA_MMU_STATUS_BUS_ID(status), - status & LIMA_MMU_STATUS_PAGE_FAULT_IS_WRITE ? "write" : "read", - lima_ip_name(ip)); + dev_err(dev->dev, "%s page fault at 0x%x from bus id %d of type %s\n", + lima_ip_name(ip), fault, LIMA_MMU_STATUS_BUS_ID(status), + status & LIMA_MMU_STATUS_PAGE_FAULT_IS_WRITE ? "write" : "read"); } =20 if (status & LIMA_MMU_INT_READ_BUS_ERROR) - dev_err(dev->dev, "mmu %s irq bus error\n", lima_ip_name(ip)); + dev_err(dev->dev, "%s irq bus error\n", lima_ip_name(ip)); =20 /* mask all interrupts before resume */ mmu_write(LIMA_MMU_INT_MASK, 0); @@ -102,14 +102,14 @@ int lima_mmu_init(struct lima_ip *ip) =20 mmu_write(LIMA_MMU_DTE_ADDR, 0xCAFEBABE); if (mmu_read(LIMA_MMU_DTE_ADDR) !=3D 0xCAFEB000) { - dev_err(dev->dev, "mmu %s dte write test fail\n", lima_ip_name(ip)); + dev_err(dev->dev, "%s dte write test fail\n", lima_ip_name(ip)); return -EIO; } =20 err =3D devm_request_irq(dev->dev, ip->irq, lima_mmu_irq_handler, IRQF_SHARED, lima_ip_name(ip), ip); if (err) { - dev_err(dev->dev, "mmu %s fail to request irq\n", lima_ip_name(ip)); + dev_err(dev->dev, "%s fail to request irq\n", lima_ip_name(ip)); return err; } =20 @@ -152,7 +152,7 @@ void lima_mmu_page_fault_resume(struct lima_ip *ip) u32 v; =20 if (status & LIMA_MMU_STATUS_PAGE_FAULT_ACTIVE) { - dev_info(dev->dev, "mmu resume\n"); + dev_info(dev->dev, "%s resume\n", lima_ip_name(ip)); =20 mmu_write(LIMA_MMU_INT_MASK, 0); mmu_write(LIMA_MMU_DTE_ADDR, 0xCAFEBABE); diff --git a/drivers/gpu/drm/lima/lima_pmu.c b/drivers/gpu/drm/lima/lima_pm= u.c index e397e1146e96..113cb9b215cd 100644 --- a/drivers/gpu/drm/lima/lima_pmu.c +++ b/drivers/gpu/drm/lima/lima_pmu.c @@ -21,7 +21,8 @@ static int lima_pmu_wait_cmd(struct lima_ip *ip) v, v & LIMA_PMU_INT_CMD_MASK, 100, 100000); if (err) { - dev_err(dev->dev, "timeout wait pmu cmd\n"); + dev_err(dev->dev, "%s timeout wait pmu cmd\n", + lima_ip_name(ip)); return err; } =20 diff --git a/drivers/gpu/drm/lima/lima_pp.c b/drivers/gpu/drm/lima/lima_pp.c index ac097dd75072..d0d2db0ef1ce 100644 --- a/drivers/gpu/drm/lima/lima_pp.c +++ b/drivers/gpu/drm/lima/lima_pp.c @@ -26,8 +26,8 @@ static void lima_pp_handle_irq(struct lima_ip *ip, u32 st= ate) if (state & LIMA_PP_IRQ_MASK_ERROR) { u32 status =3D pp_read(LIMA_PP_STATUS); =20 - dev_err(dev->dev, "pp error irq state=3D%x status=3D%x\n", - state, status); + dev_err(dev->dev, "%s error irq state=3D%x status=3D%x\n", + lima_ip_name(ip), state, status); =20 pipe->error =3D true; =20 @@ -125,7 +125,7 @@ static int lima_pp_soft_reset_async_wait_one(struct lim= a_ip *ip) =20 ret =3D lima_poll_timeout(ip, lima_pp_soft_reset_poll, 0, 100); if (ret) { - dev_err(dev->dev, "pp %s reset time out\n", lima_ip_name(ip)); + dev_err(dev->dev, "%s reset time out\n", lima_ip_name(ip)); return ret; } =20 @@ -190,14 +190,14 @@ static int lima_pp_hard_reset(struct lima_ip *ip) pp_write(LIMA_PP_CTRL, LIMA_PP_CTRL_STOP_BUS); ret =3D lima_poll_timeout(ip, lima_pp_bus_stop_poll, 10, 100); if (ret) { - dev_err(dev->dev, "pp %s bus stop timeout\n", lima_ip_name(ip)); + dev_err(dev->dev, "%s bus stop timeout\n", lima_ip_name(ip)); return ret; } =20 pp_write(LIMA_PP_CTRL, LIMA_PP_CTRL_FORCE_RESET); ret =3D lima_poll_timeout(ip, lima_pp_hard_reset_poll, 10, 100); if (ret) { - dev_err(dev->dev, "pp hard reset timeout\n"); + dev_err(dev->dev, "%s hard reset timeout\n", lima_ip_name(ip)); return ret; } =20 @@ -274,7 +274,7 @@ int lima_pp_init(struct lima_ip *ip) err =3D devm_request_irq(dev->dev, ip->irq, lima_pp_irq_handler, IRQF_SHARED, lima_ip_name(ip), ip); if (err) { - dev_err(dev->dev, "pp %s fail to request irq\n", + dev_err(dev->dev, "%s fail to request irq\n", lima_ip_name(ip)); return err; } @@ -309,7 +309,7 @@ int lima_pp_bcast_init(struct lima_ip *ip) err =3D devm_request_irq(dev->dev, ip->irq, lima_pp_bcast_irq_handler, IRQF_SHARED, lima_ip_name(ip), ip); if (err) { - dev_err(dev->dev, "pp %s fail to request irq\n", + dev_err(dev->dev, "%s fail to request irq\n", lima_ip_name(ip)); return err; } @@ -423,8 +423,9 @@ static void lima_pp_task_error(struct lima_sched_pipe *= pipe) for (i =3D 0; i < pipe->num_processor; i++) { struct lima_ip *ip =3D pipe->processor[i]; =20 - dev_err(ip->dev->dev, "pp task error %d int_state=3D%x status=3D%x\n", - i, pp_read(LIMA_PP_INT_STATUS), pp_read(LIMA_PP_STATUS)); + dev_err(ip->dev->dev, "%s task error %d int_state=3D%x status=3D%x\n", + lima_ip_name(ip), i, pp_read(LIMA_PP_INT_STATUS), + pp_read(LIMA_PP_STATUS)); =20 lima_pp_hard_reset(ip); } --=20 2.43.0