From mboxrd@z Thu Jan 1 00:00:00 1970 From: "Dan Magenheimer" Subject: RE: "cpus" config parameter broken? Date: Thu, 10 Jan 2008 15:40:11 -0700 Message-ID: <20080110154011921.00000003216@djm-pc> References: Reply-To: "dan.magenheimer@oracle.com" Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Transfer-Encoding: quoted-printable Return-path: In-Reply-To: List-Unsubscribe: , List-Post: List-Help: List-Subscribe: , Sender: xen-devel-bounces@lists.xensource.com Errors-To: xen-devel-bounces@lists.xensource.com To: Keir Fraser , Ian Pratt , "xen-devel@lists.xensource.com" List-Id: xen-devel@lists.xenproject.org > >>> - the v->cpu_affinity mask should never have bits set for > >> > >> This is already the case. > > > > No, with the cpus parameter, it is currently possible to > > set bits in v->cpu_affinity mask for processors that don't > > exist. > = > Ah yes. But then the offline CPUs get masked out in = > vcpu_set_affinity(), and > the affinity mask is then rejected if the remaining CPU set is empty. I see you are correct that the v->cpu_affinity bits never do get set. But the mask is not rejected -- but instead some bits are silently ignored -- if there are both online and offline cpus in the list. So: cpus=3D"0,3" on a 2p machine will currently set only one bit (bit 0) on a 2p but xm vcpu-pin domid all "0,3" will set two bits. Whereas cpus=3D"2-3" will cause an error on a 2p but xm vcpu-pin domid all "2-3" will not. This would become relevant if the "cpus" parameter were preserved across a migration (rather than v->cpu_affinity), which is what led to my original confusion. So modulo-izing the cpus parameter code will eliminate this case, but I still wonder if vcpu_set_affinity should reject any mask that has bits set beyond max_pcpu instead of silently ignoring those bits. Seems like an accident waiting to happen and indeed I got bitten by it. Which is why I proposed tightening the definition of all affinity masks (and strings representing masks) to "if you try to enable a bit in the cpumask that refers to a non-existent processor, you will get an error" Thanks, Dan