From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-0.8 required=3.0 tests=DKIMWL_WL_HIGH,DKIM_SIGNED, DKIM_VALID,HEADER_FROM_DIFFERENT_DOMAINS,MAILING_LIST_MULTI,SPF_HELO_NONE, SPF_PASS,URIBL_BLOCKED autolearn=no autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 97DE3C433DF for ; Wed, 3 Jun 2020 09:42:05 +0000 (UTC) Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.133]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id 68CD32065C for ; Wed, 3 Jun 2020 09:42:05 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (2048-bit key) header.d=lists.infradead.org header.i=@lists.infradead.org header.b="kQQyPBkI" DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 68CD32065C Authentication-Results: mail.kernel.org; dmarc=none (p=none dis=none) header.from=arm.com Authentication-Results: mail.kernel.org; spf=none smtp.mailfrom=linux-arm-kernel-bounces+infradead-linux-arm-kernel=archiver.kernel.org@lists.infradead.org DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20170209; h=Sender: Content-Transfer-Encoding:Content-Type:Cc:List-Subscribe:List-Help:List-Post: List-Archive:List-Unsubscribe:List-Id:MIME-Version:Message-ID:Date: In-reply-to:Subject:To:From:References:Reply-To:Content-ID: Content-Description:Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc :Resent-Message-ID:List-Owner; bh=JETbl2OM9kCY/gj1gIpEE5cooXncUURDhkg8kGn/vB4=; b=kQQyPBkIgDKgGn2oMjsJztzUqm GCwuR8gDaHBAEHm8yB/SlkJlbhr+wDfrCe/ECYYqFxBExhct57U3hkz/YIdWk8fr/RBhlghrbVF9Y F5FOfpX232MJZTuB6cMQEZpT1hj4wuxM8KIKso8hD+vYPbRv4gUydJ+EnO0euqWOmddMpFgN5ing9 5mNDZ4bvCATolDbufuGAi4wwc05Ed5QscJrM68BMVw8OckenfIvwA+L3hKxFqN7I1qKWKY3VHz9S4 Ti/0okwyoJ9AoAHlChq0t257+sBMAgcqR3lD9jtOyY10lVfojglIzeJruHb0eeDBIJzuygyYABVdn fRQn1Qdg==; Received: from localhost ([127.0.0.1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.92.3 #3 (Red Hat Linux)) id 1jgPuI-0000rR-O3; Wed, 03 Jun 2020 09:41:58 +0000 Received: from foss.arm.com ([217.140.110.172]) by bombadil.infradead.org with esmtp (Exim 4.92.3 #3 (Red Hat Linux)) id 1jgPuF-0000jR-Ep for linux-arm-kernel@lists.infradead.org; Wed, 03 Jun 2020 09:41:56 +0000 Received: from usa-sjc-imap-foss1.foss.arm.com (unknown [10.121.207.14]) by usa-sjc-mx-foss1.foss.arm.com (Postfix) with ESMTP id 9DFD431B; Wed, 3 Jun 2020 02:41:52 -0700 (PDT) Received: from e113632-lin (e113632-lin.cambridge.arm.com [10.1.194.46]) by usa-sjc-imap-foss1.foss.arm.com (Postfix) with ESMTPSA id 0A3F93F305; Wed, 3 Jun 2020 02:41:50 -0700 (PDT) References: <20200527151613.16083-1-benjamin.gaignard@st.com> <1b0ace18-e7f8-0b75-f6fe-968a269626b0@st.com> User-agent: mu4e 0.9.17; emacs 26.3 From: Valentin Schneider To: Vincent Guittot Subject: Re: [PATCH] media: stm32-dcmi: Set minimum cpufreq requirement In-reply-to: Date: Wed, 03 Jun 2020 10:41:41 +0100 Message-ID: MIME-Version: 1.0 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20200603_024155_539883_E4C59CF2 X-CRM114-Status: GOOD ( 16.25 ) X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Benjamin GAIGNARD , "rjw@rjwysocki.net" , "linux-kernel@vger.kernel.org" , Alexandre TORGUE , "mcoquelin.stm32@gmail.com" , Hugues FRUCHET , "mchehab@kernel.org" , "linux-stm32@st-md-mailman.stormreply.com" , "linux-arm-kernel@lists.infradead.org" , "linux-media@vger.kernel.org" Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+infradead-linux-arm-kernel=archiver.kernel.org@lists.infradead.org On 03/06/20 08:50, Vincent Guittot wrote: > On Wed, 3 Jun 2020 at 09:34, Benjamin GAIGNARD wrote: >> On 6/2/20 3:35 PM, Valentin Schneider wrote: >> > AFAIA streaming_start() is not necessarily executing on the same CPU as the >> > one that will handle the interrupt. I was thinking you could use the IRQ's >> > effective affinity as a hint of which CPU(s) to boost, i.e. something like: >> > >> > --- >> > struct cpumask_var_t visited; >> > struct irq_data *d = irq_get_irq_data(irq); >> > >> > err = alloc_cpumask_var(visited, GFP_KERNEL); >> > /* ... */ >> > for_each_cpu(cpu, irq_data_get_effective_affinity_mask(d)) { >> > /* check if not already spanned */ >> > if (cpumask_test_cpu(cpu, visited)) >> > continue; >> > >> > policy = cpufreq_cpu_get(cpu); >> > cpumask_or(visited, visited, policy->cpus); >> > /* do the boost for that policy here */ >> > /* ... */ >> > cpufreq_cpu_put(policy); >> > } >> > --- >> > >> > That of course falls apart when hotplug gets involved, and the effective >> > affinity changes... There's irq_set_affinity_notifier() out there, but it >> > seems it's only about the affinity, not the effective_affinity, I'm not >> > sure how valid it would be to query the effective_affinity in that >> > notifier. >> If I wait to be in the irq it will be too late so I think I will do a >> loop over all possible CPUs >> before start the streaming to change the policies. > Yes, that's what I was thinking as well. > Can't you use irq_get_affinity_mask and loop over it ? > In the end that's the only usable option, I think. I was looking at alternatives because on arm64 (and AFAICT that applies to arm too; see irq-gic.c::gic_set_affinity()) the affinity mask spans all CPUs by default, while the effective affinity mask spans only the CPU that will actually handle the IRQ (+ where its thread should run). That said, using the effective mask that way does feel like an implementation leak. Sadly I couldn't find any better way to minimize the number of boosted frequency domains. > Also You should better use freq_qos_add/remove_request during probe > and remove of the driver and use freq_qos_update_request in > dcmi_start/stop_streaming to set/unset your constraint. > _______________________________________________ linux-arm-kernel mailing list linux-arm-kernel@lists.infradead.org http://lists.infradead.org/mailman/listinfo/linux-arm-kernel