Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1754207AbcJEOiL (ORCPT ); Wed, 5 Oct 2016 10:38:11 -0400 Received: from Galois.linutronix.de ([146.0.238.70]:39288 "EHLO Galois.linutronix.de" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751673AbcJEOiK (ORCPT ); Wed, 5 Oct 2016 10:38:10 -0400 Date: Wed, 5 Oct 2016 16:35:38 +0200 (CEST) From: Thomas Gleixner To: Srinivas Pandruvada cc: rjw@rjwysocki.net, mingo@redhat.com, bp@suse.de, x86@kernel.org, linux-pm@vger.kernel.org, linux-kernel@vger.kernel.org, linux-acpi@vger.kernel.org, peterz@infradead.org, tim.c.chen@linux.intel.com, jolsa@redhat.com Subject: Re: [PATCH v5 5/9] x86/sysctl: Add sysctl for ITMT scheduling feature In-Reply-To: <1475322326-160112-6-git-send-email-srinivas.pandruvada@linux.intel.com> Message-ID: References: <1475322326-160112-1-git-send-email-srinivas.pandruvada@linux.intel.com> <1475322326-160112-6-git-send-email-srinivas.pandruvada@linux.intel.com> User-Agent: Alpine 2.20 (DEB 67 2015-01-07) MIME-Version: 1.0 Content-Type: text/plain; charset=US-ASCII Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Length: 1647 Lines: 66 On Sat, 1 Oct 2016, Srinivas Pandruvada wrote: > +static int sched_itmt_update_handler(struct ctl_table *table, int write, > + void __user *buffer, size_t *lenp, loff_t *ppos) > +{ > + int ret; > + unsigned int old_sysctl; > + > + mutex_lock(&itmt_update_mutex); > + > + if (!sched_itmt_capable) { > + mutex_unlock(&itmt_update_mutex); > + return 0; This should return a proper error code. > void sched_set_itmt_support(bool itmt_supported) > { > mutex_lock(&itmt_update_mutex); > > - if (itmt_supported != sched_itmt_capable) > - sched_itmt_capable = itmt_supported; > + if (itmt_supported == sched_itmt_capable) { > + mutex_unlock(&itmt_update_mutex); > + return; > + } > + sched_itmt_capable = itmt_supported; > + > + if (itmt_supported) { > + itmt_sysctl_header = > + register_sysctl_table(itmt_root_table); > + if (!itmt_sysctl_header) { > + mutex_unlock(&itmt_update_mutex); > + return; So you now have a state of capable which cannot be enabled. Whats the point? > + } > + /* > + * ITMT capability automatically enables ITMT > + * scheduling for small systems (single node). > + */ > + if (topology_num_packages() == 1) > + sysctl_sched_itmt_enabled = 1; > + } else { > + if (itmt_sysctl_header) > + unregister_sysctl_table(itmt_sysctl_header); > + } > + > + if (sysctl_sched_itmt_enabled) { > + /* disable sched_itmt if we are no longer ITMT capable */ > + if (!itmt_supported) How do you get here if itmt is not supported? > + sysctl_sched_itmt_enabled = 0; > + x86_topology_update = true; > + rebuild_sched_domains(); > + } > > mutex_unlock(&itmt_update_mutex); Thanks, tglx