[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [PATCH 2/2][4.15?] x86: fix build when NR_CPUS == 1


  • To: Jan Beulich <jbeulich@xxxxxxxx>
  • From: Roger Pau Monné <roger.pau@xxxxxxxxxx>
  • Date: Tue, 2 Mar 2021 11:57:46 +0100
  • Arc-authentication-results: i=1; mx.microsoft.com 1; spf=pass smtp.mailfrom=citrix.com; dmarc=pass action=none header.from=citrix.com; dkim=pass header.d=citrix.com; arc=none
  • Arc-message-signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector9901; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=a4b9FBabi2Zvy5ESdh9529MReJHNaekB3PL7uFvPI3g=; b=X5aP70ckAgOrStnFuZ6v8MMOV+/M7LsIYX7RvPV+JbrAA0Zmx/F9DPa/40PcooLli0TWhRaIk0v3uWk8XQSfq6zKhUvCMFrfPticj07g0LlToqNs/foT3m1nFhEEuYrcH99dSFXx0TTSVc7qKnmbiLAyCz8GqoTnv9z9y1UbkFnQdEzfhl/zkJrtJRL7UurD+Vz4lf3lj8E/2+cj42gLezcbUAVjdjsD1p5TeH4qobsEI33CSMNJ3Om/GFQejUYHChy4mNgdFPlBfF+hXGYQgGfX9LbukG2v6FiI8v8yv4BF3B1aCe7p5772/EYS8G68wuslQDSRseIn4lwdMkr+IQ==
  • Arc-seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=NdSt8j6TH/uOCGYw9ayQuhBopBnH6/wS+IuH/gtbbJXEzAP5camwJhq5eWP5PEdeMqAdv02NFV6XHLwGs8oCH48i2KekKJHonjgpIb3nt/i8mJnOBsliQ5MZi7mxf7fB5jE0ul4H5cCnVgoXdD4o2Elb6R+A8ymDBZhJsizYUA/zU6uJ0sI1aPBOGNlKurH7E+dPRnn3mJH9xBIJCduVQ8nfUY1dZ2aHuT3mosYfBNjWtxSn2Ty5+s5hv0czbTTEx87YTdAd98f70DAW/orAxz7UhYqUBHRITQZ5jZpM50cUMV9BkpqhiANAN3xwaFYZ2a1pqDh6ryi6XDFZL7S1zA==
  • Authentication-results: esa2.hc3370-68.iphmx.com; dkim=pass (signature verified) header.i=@citrix.onmicrosoft.com
  • Cc: "xen-devel@xxxxxxxxxxxxxxxxxxxx" <xen-devel@xxxxxxxxxxxxxxxxxxxx>, Andrew Cooper <andrew.cooper3@xxxxxxxxxx>, Wei Liu <wl@xxxxxxx>, George Dunlap <george.dunlap@xxxxxxxxxx>, Ian Jackson <iwj@xxxxxxxxxxxxxx>
  • Delivery-date: Tue, 02 Mar 2021 10:58:16 +0000
  • Ironport-sdr: ZdLZAyCGI0nirchg8rANmjWaj8RCAyPNC1em6vHuqC1kDut7l6BbvRqnA9lsyrye3WGhUEmzpU aNCvpNTAPo6EZ6fZuGkm67/XM79/k+I9uhbSdKF5DjQ7oorOOYiAYWxs9ADUpzWzmcOfP1p/lB lrXLrRe6Wj9bSLlgQALBgVPaa9TTpoHy+3bAVN1joQXAcmCtdCRHQ849jjlUrdfJiNe4PUIWjo ZVjX++R4WiQ6FJt3cqwWd6UOfSXwIRfB6sYue5hQOdvBCzhUYmbXAJV1J5XtJteaEC6A8N9KNS bXQ=
  • List-id: Xen developer discussion <xen-devel.lists.xenproject.org>

On Tue, Mar 02, 2021 at 10:59:37AM +0100, Jan Beulich wrote:
> On 01.03.2021 19:00, Roger Pau Monné wrote:
> > On Mon, Mar 01, 2021 at 04:14:26PM +0100, Jan Beulich wrote:
> >> On 01.03.2021 15:01, Roger Pau Monné wrote:
> >>> On Mon, Mar 01, 2021 at 09:31:07AM +0100, Jan Beulich wrote:
> >>>> In this case the compiler is recognizing that no valid array indexes
> >>>> remain (in x2apic_cluster()'s access to per_cpu(cpu_2_logical_apicid,
> >>>> ...)), but oddly enough isn't really consistent about the checking it
> >>>> does (see the code comment).
> >>>
> >>> I assume this is because of the underlying per_cpu access to
> >>> __per_cpu_offset using cpu as the index, in which case wouldn't it be
> >>> better to place the BUG_ON there?
> >>
> >> Not sure, to be honest. It seemed more logical to me to place it
> >> next to where the issue is.
> > 
> > I'm not sure whether I would prefer to place it in per_cpu directly to
> > avoid similar issues popping up in other parts of the code in the
> > future?
> 
> That's going to be a lot of BUG_ON(), and hence a lot of "ud2"
> instances. Not something I'm keen on having. The more that it's
> not the per_cpu() which triggers the warning, but separate
> conditionals allowing the compiler to deduce value ranges of
> variables.

Right. I don't see much other way around this then. Did you check with
clang also?

Acked-by: Roger Pau Monné <roger.pau@xxxxxxxxxx>

Thanks, Roger.



 


Rackspace

Lists.xenproject.org is hosted with RackSpace, monitoring our
servers 24x7x365 and backed by RackSpace's Fanatical Support®.