Received: by 2002:a25:ad19:0:0:0:0:0 with SMTP id y25csp4446148ybi; Mon, 15 Jul 2019 09:02:49 -0700 (PDT) X-Google-Smtp-Source: APXvYqzyc5NGlbeUJ8NcWruK/L8tRqDljxRmFaHkSTg2MYP1psrOgxhVtMBuGobGLwoE1lym8kKU X-Received: by 2002:a63:1908:: with SMTP id z8mr27037119pgl.433.1563206569789; Mon, 15 Jul 2019 09:02:49 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1563206569; cv=none; d=google.com; s=arc-20160816; b=xhDBKsApytsPEC2pInNUI+2ekO60ADGvfvMW4R7mrQFkoHitHX1zMeCWYGI/ZwjKQH 1lAcEhJDTOtUCvrp1W+ytB9g7xyDdaWJS4pLRzQDJ3ZFflhkrxg0EOp5G2VYEeIVHbOI 8+DCbw/uvhJQtNHWD15gOS79GqPhxsvU+GIk3zbaJstZTMe1EH90fCHUCAK9+JDygpEV 4/83Hu4MziFQbCArdQj7EWWu4rscBPihb8c7bhR+QXZyrV7iMI8LxHb1EHiOLq2/FavQ C/z4hZ/bzOYw5CDXg2yxFOsVb5ig08959hN67yPrKVHNHhk5SzwWCeiiUuVoz3+BKQtA CYUA== 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=jG4VdXmMyoFpVc6NE61bUixbe9slfFe01xROPhYpMig=; b=ZR0R4BCXU2hBWdEo0mrueQjfQPlnBBEKMSeJkO/Lgichib/XmO6nO3WXEVV/eEyf66 i4Q8qIQ6DdHoX3hxB4F8tEAntrmmSwTwPrTLffWzd9sbToVM4ZcJeogNylhUfSxFYmnz 1zV3bqwMzVhAmRiNd6R3q8Rt33r2DA0EUtelluM8R2duAvWF5SBKfyALqqEIeIr9Fs89 MCmUh1EQtGWMFzBOEYyjNAZ6Jg1cOMM0EMABKTZyzsfIkQwHj4M7kDN23QSM/DETS93p VwKnPP+4SjXCkXdvlujbN6wKLbiqViQJCUx7v6dbXW9oH3+fLYVxjmSWo4yjrF/vP4DK y9YQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=e5PTHPzJ; 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 a123si16964973pfd.114.2019.07.15.09.02.29; Mon, 15 Jul 2019 09:02:49 -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=e5PTHPzJ; 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 S1731252AbfGOQBB (ORCPT + 99 others); Mon, 15 Jul 2019 12:01:01 -0400 Received: from mail-lf1-f68.google.com ([209.85.167.68]:34454 "EHLO mail-lf1-f68.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1731074AbfGOQBB (ORCPT ); Mon, 15 Jul 2019 12:01:01 -0400 Received: by mail-lf1-f68.google.com with SMTP id b29so4129663lfq.1 for ; Mon, 15 Jul 2019 09:00:59 -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=jG4VdXmMyoFpVc6NE61bUixbe9slfFe01xROPhYpMig=; b=e5PTHPzJ994GNrOlaHnu48Kx8anQPqPS+EE773SxOJVUZ/SYAuvGcwf8gdsTmOC+uW 6pQdRNNPUSnorHQJeyfyIJ4SQyRQhrT6N6HVWQoa8NYljURxsNcAUd8rnlkJVPsT2V7Y adM/O1IBhBvTw/kJxUc+/sHbrAaqXuqtvDRI8UN74N1+AGDrUiecIXZRqsVY02GuP9Sm Gbe67YjBkXNaTkWph3pf7vm01CpMn4DNnOHYqwbW1A9mA5NXdpI9RWf0GAxjuoDNKh4V npdUlFUBKhNyUms2UrEFu+XvmGG3ySH5mCdHydaDo07riYRjgGalP3VlGFU5edXYrKbi Ibrg== 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=jG4VdXmMyoFpVc6NE61bUixbe9slfFe01xROPhYpMig=; b=g6y1JSleVInE4O/ytg5+hep4DlwzMeI7Gk6lswR+5OLsplimQl9ohcKYjh2w7WYAhd ojUhr33sIp6isWUiuPnbnBUDJgTVBdJ5Wx7ICUbu5hOYf2pwFYWgtBrBdG5kNEE8je1g 1iSd0ew5rWNqVIpvkoqrEkncvav2dt4TT7Oo/tjqaaguH4KjWjzn76cWXAON+TeFixFj JCplkTNwI0IwAQajreT6fhxySy0WUYpkbkAET2sLBKUipl84KALWSplKqEjNT9MfMAY+ T4kqJcTP15U22FU9IgPHiRt0MJOUHu6fANl191CZ/Pt01jaMKP4uIihL8z3Csq4mzybJ 29mw== X-Gm-Message-State: APjAAAVcSbSr3u37rNS3q831CvWZrWCpgSufBml2Y0kGxzfeilg+78Ia rzS9vwox78f/2nXkUIvlAoSdvA== X-Received: by 2002:ac2:5b49:: with SMTP id i9mr11725604lfp.116.1563206458930; Mon, 15 Jul 2019 09:00:58 -0700 (PDT) Received: from [192.168.27.209] ([37.157.136.206]) by smtp.googlemail.com with ESMTPSA id w1sm2408001lfe.50.2019.07.15.09.00.57 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Mon, 15 Jul 2019 09:00:58 -0700 (PDT) Subject: Re: [PATCH v4 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: <1562078787-516-1-git-send-email-amasule@codeaurora.org> <1562078787-516-5-git-send-email-amasule@codeaurora.org> From: Stanimir Varbanov Message-ID: <66c52577-fae8-9b3d-ec1d-886b97897729@linaro.org> Date: Mon, 15 Jul 2019 19:00:57 +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: <1562078787-516-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/2/19 5:46 PM, 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 5726d86..321e9f7 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)) if (inst->clk_data.core_id != core_id) I guess will be more readable? > + continue; > + > + mbs_per_sec = load_per_instance(inst); > + load = mbs_per_sec * inst->clk_data.codec_freq_data->vpp_freq; > + } > + mutex_unlock(&core->lock); > + > + return load; > +} > + -- regards, Stan