From owner-freebsd-arch@FreeBSD.ORG Tue Aug 12 22:17:28 2014 Return-Path: Delivered-To: freebsd-arch@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [8.8.178.115]) (using TLSv1 with cipher ADH-AES256-SHA (256/256 bits)) (No client certificate requested) by hub.freebsd.org (Postfix) with ESMTPS id 636D75A6; Tue, 12 Aug 2014 22:17:28 +0000 (UTC) Received: from mail-qg0-x235.google.com (mail-qg0-x235.google.com [IPv6:2607:f8b0:400d:c04::235]) (using TLSv1 with cipher ECDHE-RSA-RC4-SHA (128/128 bits)) (Client CN "smtp.gmail.com", Issuer "Google Internet Authority G2" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 14F0B2B71; Tue, 12 Aug 2014 22:17:28 +0000 (UTC) Received: by mail-qg0-f53.google.com with SMTP id q107so10346317qgd.12 for ; Tue, 12 Aug 2014 15:17:27 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=mime-version:in-reply-to:references:date:message-id:subject:from:to :cc:content-type; bh=xWx4J7sWB2Crk2FDbMpJNoj3oaKBIxDd4x7l5sZuINs=; b=PIld2/eh0LTMwiYpqGJvSMHhZbZrpx95yV35k2ZHAGIfdYS6MmG5Grdw67uiRrgNC5 ccrlVpvALx/4ixYFG6peEt2m91Ga4+EXlPzvvdrEmIcQHz8oJFEyh4B1U435WijOiXXY q/TvdleH86wSlYKaFGoduOTKSdcaIc7lW2PiZ+qQhPzEcKBQotcMBggZZOO2cOkfHIuP 1Iiou6ZmMLWdYF1cLlkjV2NZBBnm6Mb0atdbhSNsZU2RS25anVW2yOgl7+ajqmLh+uqc iNwA0CEMZspHcuGwAmrTGy82axrHW4mL7wQozTB4QzbuzD0oPf8rD5x11pbF4M654kOu cWkA== MIME-Version: 1.0 X-Received: by 10.140.19.201 with SMTP id 67mr988720qgh.28.1407881847078; Tue, 12 Aug 2014 15:17:27 -0700 (PDT) Received: by 10.224.39.139 with HTTP; Tue, 12 Aug 2014 15:17:27 -0700 (PDT) In-Reply-To: <201408120939.56176.jhb@freebsd.org> References: <201408111218.29802.jhb@freebsd.org> <201408120939.56176.jhb@freebsd.org> Date: Tue, 12 Aug 2014 15:17:27 -0700 Message-ID: Subject: Re: RFC: cpuid_t From: Adrian Chadd To: John Baldwin Content-Type: text/plain; charset=UTF-8 Cc: "freebsd-arch@freebsd.org" X-BeenThere: freebsd-arch@freebsd.org X-Mailman-Version: 2.1.18-1 Precedence: list List-Id: Discussion related to FreeBSD architecture List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 12 Aug 2014 22:17:28 -0000 On 12 August 2014 06:39, John Baldwin wrote: > I think Bruce's point is you can just fix the few places that use a u_char to > an int and call it a day. The biggest offender of those that I can think of > are td_oncpu/td_lastcpu and the corresponding fields in kinfo along with > expanding NOCPU to be -1 instead of 255. I think most other places already > use an int (pf is one place that doesn't, it borrows N bits from some other > field to store the CPU number, so it can't use a cpuid_t anyway), so the patch > to just use an int might actually be quite small. You could do that, but then we'd be left in a situation that it isn't 100% clear what type people should be using (except hoping they cut/paste code that uses an int and don't make dumb decisions like assuming they can pack it into other fields, like pf) and that they could treat the CPU ID as some kind of index number. Being able to grep for all the places where cpuid_t is will make it a lot easier in the future to uplift all of the cpu id manipulating code to treat CPU IDs differently (eg making things very sparse.) So, I'm happy if the group decision is to just make it an int. It just has to be done before FreeBSD-11 ships. :) I don't have such an aversion to typedefs. It has always made it much easier to do type checking and changes to things in C that I'd normally do in C++ with classes. -a