All of lore.kernel.org
 help / color / mirror / Atom feed
From: Chao Peng <chao.p.peng@linux.intel.com>
To: Jan Beulich <JBeulich@suse.com>
Cc: wei.liu2@citrix.com, Ian.Campbell@citrix.com,
	stefano.stabellini@eu.citrix.com, andrew.cooper3@citrix.com,
	Ian.Jackson@eu.citrix.com, xen-devel@lists.xen.org,
	will.auld@intel.com, keir@xen.org, dgdegra@tycho.nsa.gov
Subject: Re: [PATCH v7 01/14] x86: add socket_to_cpumask
Date: Tue, 19 May 2015 17:51:20 +0800	[thread overview]
Message-ID: <20150519095120.GG8239@pengc-linux.bj.intel.com> (raw)
In-Reply-To: <555B0309020000780007B722@mail.emea.novell.com>

On Tue, May 19, 2015 at 08:31:53AM +0100, Jan Beulich wrote:
> >>> On 19.05.15 at 09:10, <chao.p.peng@linux.intel.com> wrote:
> > On Tue, May 19, 2015 at 07:52:04AM +0100, Jan Beulich wrote:
> >> >>> On 19.05.15 at 08:47, <chao.p.peng@linux.intel.com> wrote:
> >> > On Tue, May 19, 2015 at 07:28:49AM +0100, Jan Beulich wrote:
> >> >> >>> On 19.05.15 at 08:12, <chao.p.peng@linux.intel.com> wrote:
> >> >> > On Mon, May 18, 2015 at 02:21:40PM +0100, Jan Beulich wrote:
> >> >> >> >>> On 08.05.15 at 10:56, <chao.p.peng@linux.intel.com> wrote:
> >> >> >> > @@ -112,6 +115,8 @@ static int __devinit MP_processor_info_x(struct 
> >> > mpc_config_processor *m,
> >> >> >> >  {
> >> >> >> >   	int ver, apicid, cpu = 0;
> >> >> >> >   	
> >> >> >> > +	total_cpus++;
> >> >> >> > +
> >> >> >> >  	if (!(m->mpc_cpuflag & CPU_ENABLED)) {
> >> >> >> >  		if (!hotplug)
> >> >> >> >  			++disabled_cpus;
> >> >> >> 
> >> >> >> Is there a reason you can't use disabled_cpus and avoid adding yet
> >> >> >> another variable?
> >> >> > 
> >> >> > The problem is not with disabled_cpus but with num_processors, which
> >> >> > does not keep the original detected cpus in current code.
> >> >> > Hence 'total_cpus = disabled_cpus + num_processors' may not be correct
> >> >> > in some cases.
> >> >> 
> >> >> Please be more specific about when this is a problem (I do note that
> >> >> I'm aware that the equation will not always hold, but during my
> >> >> inspection while reviewing your change I didn't see that this would
> >> >> ever become problematic).
> >> > 
> >> > What I really need is the original cpu count enumerated from MADT. If
> >> > not introduce total_cpus then the only way getting it AFAICS is
> >> > 'disabled_cpus + num_processors'.
> >> > 
> >> > The problem is that MP_processor_info_x() have some earlier returns
> >> > before increasing num_processors. In those cases, the cpu detected will
> >> > neither counted to disabled_cpus nor num_processors, which means
> >> > 'disabled_cpus + num_processors' is potentially small than what I need.
> >> 
> >> As said - I understand this. But you still fail to explain under what
> >> (realistic, i.e. other than someone bogusly setting NR_CPUS=1)
> >> conditions this ends up being a problem.
> > 
> > As we calculate nr_sockets with:
> > 
> > nr_sockets = total_cpus / _cpus_per_socket__
> > 
> > If the calculated total_cpus is smaller than the actual cpu count on the
> > hardware, then the nr_sockets is also potentially smaller than the
> > actual socket count on the hardware. This is not the expectation.
> 
> Sure - but you still don't say what is going to go wrong. Remember,
> when I asked you to change to the total count I gave an explicit
> example: Use of "nosmp" would have yielded a zero nr_sockets in
> the earlier code. Yet with the sum of num_processors and
> disabled_cpus this can't happen anymore afaict.

"nosmp" only has side effect on max_cpus and nr_cpu_ids, but they are
never used at all when calculating nr_sockets. So I can't see any reason
why with "num_processors + disabled_cpus" the nr_sockets would not be
zero, I think this is a bug that I should fix in nosmp case.

> Hence I'm looking
> forward to you detailing the conditions under which you would see
> an issue without introducing total_cpus.

As said before, with "num_processors + disabled_cpus" I may get a
smaller nr_sockets than the machine actually has. This is my exact
problem: I may miss enumerating some CAT-enabled sockets. While the
assumption is that I will follow your suggestion to make nr_socket >=
the socket count that the machine actually has.

Chao

  reply	other threads:[~2015-05-19  9:51 UTC|newest]

Thread overview: 48+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2015-05-08  8:56 [PATCH v7 00/14] enable Cache Allocation Technology (CAT) for VMs Chao Peng
2015-05-08  8:56 ` [PATCH v7 01/14] x86: add socket_to_cpumask Chao Peng
2015-05-18 13:21   ` Jan Beulich
2015-05-19  6:12     ` Chao Peng
2015-05-19  6:28       ` Jan Beulich
2015-05-19  6:47         ` Chao Peng
2015-05-19  6:52           ` Jan Beulich
2015-05-19  7:10             ` Chao Peng
2015-05-19  7:31               ` Jan Beulich
2015-05-19  9:51                 ` Chao Peng [this message]
2015-05-19 10:18                   ` Jan Beulich
2015-05-20  3:13                     ` Chao Peng
2015-05-20  9:00                       ` Jan Beulich
2015-05-08  8:56 ` [PATCH v7 02/14] x86: improve psr scheduling code Chao Peng
2015-05-08 10:20   ` Jan Beulich
2015-05-11  1:35     ` Chao Peng
2015-05-08  8:56 ` [PATCH v7 03/14] x86: detect and initialize Intel CAT feature Chao Peng
2015-05-18 13:33   ` Jan Beulich
2015-05-19  7:40     ` Chao Peng
2015-05-19  8:42       ` Jan Beulich
2015-05-19  8:46         ` Jan Beulich
2015-05-19  9:33         ` Chao Peng
2015-05-19 10:22           ` Jan Beulich
2015-05-20  3:21             ` Chao Peng
2015-05-20  9:06               ` Jan Beulich
2015-05-20  9:26                 ` Chao Peng
2015-05-08  8:56 ` [PATCH v7 04/14] x86: maintain COS to CBM mapping for each socket Chao Peng
2015-05-18 13:35   ` Jan Beulich
2015-05-19  7:41     ` Chao Peng
2015-05-08  8:56 ` [PATCH v7 05/14] x86: add COS information for each domain Chao Peng
2015-05-08  8:56 ` [PATCH v7 06/14] x86: expose CBM length and COS number information Chao Peng
2015-05-08  8:56 ` [PATCH v7 07/14] x86: dynamically get/set CBM for a domain Chao Peng
2015-05-14  9:19   ` Dario Faggioli
2015-05-15  1:35     ` Chao Peng
2015-05-18 13:45   ` Jan Beulich
2015-05-08  8:56 ` [PATCH v7 08/14] x86: add scheduling support for Intel CAT Chao Peng
2015-05-08  8:56 ` [PATCH v7 09/14] xsm: add CAT related xsm policies Chao Peng
2015-05-08  8:56 ` [PATCH v7 10/14] tools/libxl: minor name changes for CMT commands Chao Peng
2015-05-08  8:56 ` [PATCH v7 11/14] tools/libxl: add command to show PSR hardware info Chao Peng
2015-05-08  8:56 ` [PATCH v7 12/14] tools/libxl: introduce some socket helpers Chao Peng
2015-05-08  8:56 ` [PATCH v7 13/14] tools: add tools support for Intel CAT Chao Peng
2015-05-08 13:38   ` Ian Campbell
2015-05-08  8:56 ` [PATCH v7 14/14] docs: add xl-psr.markdown Chao Peng
2015-05-08 13:39   ` Ian Campbell
2015-05-08 13:41 ` [PATCH v7 00/14] enable Cache Allocation Technology (CAT) for VMs Ian Campbell
2015-05-08 13:48   ` Jan Beulich
2015-05-08 14:11     ` Ian Campbell
2015-05-11  1:37       ` Chao Peng

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20150519095120.GG8239@pengc-linux.bj.intel.com \
    --to=chao.p.peng@linux.intel.com \
    --cc=Ian.Campbell@citrix.com \
    --cc=Ian.Jackson@eu.citrix.com \
    --cc=JBeulich@suse.com \
    --cc=andrew.cooper3@citrix.com \
    --cc=dgdegra@tycho.nsa.gov \
    --cc=keir@xen.org \
    --cc=stefano.stabellini@eu.citrix.com \
    --cc=wei.liu2@citrix.com \
    --cc=will.auld@intel.com \
    --cc=xen-devel@lists.xen.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.