Received: by 2002:a25:ad19:0:0:0:0:0 with SMTP id y25csp1057217ybi; Wed, 17 Jul 2019 08:54:37 -0700 (PDT) X-Google-Smtp-Source: APXvYqwUNgYNd+hyskuoLiuv9HbDDrCW47NOv5vtUbikAzzIV7BDAPgdHQUjcZgR6hhMS+7uilXn X-Received: by 2002:a17:902:2b8a:: with SMTP id l10mr43835429plb.283.1563378877002; Wed, 17 Jul 2019 08:54:37 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1563378876; cv=none; d=google.com; s=arc-20160816; b=XMGLG9gO4qzt1lq6NLHBo+iZi3pPMBIt/yv9JQws/rOxCoNeQ188DhrsxAg6jY0AHI 8UyaxE3BRa2ofwSocRt9b6ki4/hjDGtZA92UMg7sKH+ja2GBPVzXnQ5h6fGMrxbgbA4n T3mv7ZK0XVa/fB466KbAKLC5K+8AECL3e46uA243jjFCTmyjMRiLAol9lHas0R7faieJ jTTi5OQ/kgAvceVRYq2QkwwEQLqjUC2qUH20EG5YuF1gYy8fcNcOFvsUkM2mIqSkPI0L hvJ1lndDKL3LI4Z8K1GQmbDTOMlxXekIGj6aI50jM+l3Y80yKm/utHKhu2SnDFAPJ3TI Qilg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:content-transfer-encoding :content-language:in-reply-to:mime-version:user-agent:date :message-id:from:references:cc:to:subject:dkim-signature; bh=3jbOpJGViEoMZ/z1uklXsD0i54r1S51I050v7ZKNFBk=; b=Rlt4O7N+P2gPQyPniOQOYA81feW6I2LMuG5/gRjifrJMfjDO7BxHjdwiYUA8rEdpjo dpuUASHJtw6mT2LXobK56Vb7N96gjCDh2xIbVFYy/oMudIkIKNSy9cphwnBQtZt8Sm/4 uwQAt3AlRkQSLvLLSuUu4UxhSbljebNowS7cJzwcPRDJQDlu93hUB6mGelNQ2iDx829j XjfAyRbGRYc7aQZA53g8+72ZKkh52neoTloiRvPUnA0QYgMNhcKNzZ/gjRI6yz5jv5Xs 0i8xWA3iuOjqIDspki7fky+ltTJHD42dVH4Yk+AyGjzCuBdWVTvTz96AnlojZr0xC2sK pmQw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=q5qzlnCI; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-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. [209.132.180.67]) by mx.google.com with ESMTP id b35si17247321plb.249.2019.07.17.08.54.20; Wed, 17 Jul 2019 08:54:36 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=q5qzlnCI; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-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 S1727138AbfGQPni (ORCPT + 99 others); Wed, 17 Jul 2019 11:43:38 -0400 Received: from mail-lj1-f196.google.com ([209.85.208.196]:41475 "EHLO mail-lj1-f196.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726063AbfGQPnh (ORCPT ); Wed, 17 Jul 2019 11:43:37 -0400 Received: by mail-lj1-f196.google.com with SMTP id d24so24109314ljg.8 for ; Wed, 17 Jul 2019 08:43:36 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=subject:to:cc:references:from:message-id:date:user-agent :mime-version:in-reply-to:content-language:content-transfer-encoding; bh=3jbOpJGViEoMZ/z1uklXsD0i54r1S51I050v7ZKNFBk=; b=q5qzlnCIimWC3UjOSITeeOXZCWpKBXlqKRVFQtULyVwTJBMXe291radTFmBCIOilo2 rdufUMyO5g6sAT8Hny4/l/4T3ClB9Ox0fRDYQXzp+22fH24Xy/LfnWjZDlZOvtZx+s6t TdaZ9T6zjMZSU//SZ4bpGc37NhFZv/gpXGsZerE1y5w12nSA9savGldFQhS/x1c3DKM5 q2DEO2JT52mEPuNlJwMtQNpepUdYfiytpmtMazVZ+7m9Hx23a7wioBqqEh6C57wftVfs oBxa4smkhe+cX+SXaTHhdRrm7gDnWqscQGkgAOM7YrCK5dJ//s0hNZZCKNloaYU9Eh6G MeCw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:subject:to:cc:references:from:message-id:date :user-agent:mime-version:in-reply-to:content-language :content-transfer-encoding; bh=3jbOpJGViEoMZ/z1uklXsD0i54r1S51I050v7ZKNFBk=; b=sdnc5gt+62MRApOkR20XNArM4/fowioVvJ4TMxPMJp8LWPRnovQHV2kCxAj9126CpX +9rU7AJxH6r9Pns+Dzdf/0hk2k1/ogntl7MghSs3bZQS+lJkZtn35ZApT8W4VJYKvLYP cEo4mPRQtOUtBPjZ193X+KjvMFQCkypTb0FuzJGmhiiSRGb+6csO5yulic5svD4ickCZ geXA7hBeGOX8MWAlcU/g1//OgIIO0UL1Wsa5DtH1Ypkq3jmRReTcBDwnyQ92QlZX6afW hh9RTHl7ejdUeRBfnnAKbgVnet4AEIJkUBxRd9GU0/Ll/yw+FGYRqNT118abmWvWb2Mw fxog== X-Gm-Message-State: APjAAAVrERcJeN9H3yfHJ00kIXdctlZum/I24hKH6gg2UxG5Xkf+7524 GoV6/GhLzElktaqEw7pek0Q7RA== X-Received: by 2002:a2e:800c:: with SMTP id j12mr21250044ljg.22.1563378215666; Wed, 17 Jul 2019 08:43:35 -0700 (PDT) Received: from [192.168.28.181] ([37.157.136.206]) by smtp.googlemail.com with ESMTPSA id g5sm4578700ljj.69.2019.07.17.08.43.34 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Wed, 17 Jul 2019 08:43:34 -0700 (PDT) Subject: Re: [PATCH v5 4/4] media: venus: Update core selection To: Aniket Masule , linux-media@vger.kernel.org Cc: linux-kernel@vger.kernel.org, linux-arm-msm@vger.kernel.org, vgarodia@codeaurora.org References: <1563253754-12003-1-git-send-email-amasule@codeaurora.org> <1563253754-12003-5-git-send-email-amasule@codeaurora.org> From: Stanimir Varbanov Message-ID: Date: Wed, 17 Jul 2019 18:43:31 +0300 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:60.0) Gecko/20100101 Thunderbird/60.7.2 MIME-Version: 1.0 In-Reply-To: <1563253754-12003-5-git-send-email-amasule@codeaurora.org> Content-Type: text/plain; charset=utf-8 Content-Language: en-US Content-Transfer-Encoding: 7bit Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Hi, On 7/16/19 8:09 AM, Aniket Masule wrote: > Present core assignment is static. Introduced load balancing > across the cores. Load on earch core is calculated and core > with minimum load is assigned to given instance. > > Signed-off-by: Aniket Masule > --- > drivers/media/platform/qcom/venus/helpers.c | 69 +++++++++++++++++++++++--- > drivers/media/platform/qcom/venus/helpers.h | 2 +- > drivers/media/platform/qcom/venus/hfi_helper.h | 1 + > drivers/media/platform/qcom/venus/hfi_parser.h | 5 ++ > drivers/media/platform/qcom/venus/vdec.c | 2 +- > drivers/media/platform/qcom/venus/venc.c | 2 +- > 6 files changed, 72 insertions(+), 9 deletions(-) > > diff --git a/drivers/media/platform/qcom/venus/helpers.c b/drivers/media/platform/qcom/venus/helpers.c > index edf403d..d479793 100644 > --- a/drivers/media/platform/qcom/venus/helpers.c > +++ b/drivers/media/platform/qcom/venus/helpers.c > @@ -26,6 +26,7 @@ > #include "helpers.h" > #include "hfi_helper.h" > #include "hfi_venus_io.h" > +#include "hfi_parser.h" > > struct intbuf { > struct list_head list; > @@ -331,6 +332,24 @@ static u32 load_per_instance(struct venus_inst *inst) > return mbs * inst->fps; > } > > +static u32 load_per_core(struct venus_core *core, u32 core_id) > +{ > + struct venus_inst *inst = NULL; > + u32 mbs_per_sec = 0, load = 0; > + > + mutex_lock(&core->lock); > + list_for_each_entry(inst, &core->instances, list) { > + if (inst->clk_data.core_id != core_id) > + continue; > + > + mbs_per_sec = load_per_instance(inst); > + load = mbs_per_sec * inst->clk_data.codec_freq_data->vpp_freq; shouldn't this be load += mbs_per_sec * vpp_freq ? We need to calculate load for every instance on this core_id. > + } > + mutex_unlock(&core->lock); > + > + return load; > +} > + -- regards, Stan