From patchwork Tue May 18 15:45:06 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Stanimir Varbanov X-Patchwork-Id: 441218 Delivered-To: patch@linaro.org Received: by 2002:a02:7a1b:0:0:0:0:0 with SMTP id a27csp352156jac; Tue, 18 May 2021 08:46:29 -0700 (PDT) X-Google-Smtp-Source: ABdhPJywpi1r1v25LS4cl9LG7TwO0oBIsPdaM3dlJUaoGhU3LHMPFU9U02QxSP6GnDAVU9/MKvbk X-Received: by 2002:a05:6602:1222:: with SMTP id z2mr4550445iot.120.1621352788898; Tue, 18 May 2021 08:46:28 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1621352788; cv=none; d=google.com; s=arc-20160816; b=ip8agUErK4Vv86DTHT7YvZNeEyaIxi8+Ste0PHVvUjNqy8Z1Nb4VdkfgI7OtZ1NMg7 BrPdgdSt35t54bPD2m1L7u7aWmJ9jgaBAsn7EPWodO7BY5vq0cACn7lmRhvSPBHfafjB zPY9uZaNjcAQTOn/upWhgodmiadBd/FjsKd0rzLoonR3RKYXvLWnIIK+O61j447+mfBC i2XA4GCdHfCbL+e2rjyu2MaBkQePYAVZuaN3ypQBupikmjkodvDaClkHPYhb49MgItFe 3+gqQ2nRF75d4MROzl/netP8dDruaYzTM3l1JNe0azvEQzklHZBbgQFfxH+faHDaRTZD qACA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :references:in-reply-to:message-id:date:subject:cc:to:from :dkim-signature; bh=3eQT5w75rkSKr8V4Rzzvpp/1P0SvKsxN/0nHM1tgGJI=; b=BD1LtDmBJfgLd95pRBLbUDH0P/7WLDhvnunGY3Ru1cwNB836QAHTJVJUKPhykeehPT ZsphFY502Z060IYRNqXS2GEqz34PG0uG+nPw0p0UBlgKafTpu9EfICQMXtre0aJ/sxIf T0kbQJnnLwrVXZZfzBVhXSXcAZSgQ4BoPnYBPmQjjf6SGOJlNsfK/ahtrSd1mnOaQ972 xBGNTV8056DdzZEvlT+SAXZhSvjE2NhXYgbE5ICAqR3DySINxs6XnE1OCVjAgTKNINom cJS+sK/IZ5FJ1/Hn+rafF9x2tQ6dh13fOd8Nd2Nhzg/KlvBfgjRJrvbKI8+JpoQrkFer 1GZg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=rRhgP9UZ; spf=pass (google.com: domain of linux-arm-msm-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-arm-msm-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id v3si21970616ilq.36.2021.05.18.08.46.28; Tue, 18 May 2021 08:46:28 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-arm-msm-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=rRhgP9UZ; spf=pass (google.com: domain of linux-arm-msm-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-arm-msm-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1350312AbhERPri (ORCPT + 17 others); Tue, 18 May 2021 11:47:38 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:44444 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1350315AbhERPqs (ORCPT ); Tue, 18 May 2021 11:46:48 -0400 Received: from mail-ej1-x634.google.com (mail-ej1-x634.google.com [IPv6:2a00:1450:4864:20::634]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 1BCB3C06138A for ; Tue, 18 May 2021 08:45:27 -0700 (PDT) Received: by mail-ej1-x634.google.com with SMTP id k10so15310477ejj.8 for ; Tue, 18 May 2021 08:45:26 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=3eQT5w75rkSKr8V4Rzzvpp/1P0SvKsxN/0nHM1tgGJI=; b=rRhgP9UZQiEtb6v8BAdYyzo30YdvcIFku8IRRd3mkNvNFcE+EWF6QZTLqsz9OdbMU7 GVvvDahRMVIt3nHGMgTIfO85NVc+TZIwj2mEvs4hJxiAv1cswxOu/w0dil0C5nAcDmJm 4QS3Jzp4KbQ/P2eQPLlwfADa15l/P9Sw4WZBfHhCd4fy1CoIkuAT/B+UlloP5rTVaGSR WRv2YMGSOIQ20WwAiQ6yO2JKzb8ZCnBrjXq9XQ+f5yzKqZyaXadWauEQAL4FvBIzGUnL YGjcdJZ4d28Pt+weEaWL2rLlQsjDUNPUycz3ThX+wPIud59ceeZ5wS6mQAR81WMakib/ E0GA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=3eQT5w75rkSKr8V4Rzzvpp/1P0SvKsxN/0nHM1tgGJI=; b=Z7f0UI7FMGIab9gPzCSw/HpGmUVXh1ahM8d9YkpTFePm35MRA57q6nl5m4OPqKFLPq mDHbedTbKrfom+8U30/kYSFK8fJUkyK+YJBNHDyQCYtU9drtMijppRQmXivievtXLjv6 o2LDrWCWmXMExEdhdPNg8MzD40AtQIh4BBJcE6nWFQOSHRMRdZiejbUQ72eGTKDOy8i3 bjkzNQEs0w6L6XDK1XWsCsng/Ya9mPCAkRqxATpm0Qjrkyl0u5hddiPs0V7kQ1GSFzi6 wUHtTtMHlnytzRWRU4PGDAIX3ALQFtA7unEeY3WbVVVBoiTpHSL6iRi+qZ3KEQrG0LQ0 u0uw== X-Gm-Message-State: AOAM530pdcdvxiZcshildf+2IF2wnaBWdUDkNkcbTBcaUk2IWsug9pfO BWmGAA2g/fBlkXLsD0090YFpPw== X-Received: by 2002:a17:906:7c82:: with SMTP id w2mr6796433ejo.448.1621352725704; Tue, 18 May 2021 08:45:25 -0700 (PDT) Received: from localhost.localdomain ([195.24.90.54]) by smtp.gmail.com with ESMTPSA id n17sm13016434eds.72.2021.05.18.08.45.24 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 18 May 2021 08:45:25 -0700 (PDT) From: Stanimir Varbanov To: linux-media@vger.kernel.org, linux-arm-msm@vger.kernel.org, linux-kernel@vger.kernel.org Cc: Vikash Garodia , Mansur Alisha Shaik , Stanimir Varbanov Subject: [PATCH 2/5] venus: Make sys_error flag an atomic bitops Date: Tue, 18 May 2021 18:45:06 +0300 Message-Id: <20210518154509.602137-3-stanimir.varbanov@linaro.org> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20210518154509.602137-1-stanimir.varbanov@linaro.org> References: <20210518154509.602137-1-stanimir.varbanov@linaro.org> MIME-Version: 1.0 Precedence: bulk List-ID: X-Mailing-List: linux-arm-msm@vger.kernel.org Make the sys_error flag an atomic bitops in order to avoid locking in sys_error readers. Signed-off-by: Stanimir Varbanov --- drivers/media/platform/qcom/venus/core.c | 4 ++-- drivers/media/platform/qcom/venus/core.h | 3 ++- drivers/media/platform/qcom/venus/helpers.c | 2 +- drivers/media/platform/qcom/venus/hfi.c | 2 +- drivers/media/platform/qcom/venus/vdec.c | 2 +- 5 files changed, 7 insertions(+), 6 deletions(-) -- 2.25.1 diff --git a/drivers/media/platform/qcom/venus/core.c b/drivers/media/platform/qcom/venus/core.c index 91b15842c555..cc6195f2409c 100644 --- a/drivers/media/platform/qcom/venus/core.c +++ b/drivers/media/platform/qcom/venus/core.c @@ -65,7 +65,7 @@ static void venus_event_notify(struct venus_core *core, u32 event) } mutex_lock(&core->lock); - core->sys_error = true; + set_bit(0, &core->sys_error); list_for_each_entry(inst, &core->instances, list) inst->ops->event_notify(inst, EVT_SESSION_ERROR, NULL); mutex_unlock(&core->lock); @@ -161,7 +161,7 @@ static void venus_sys_error_handler(struct work_struct *work) dev_warn(core->dev, "system error has occurred (recovered)\n"); mutex_lock(&core->lock); - core->sys_error = false; + clear_bit(0, &core->sys_error); mutex_unlock(&core->lock); } diff --git a/drivers/media/platform/qcom/venus/core.h b/drivers/media/platform/qcom/venus/core.h index 745f226a523f..15713209cc48 100644 --- a/drivers/media/platform/qcom/venus/core.h +++ b/drivers/media/platform/qcom/venus/core.h @@ -7,6 +7,7 @@ #ifndef __VENUS_CORE_H_ #define __VENUS_CORE_H_ +#include #include #include #include @@ -182,7 +183,7 @@ struct venus_core { unsigned int state; struct completion done; unsigned int error; - bool sys_error; + unsigned long sys_error; const struct hfi_core_ops *core_ops; const struct venus_pm_ops *pm_ops; struct mutex pm_lock; diff --git a/drivers/media/platform/qcom/venus/helpers.c b/drivers/media/platform/qcom/venus/helpers.c index b813d6dba481..de87f4c81a1c 100644 --- a/drivers/media/platform/qcom/venus/helpers.c +++ b/drivers/media/platform/qcom/venus/helpers.c @@ -1478,7 +1478,7 @@ void venus_helper_vb2_stop_streaming(struct vb2_queue *q) ret |= venus_helper_intbufs_free(inst); ret |= hfi_session_deinit(inst); - if (inst->session_error || core->sys_error) + if (inst->session_error || test_bit(0, &core->sys_error)) ret = -EIO; if (ret) diff --git a/drivers/media/platform/qcom/venus/hfi.c b/drivers/media/platform/qcom/venus/hfi.c index 0f2482367e06..179b1f8b2650 100644 --- a/drivers/media/platform/qcom/venus/hfi.c +++ b/drivers/media/platform/qcom/venus/hfi.c @@ -214,7 +214,7 @@ int hfi_session_init(struct venus_inst *inst, u32 pixfmt) * session_init() can't pass successfully */ mutex_lock(&core->lock); - if (!core->ops || core->sys_error) { + if (!core->ops || test_bit(0, &inst->core->sys_error)) { mutex_unlock(&core->lock); return -EIO; } diff --git a/drivers/media/platform/qcom/venus/vdec.c b/drivers/media/platform/qcom/venus/vdec.c index ddb7cd39424e..132a2921902a 100644 --- a/drivers/media/platform/qcom/venus/vdec.c +++ b/drivers/media/platform/qcom/venus/vdec.c @@ -1211,7 +1211,7 @@ static void vdec_session_release(struct venus_inst *inst) ret = hfi_session_deinit(inst); abort = (ret && ret != -EINVAL) ? 1 : 0; - if (inst->session_error || core->sys_error) + if (inst->session_error || test_bit(0, &core->sys_error)) abort = 1; if (abort)