Received: by 2002:a25:683:0:0:0:0:0 with SMTP id 125csp362271ybg; Wed, 3 Jun 2020 02:44:35 -0700 (PDT) X-Google-Smtp-Source: ABdhPJx4UjGEFRGmPk8sh4R8Qzk/PHNOcrrwvev3aIecT7v4KNG7lszbBv38HUqnI9IC5mINpsoH X-Received: by 2002:a17:906:39b:: with SMTP id b27mr12694788eja.421.1591177475399; Wed, 03 Jun 2020 02:44:35 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1591177475; cv=none; d=google.com; s=arc-20160816; b=rfPyqUrWBUciWA5M6ocm4r9RjmSvVJ4JMBHqwc8eVdqPb6BK0NMdOgJaBfFFEs6zQ7 YT9bG2JjGEayWwzPPPTIk9Qv6UZKvT5ZGR17gVGYQvSkjgOQ3DDN5r9GJcza01pzfHg8 6mAayKqDYD6h+rNvpljXwPeM1WePu2QAOYYgNytgYnfoDN5kiv092ijj5Oqyr2qlyJel JcvACuUMZ3tD80evhlUqOYBJ3CB/j+Nl1WqEzaLl63Y0AetQdkw27zRYqsOj8t39uTLX T8B6TcWnqVlJSajkr+hyUksChmjvseUEcZdkx14p1InHSqlXSdewryOGRQZ5UG5hZQ0v 3ctg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:mime-version:message-id:date:in-reply-to :subject:cc:to:from:user-agent:references; bh=ZogbzMBsfhnNXn/g2Sn93saMcNx2u88Y8UjQa6KwxqQ=; b=HdX8w0q1lKZuQuywNEjOonM3EHxTlV4X64XiO/KzFSAGVU5CjT/iAig2piToGW89dV rg/RgF+3oSQ0LwqskIJUsb1S36wcTOL+DxSQ0Td8wCsiL5eexWt3o0T6bXFH/ro+3G0T dJRhcfQMTmBj1Z4Z4xNexzi1VP8nt6ErUf1gLNDJISb1iU1CXv6LjALBJlvo9aRlbOy0 K8JDQDjL1QPNni6zYbyO743hP8NQ7wi5rn/qICPPFGd1ZpwOkT3wUd5HiAoiUkft27wL BMEFlE/oCVymGlJaXUj1jh0mdZVVpzXYlSsSriLVn2k73mQ/3R3gHlEe3y4jjGRoAPQt sSNQ== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id x26si812961ejc.746.2020.06.03.02.44.12; Wed, 03 Jun 2020 02:44:35 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726661AbgFCJlx (ORCPT + 99 others); Wed, 3 Jun 2020 05:41:53 -0400 Received: from foss.arm.com ([217.140.110.172]:59190 "EHLO foss.arm.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1725854AbgFCJlx (ORCPT ); Wed, 3 Jun 2020 05:41:53 -0400 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 Cc: Benjamin GAIGNARD , Hugues FRUCHET , "mchehab\@kernel.org" , "mcoquelin.stm32\@gmail.com" , Alexandre TORGUE , "linux-media\@vger.kernel.org" , "linux-stm32\@st-md-mailman.stormreply.com" , "linux-arm-kernel\@lists.infradead.org" , "linux-kernel\@vger.kernel.org" , "rjw\@rjwysocki.net" 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 Content-Type: text/plain Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.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. >