From nobody Thu Dec 18 20:21:41 2025 Received: from mail-pg1-f174.google.com (mail-pg1-f174.google.com [209.85.215.174]) (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 52EB7141987 for ; Thu, 19 Dec 2024 03:33:55 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.215.174 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1734579237; cv=none; b=Kr40HxUTUJVcdaFSWHg5qCvNj1lhebOCUV7S/gYirM69bzDGwNGGr9ox7VV0vyEtJC65ZTajtgu80xFke1+/5ER22M1JjYwj+Ut9yl6I4UcAuDDCvCsKImnnlZXae7fla/139xUCzOIf0TT/cYbwIskPm0/wvs5VAW0f8mn7IJw= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1734579237; c=relaxed/simple; bh=qdYu2BzMyzhgJhPqn1EdSg3rwRAPDPj53HneVzzCGaI=; h=From:To:Cc:Subject:Date:Message-ID:MIME-Version; b=KDIrLEn3tKEFi2cvS3ywAmAbXPeBG/IAsxYBLeDqRcF0D1AHbvdxePiMD7CNbl8yZSsas3OF4RQoFpvPLB6B+rzBfNyfaJL3PTOOLqJmi6eRfb+BVho8IZ6NaNKkQcCQdFPkpbIl3OQZdle/LPL9s+ay28nb8nDb0gyLAGzrnsA= 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=KxecruQX; arc=none smtp.client-ip=209.85.215.174 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="KxecruQX" Received: by mail-pg1-f174.google.com with SMTP id 41be03b00d2f7-7fd4998b0dbso211551a12.0 for ; Wed, 18 Dec 2024 19:33:55 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=chromium.org; s=google; t=1734579234; x=1735184034; darn=vger.kernel.org; h=content-transfer-encoding:mime-version:message-id:date:subject:cc :to:from:from:to:cc:subject:date:message-id:reply-to; bh=o3AwYnmz6MD7Ja4YJt8URQU0bT2UyVpGcn4xu/YwQmw=; b=KxecruQX+6HqQSDMcKNcSyHUwJWV17moFqHH1gYjX6B5Xsof9qdb/p+KKauwCVk5TF 7+MjUwfbLIS8rrbt2ErONvqEHqwm+w6GvTmXtBoBCph+RiYI5wQJfayFs9J1OERnFtcF 4zKAv9v1Hx0BLOgBo56xllplwtBhTWgg75t1w= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1734579234; x=1735184034; h=content-transfer-encoding:mime-version:message-id:date:subject:cc :to:from:x-gm-message-state:from:to:cc:subject:date:message-id :reply-to; bh=o3AwYnmz6MD7Ja4YJt8URQU0bT2UyVpGcn4xu/YwQmw=; b=WVlCWEibWtt7julWEkoWZbsM7/g+HLe7Skq6rIGSnmEDzigyvyZ3LGOkDrhwKje1wA DRdKByz8dTx/oR4xxoi76dCpQN+3duAIW8yWx8MqlXsvb74sUUyrQYWlbBoT9jBdU52H WVfKvvDMjV2ZGUrvAdydn8j0pfAPzyCQhxbMJzJUMKpI8aIpA60B1E9gZFEFJx7WdYFg BwzioX5a/BwMDi6pNPMRszdXjiTfytq4byraf34XmxKRmDA26SZ5qMbtv5VgGTnS+eEr 2PtnRQYOBc3/tLZXr+drjCuELvjJ+cc/6piAAR6knaOoJfvqaL42a3TQucd3pYq9X7xl Sl5g== X-Forwarded-Encrypted: i=1; AJvYcCXqfqvItuuxRNLIfWPktnVzJ1U2LQ9jU4GhCZBom5i1dwLTCZAo8MGMRN7IAcU5zODah0x9XVK/Ui4obzE=@vger.kernel.org X-Gm-Message-State: AOJu0Yyt8J3MfaUUf64RJyQM76SzVL6bCJKqynJuWBViDyofAQim8hTJ kM1ff0l89spHm47TF0v7ldW/fJ612/fqXBc93r5BK5nPWBT7uZ7+gI2RWb7s2A== X-Gm-Gg: ASbGncthDPklaHiDZVRWEYKCqcQBFgk5qRBnrisQNkRGKH1P5OpU+8Le+qRB+G9geb8 hraTOepYADPdqHkrQpKSsdKfi5X1jEanoEYX00gDPl/zfly7IWG2dhOltDxT6ItjCOnTw3ilZT1 xD0gtfJkC0EuPlFNTc30d+9ZYVx8DhN6emNPZz4zzME/CMr6akDxIdHp7JV6n7lDK+MmionQwrL 2oTe06hhB6Ot8i9nJxgewR6JVL04ry+IyZpA7QNCZ9hIGZjmGoVLc9idJM= X-Google-Smtp-Source: AGHT+IGqFWc3fvzI/39Qa+QVM5tyy0L+HrHcLRtJpADNMNZKdEBBWgu/m2pG1W+XhQe+ganDTFzQag== X-Received: by 2002:a17:902:e74f:b0:215:e98c:c5d9 with SMTP id d9443c01a7336-219d9671736mr23960605ad.18.1734579234562; Wed, 18 Dec 2024 19:33:54 -0800 (PST) Received: from localhost ([2401:fa00:8f:203:5479:11c3:e91d:de6b]) by smtp.gmail.com with UTF8SMTPSA id d9443c01a7336-219dca0238bsm2712795ad.251.2024.12.18.19.33.52 (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Wed, 18 Dec 2024 19:33:54 -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 Subject: [PATCH] media: venc: destroy hfi session after m2m_ctx release Date: Thu, 19 Dec 2024 12:32:56 +0900 Message-ID: <20241219033345.559196-1-senozhatsky@chromium.org> X-Mailer: git-send-email 2.47.1.613.gc27f4b7a9f-goog 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: 45b1a1b348ec1 ("media: venus: sync with threaded IRQ during inst des= truction") Signed-off-by: Sergey Senozhatsky --- 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