Received: by 2002:ac0:a594:0:0:0:0:0 with SMTP id m20-v6csp1424433imm; Tue, 22 May 2018 04:00:54 -0700 (PDT) X-Google-Smtp-Source: AB8JxZq7r5n22CVJbIssA4p49qnHKgA0wPfjzW2dKht6Xq6PjVe+SsTqp5N0p1NxI3vohGIVKUYq X-Received: by 2002:a62:211c:: with SMTP id h28-v6mr23077541pfh.249.1526986854723; Tue, 22 May 2018 04:00:54 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1526986854; cv=none; d=google.com; s=arc-20160816; b=ZFqdYKp003vrkfCLe+ZRpe/2jvdObUPUno7uS+d/YyVgTcPgela+EDKEDrv0h5olvg yXiDLxw+2DCTFe6M6hWysvw36ksaUI/Lt3y0dkwLHILliMqb0+gyAHnDgL1R707Ml2tk WdclOyuw6jjlzr5eCQxAahkFHsJXSf9w/2+wU6+ULHYh9oWL93/tDe/3Xroi9l07dHUZ 0+EaP/+bY1zrNXbaVzcLkxVLCE7Y058BKwlxBBG67OOhE7vXdCk2PO7ex02Yu2f1pG81 r5FQWr2uOABrlHqxjPGe0/9hL9K7/FbfobxnpBaRX91nI0YrimCKWAmWm72kwtSyZV8Q WPFA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:user-agent:in-reply-to :content-disposition:mime-version:references:message-id:subject:cc :to:from:date:dkim-signature:arc-authentication-results; bh=XA0YlJ5Rf3D19kAKXymc1Uv4XWvmY+QysY+ehg1+Uc8=; b=CU5G86o45KV7OIxH3TMJOPYz4ZT0U8XArHP5EgqZ+sQCj8+bBXaZspLSqkPH/UlnpL SJffFNdTjP22+m8RxroHAMo0dTKnq1qwjbpoBGSGm6ktBSPIWFtRMxBRJsUTb/lWcZ8g EI8Zd3dL1xfp9nX8QW3Gwaolrbeu4xdWlbG5bHsUh8phA+ATnExvzRd/uRCPtrlkCs9t hwQo7l1Zz8HCb2wbkHZvyMs+8j7us+fppUHAT7lRSJJNSaI+pN0ewRZZPtyQf9SMR584 5mt7HSbDFwii1xD3FBJP09r86tYZGJMSILHn70/xZxFjHh4F3q7GRNsqEsWiAo7QLTPl /Xnw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=HD8wc5L5; 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 v15-v6si12634956pgq.292.2018.05.22.04.00.37; Tue, 22 May 2018 04:00:53 -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=HD8wc5L5; 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 S1751633AbeEVK4f (ORCPT + 99 others); Tue, 22 May 2018 06:56:35 -0400 Received: from mail-pf0-f194.google.com ([209.85.192.194]:37506 "EHLO mail-pf0-f194.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751579AbeEVK42 (ORCPT ); Tue, 22 May 2018 06:56:28 -0400 Received: by mail-pf0-f194.google.com with SMTP id e9-v6so8599793pfi.4 for ; Tue, 22 May 2018 03:56:28 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=date:from:to:cc:subject:message-id:references:mime-version :content-disposition:in-reply-to:user-agent; bh=XA0YlJ5Rf3D19kAKXymc1Uv4XWvmY+QysY+ehg1+Uc8=; b=HD8wc5L5ESIHtOiQ68iNRHzRLZ1lY+yj9Iuh4yV9Kjci9awl77SUcG0dPnzr0G4qG5 BnzeNtHsm0B+JIU0C9T9opYYRqSeXXeCq0tw8FzlniB6NwFYle7upjGvRsMgNteYQgae PrSU/NdZxTdlNWE04E8ejPT1aO5FxrHwFuGVM= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:date:from:to:cc:subject:message-id:references :mime-version:content-disposition:in-reply-to:user-agent; bh=XA0YlJ5Rf3D19kAKXymc1Uv4XWvmY+QysY+ehg1+Uc8=; b=VHa+M7kPXs/cz3TJDCwnaECrNzDeczuugpRHHvPzsrkCV3YQZYLgmIKWHind3voYUV qQqIRKdy5MjOPs07DYFqS+Ixc3IN3IpA8+6RQjd7+2NI89UKQ8fWF2h2ByfWIXRq4vgW bYvKZLWgQoEcpPOyoY2ad+REXI3an8DMz3YEmoscy4nP5P5VicAJYbx84VJLVS+8kBUN aWlfiQjxEf8gsEPuVojcU3CNBi1Qi2/oIq/4iuXX+WmDbVprynON2o6sztPNrmA7Nu/V Zg9kQDcJ3VG2bZM9OzBDNViRWLQ2zy0bPsPtqGkGNps3Hs/3UjxGHfjl1GCuHLZxmlIR EfDA== X-Gm-Message-State: ALKqPwcGOcvuRvQb/8fmn1qKeyo5R6vvO4HLZIFeBVOGf8AjZtUuPYgv 8S50VVKMvJYoYxfTuRAW8ERSag== X-Received: by 2002:a63:b54b:: with SMTP id u11-v6mr18645208pgo.365.1526986587246; Tue, 22 May 2018 03:56:27 -0700 (PDT) Received: from localhost ([122.167.163.112]) by smtp.gmail.com with ESMTPSA id a195-v6sm34418967pfa.143.2018.05.22.03.56.26 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Tue, 22 May 2018 03:56:26 -0700 (PDT) Date: Tue, 22 May 2018 16:26:24 +0530 From: Viresh Kumar To: Patrick Bellasi Cc: "Joel Fernandes (Google.)" , linux-kernel@vger.kernel.org, "Joel Fernandes (Google)" , "Rafael J . Wysocki" , Peter Zijlstra , Ingo Molnar , Juri Lelli , Luca Abeni , Todd Kjos , claudio@evidence.eu.com, kernel-team@android.com, linux-pm@vger.kernel.org Subject: Re: [PATCH v2] schedutil: Allow cpufreq requests to be made even when kthread kicked Message-ID: <20180522105624.ttd6isx7c2ylgzqy@vireshk-i7> References: <20180518185501.173552-1-joel@joelfernandes.org> <20180522103415.cuutobi5kbhj4gcw@vireshk-i7> <20180522105157.GX30654@e110439-lin> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20180522105157.GX30654@e110439-lin> User-Agent: NeoMutt/20180323-120-3dd1ac Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On 22-05-18, 11:51, Patrick Bellasi wrote: > It could happen, but using: > > raw_spin_lock_irqsave(&sg_policy->update_lock, flags); > freq = READ_ONCE(sg_policy->next_freq) > WRITE_ONCE(sg_policy->work_in_progress, false); > raw_spin_unlock_irqrestore(&sg_policy->update_lock, flags); > > if (!READ_ONCE(sg_policy->work_in_progress)) { > WRITE_ONCE(sg_policy->work_in_progress, true); > irq_work_queue(&sg_policy->irq_work); > } I think its better to get locking in place for non-fast switching case in single-policy systems right now. > should fix it by enforcing the ordering as well as documenting the > concurrent access. > > However, in the "sched update" side, where do we have the sequence: > > sg_policy->next_freq = 0; > sg_policy->next_freq = real-next-freq; Ah, that was just an example of what a compiler may do (though it shouldn't do). -- viresh