Received: by 10.213.65.68 with SMTP id h4csp3323212imn; Tue, 3 Apr 2018 02:54:38 -0700 (PDT) X-Google-Smtp-Source: AIpwx49DzG+1pOMecDs3H8K/4s6tQMAl3btPQiwKrPstL5QUe1H90NtQ8l+W1FLdtUnEGjfuD89W X-Received: by 10.99.107.196 with SMTP id g187mr141714pgc.384.1522749278772; Tue, 03 Apr 2018 02:54:38 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1522749278; cv=none; d=google.com; s=arc-20160816; b=VByq1U7WPdUKl2QGIbgLaLvRW+W33tJX6YhaKz3OjojNHa1E6E0srvLN6aJXwXCCym 0hKK+/d64hqmWp5b6S7Z6PYPCvuKCjBssK3Odz/sI7Ilz1hiIYxAva+gqDlhd3ikIrCG qu2hR1qJVPq3XAGKH8cRZK9DAt8cIs/onW+vLe+osSsusyUn1+35ZmtLxOIF9tFz+K/V ypqAexnn5TNYvfcrXjLlWw3BMDGqHZS5rCWNg64Aw4HTT02Y6B3NAy6BerfIVmcHsQQj KCZCyFtjDH+/1K801HVLTCIB0Ihum8u6dudF7CvK6drao2bvDzS2ABnNlY9gPYmtz6sz 1iMw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:mime-version:user-agent:references :message-id:in-reply-to:subject:cc:to:from:date :arc-authentication-results; bh=QKPO/Qu2+/ImGsTfr6MEScqyay5y8wPBfHuhK0Sy4x4=; b=p1he04Q4KQgMNbYr2jIY1ezsEywe+SurJ4M3tIpANDsTV/VmDidwroN471WP1ph+9r ch/byen0Bcy6G5jtfDDAkN+eIwjZW3/XoogCKv0rdRtsrGNC+BqY85hVxgxq0RDdn+Sd fjwrb4m3cPVMx9aunburArnT0/7hyZSq7qlna6EoZfibauQ+iF2Mc+DRfXq6GWyzB6y0 FlV3Xy4J8MEJK6hBgQu59d8ABgAgra/4Rw7zXdIRqMaQv0cs17AmygzP6AwY97ZoOG/l en1I2WaOoDoPPPzdM8kuBbaTlIimJhI7D5q4vFl63ngEbxv7TpBpDZy0EVD0t55z5dHi ygkg== ARC-Authentication-Results: i=1; mx.google.com; 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 Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id x24si1649071pgv.394.2018.04.03.02.54.24; Tue, 03 Apr 2018 02:54:38 -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; 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 Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1754958AbeDCJw5 (ORCPT + 99 others); Tue, 3 Apr 2018 05:52:57 -0400 Received: from Galois.linutronix.de ([146.0.238.70]:59135 "EHLO Galois.linutronix.de" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1754583AbeDCJwz (ORCPT ); Tue, 3 Apr 2018 05:52:55 -0400 Received: from hsi-kbw-5-158-153-52.hsi19.kabel-badenwuerttemberg.de ([5.158.153.52] helo=nanos.tec.linutronix.de) by Galois.linutronix.de with esmtpsa (TLS1.2:DHE_RSA_AES_256_CBC_SHA256:256) (Exim 4.80) (envelope-from ) id 1f3IcU-0005Uj-6x; Tue, 03 Apr 2018 11:52:50 +0200 Date: Tue, 3 Apr 2018 11:52:49 +0200 (CEST) From: Thomas Gleixner To: Vikas Shivappa cc: vikas.shivappa@intel.com, tony.luck@intel.com, ravi.v.shankar@intel.com, fenghua.yu@intel.com, sai.praneeth.prakhya@intel.com, x86@kernel.org, hpa@zytor.com, linux-kernel@vger.kernel.org, ak@linux.intel.com Subject: Re: [PATCH 3/6] x86/intel_rdt/mba_sc: Add initialization support In-Reply-To: <1522362376-3505-4-git-send-email-vikas.shivappa@linux.intel.com> Message-ID: References: <1522362376-3505-1-git-send-email-vikas.shivappa@linux.intel.com> <1522362376-3505-4-git-send-email-vikas.shivappa@linux.intel.com> User-Agent: Alpine 2.21 (DEB 202 2017-01-01) MIME-Version: 1.0 Content-Type: text/plain; charset=US-ASCII Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Thu, 29 Mar 2018, Vikas Shivappa wrote: > +void setup_ctrlval(struct rdt_resource *r, u32 *dc, u32 *dm) > +{ > + int i; > + > + /* > + * Initialize the Control MSRs to having no control. > + * For Cache Allocation: Set all bits in cbm > + * For Memory Allocation: Set b/w requested to 100% > + * and the b/w in MB to U32_MAX > + */ > + for (i = 0; i < r->num_closid; i++, dc++, dm++) { > + *dc = r->membw.bw_byte ? MBA_BW_MAX_MB : r->default_ctrl; > + *dm = r->default_ctrl; No! Please stop duct taping your stuff into the existing code. So far the ctrl value was the same as the value which was actually written into the MSR. With your new mode you have to split that up into the user supplied value and the value which gets written into the MSR. So the right thing to do is to separate the user value and the MSR value first and independent of the mode. Then the new mode falls into place naturally because r->default_ctrl and r->default_msrval are set up at mount time with the values which correspond to the mount mode. Thanks, tglx