From owner-svn-src-head@freebsd.org Sat Oct 31 02:40:02 2015 Return-Path: Delivered-To: svn-src-head@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 9F4E3A21A4F; Sat, 31 Oct 2015 02:40:02 +0000 (UTC) (envelope-from chmeeedalf@gmail.com) Received: from mail-io0-x234.google.com (mail-io0-x234.google.com [IPv6:2607:f8b0:4001:c06::234]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (Client CN "smtp.gmail.com", Issuer "Google Internet Authority G2" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 5F07E19ED; Sat, 31 Oct 2015 02:40:02 +0000 (UTC) (envelope-from chmeeedalf@gmail.com) Received: by ioll68 with SMTP id l68so98638997iol.3; Fri, 30 Oct 2015 19:40:01 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=sender:cc:message-id:from:to:in-reply-to:content-type :content-transfer-encoding:mime-version:subject:date:references; bh=SkDZYFSsJmYsSZSs5SUsTiXFDK7GF3HBpL5pSZ+3i6U=; b=neFoYzO+meYC1FMbhm3LVDX6FXH8PzDZl3GpGPb6ntf3NTf5OWcE9olg4jE3bx9cWW BsXDkP8YXPl5r05UTwitlrejTJDaZ+OFYcv2Lh5ohI1eqO+B5RzBn2krOGLl97MLrAyk YilohFN5bQIhnHRRNAG/e0FeZ4HVdAQ7D65lcOTMokX94enPU/DtTc6EKEdrJ6l4wQv2 T9Pj8IiTgJoRkqqJoKFytGgHFcjaW1wZMTbc4Nr3Dl6nRgGkt+w5dgVGDQFy7U/Lc4PV WheL/fvROYL1yKxKk0tBkLxzusysjePFF1i6xIU0LGmIpuL71yUHHkQ3gLoBZFO/qti/ /ODg== X-Received: by 10.107.47.24 with SMTP id j24mr12728222ioo.168.1446259201843; Fri, 30 Oct 2015 19:40:01 -0700 (PDT) Received: from blackstar.knownspace (c-98-240-160-157.hsd1.mn.comcast.net. [98.240.160.157]) by smtp.gmail.com with ESMTPSA id rj10sm1955396igc.20.2015.10.30.19.40.00 (version=TLSv1 cipher=RC4-SHA bits=128/128); Fri, 30 Oct 2015 19:40:00 -0700 (PDT) Sender: Justin Hibbits Cc: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Message-Id: <39CCA88E-6D59-4F09-B054-DF765B8C9708@freebsd.org> From: Justin Hibbits To: Conrad Meyer In-Reply-To: Content-Type: text/plain; charset=US-ASCII; format=flowed; delsp=yes Content-Transfer-Encoding: 7bit Mime-Version: 1.0 (Apple Message framework v936) Subject: Re: svn commit: r290221 - head/sys/powerpc/powerpc Date: Fri, 30 Oct 2015 21:41:32 -0500 References: <201510310208.t9V28dIh051810@repo.freebsd.org> X-Mailer: Apple Mail (2.936) X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.20 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 31 Oct 2015 02:40:02 -0000 On Oct 30, 2015, at 9:27 PM, Conrad Meyer wrote: > Comments inline. > > On Fri, Oct 30, 2015 at 7:08 PM, Justin Hibbits > wrote: >> Author: jhibbits >> Date: Sat Oct 31 02:08:39 2015 >> New Revision: 290221 >> URL: https://svnweb.freebsd.org/changeset/base/290221 >> >> Log: >> Print unsigned memory sizes, to handle >2GB RAM on 32-bit powerpc. >> ... >> = >> = >> = >> = >> = >> = >> = >> = >> = >> ===================================================================== >> --- head/sys/powerpc/powerpc/machdep.c Sat Oct 31 02:07:30 >> 2015 (r290220) >> +++ head/sys/powerpc/powerpc/machdep.c Sat Oct 31 02:08:39 >> 2015 (r290221) >> @@ -176,12 +176,12 @@ cpu_startup(void *dummy) >> #ifdef PERFMON >> perfmon_init(); >> #endif >> - printf("real memory = %ld (%ld MB)\n", ptoa(physmem), >> + printf("real memory = %lu (%lu MB)\n", ptoa(physmem), >> ptoa(physmem) / 1048576); > > Shouldn't this be "real memory = %ju (%lu MB)\n" and > (uintmax_t)ptoa(physmem), or it may overflow on >4GB RAM systems? Yes, it should, and it will. However, currently ptoa() casts to unsigned long, and I didn't want to change that yet (I will eventually). In fact, the machine I'm testing on has 8GB, which I've had to artificially limit to <4GB because of the various memory accounting size limits. > >> realmem = physmem; >> >> if (bootverbose) >> - printf("available KVA = %zd (%zd MB)\n", >> + printf("available KVA = %zu (%zu MB)\n", >> virtual_end - virtual_avail, >> (virtual_end - virtual_avail) / 1048576); >> >> @@ -199,7 +199,7 @@ cpu_startup(void *dummy) >> #ifdef __powerpc64__ >> printf("0x%016lx - 0x%016lx, %ld bytes (%ld >> pages)\n", >> #else >> - printf("0x%08x - 0x%08x, %d bytes (%ld >> pages)\n", >> + printf("0x%08x - 0x%08x, %u bytes (%lu >> pages)\n", > > It seems wrong that bytes is only %u here and pages is a %lu. I think > bytes should probably be %ju too? What is the type of size1? You're right. It should be long. However, it's 6-of-one in this case, since on powerpc (32-bit) sizeof(long) == sizeof(int), so it doesn't matter too much yet. size1 is a vm_offset_t, which is 32-bits in this case. phys_avail[] is also an array of vm_offset_t's, and I intend to change it to vm_paddr_t, and cast to uintmax_t for printf purposes, but again, that's longer term (a lot of the powerpc bootup needs a cleanup, anyway). > >> #endif >> phys_avail[indx], phys_avail[indx + 1] - >> 1, size1, >> size1 / PAGE_SIZE); >> @@ -208,7 +208,7 @@ cpu_startup(void *dummy) >> >> vm_ksubmap_init(&kmi); >> >> - printf("avail memory = %ld (%ld MB)\n", >> ptoa(vm_cnt.v_free_count), >> + printf("avail memory = %lu (%lu MB)\n", >> ptoa(vm_cnt.v_free_count), >> ptoa(vm_cnt.v_free_count) / 1048576); > > Same as with the first printf. See above. It's on my list, I just wanted something cleaner for now. > > Best, > Conrad - Justin