From nobody Thu Dec 18 20:21:03 2025 Received: from mail-pg1-f172.google.com (mail-pg1-f172.google.com [209.85.215.172]) (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 BAAA22165EF for ; Thu, 19 Dec 2024 05:37:41 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.215.172 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1734586664; cv=none; b=gL6NVIzAMujvppqmWrrG//57dCAB1Pnz1C4k8tdspdCgsDdvG29nDEMiV6BPpYWxYmxru6i9RVtglPQpGLZB5lMbOjlfCeomqfl++gA9D4Op78/0mauXGhXMbW3L0miN6DeGrjUt8Zd5eCkpbDWYG+TZnVAX3SpF7HbNKOrcngk= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1734586664; c=relaxed/simple; bh=dMFCoKl8j4FH/8eXlAGGgiy7+lrqgUrPx0Dr/aA22A4=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=AOC8f8ZiMoHhdDe6CVp7qX8+5VqIVcByOXY48Vgb+xVF1C6qbY/PN7CdaOcfseEv1Yraj+MinJP2EfzOuzKegWULd+5rZxFZFHeABTwdnYj0vQgbsJHWcA+Yd0nZjOPiWqgbR8gF2cRtlNaTk54S/rk1UYJwKFevEpIt4ervhPs= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=chromium.org; spf=pass smtp.mailfrom=chromium.org; dkim=pass (1024-bit key) header.d=chromium.org header.i=@chromium.org header.b=TXsXHTEZ; arc=none smtp.client-ip=209.85.215.172 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=chromium.org Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=chromium.org Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=chromium.org header.i=@chromium.org header.b="TXsXHTEZ" Received: by mail-pg1-f172.google.com with SMTP id 41be03b00d2f7-7fd526d4d9eso212350a12.2 for ; Wed, 18 Dec 2024 21:37:41 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=chromium.org; s=google; t=1734586661; x=1735191461; 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=5Wn3NJnLnCIIAi7YjcEiBCUAPAzdJ5Obb2vhkb7cmKA=; b=TXsXHTEZz+8i8rlCA6mEodWfZgp7sekmG6yUql24RbmXIgWQ8PNMVpyPAEkouV16XM fCc0JgwHvWfcyy9uQj2Fw9rNNTSZ3vwZufvR+apV9z58U3GvnjwgeRzyek48BG0zjoa5 8LvBBDcR9lv2v+byxz/ZlF4tPwJl/By0R54lo= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1734586661; x=1735191461; 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=5Wn3NJnLnCIIAi7YjcEiBCUAPAzdJ5Obb2vhkb7cmKA=; b=t4zLo7F3lCQ1bC0Fvvncav4p0V8l6rKflC1qHmiqkFBCXJTQ27ybJlnCAmyQCx++4T J+jIlnZJmacaVHth2HUDHPdq/a5yB264ZQDhpClxUE3DAiDEqo3ZmknVPABwmSJG6aIT 0txmmKWdh90RdPKEJWDoS1k4YMOa2JvwgSO8CdsnXaBV2bwGzvJds4jNk3ATNtAJ8hjH M6x+iKPHFbzYyEdZIGIc8eHXr/BUzQXzR38ZFbry6CRSGyg0blNcdncb16l5c1mfNL+x +iLIjc1w8kPP9mIejaPKwb2AXABtmaqSAlcpDUpGjWHETCz8r9iT7yHtOYvHi/rxgl0D DtGQ== X-Forwarded-Encrypted: i=1; AJvYcCVWTenjlwYxodo3kXISWxtY1kqtcvrt80kZMJtqUdPKsAGlrHUhexymMwclxj3JK/jkUajag+2b7JMe+vo=@vger.kernel.org X-Gm-Message-State: AOJu0YwlHIqSheF07OIbzLD1433o3XJyjsfPlZtiml6aRlmqnE89lYxD thXLjD00f1yBzpyq9vZFwsa5CQ93Y4SGDpJQeeiz6ON87fE6DDxO39q1NskyYA== X-Gm-Gg: ASbGncshGr8LsCs2O/r0R4jRCNl8/6lPtgceLMe9sa3SKPZFXpJ1PXf9/lm8bJhkB7o MQhrQYMbE8O/fcNhXCPVKl6FDBH1ULD9o7yikQiIyu2tQ4VMLvLmf+Pf2rL4xteNNSj7T4dvoPC TGREmgZgnBhJNJP/HpFX+26YWVoewdC2dEzFbK7kkw+LSjZuzmN9dT/bw8894OaGdwqMlO8UC/g PcvmTzunBegry3a9fl9Q+HfazZzBpYQsxxWNzBM3OheS6uMKx/lDoBRhJM= X-Google-Smtp-Source: AGHT+IEdvG+uasdZ1W4PcxNqxIKk8BfTf425UpPmgcIcIOiA1ibN8Q8K9PclAPCzYtQpJKJ0kK7ElQ== X-Received: by 2002:a17:90b:1b48:b0:2ee:c9b6:c267 with SMTP id 98e67ed59e1d1-2f2e91e1183mr8717990a91.9.1734586661136; Wed, 18 Dec 2024 21:37:41 -0800 (PST) Received: from localhost ([2401:fa00:8f:203:5479:11c3:e91d:de6b]) by smtp.gmail.com with UTF8SMTPSA id 98e67ed59e1d1-2f4478ac7dbsm444615a91.50.2024.12.18.21.37.38 (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Wed, 18 Dec 2024 21:37:40 -0800 (PST) From: Sergey Senozhatsky To: Stanimir Varbanov , Vikash Garodia , "Bryan O'Donoghue" Cc: Hans Verkuil , linux-media@vger.kernel.org, linux-arm-msm@vger.kernel.org, linux-kernel@vger.kernel.org, Sergey Senozhatsky , stable@vger.kernel.org Subject: [PATCHv2] media: venc: destroy hfi session after m2m_ctx release Date: Thu, 19 Dec 2024 14:37:08 +0900 Message-ID: <20241219053734.588145-1-senozhatsky@chromium.org> X-Mailer: git-send-email 2.47.1.613.gc27f4b7a9f-goog In-Reply-To: <20241219033345.559196-1-senozhatsky@chromium.org> References: <20241219033345.559196-1-senozhatsky@chromium.org> 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 partially reverts commit that made hfi_session_destroy() the first step of vdec/venc close(). The reason being is a regression report when, supposedly, encode/decoder is closed with still active streaming (no ->stop_streaming() call before close()) and pending pkts, so isr_thread cannot find instance and fails to process those pending pkts. This was the idea behind the original patch - make it impossible to use instance under destruction, because this is racy, but apparently there are uses cases that depend on that unsafe pattern. Return to the old (unsafe) behaviour for the time being (until a better fix is found). Fixes: 45b1a1b348ec ("media: venus: sync with threaded IRQ during inst dest= ruction") Cc: stable@vger.kernel.org Signed-off-by: Sergey Senozhatsky Reported-by and Closes tags (for now you can post them in a reply to --- drivers/media/platform/qcom/venus/core.c | 8 ++------ 1 file changed, 2 insertions(+), 6 deletions(-) diff --git a/drivers/media/platform/qcom/venus/core.c b/drivers/media/platf= orm/qcom/venus/core.c index 2d27c5167246..807487a1f536 100644 --- a/drivers/media/platform/qcom/venus/core.c +++ b/drivers/media/platform/qcom/venus/core.c @@ -506,18 +506,14 @@ static __maybe_unused int venus_runtime_suspend(struc= t device *dev) void venus_close_common(struct venus_inst *inst) { /* - * First, remove the inst from the ->instances list, so that - * to_instance() will return NULL. - */ - hfi_session_destroy(inst); - /* - * Second, make sure we don't have IRQ/IRQ-thread currently running + * Make sure we don't have IRQ/IRQ-thread currently running * or pending execution, which would race with the inst destruction. */ synchronize_irq(inst->core->irq); =20 v4l2_m2m_ctx_release(inst->m2m_ctx); v4l2_m2m_release(inst->m2m_dev); + hfi_session_destroy(inst); v4l2_fh_del(&inst->fh); v4l2_fh_exit(&inst->fh); v4l2_ctrl_handler_free(&inst->ctrl_handler); --=20 2.47.1.613.gc27f4b7a9f-goog