From owner-freebsd-hackers@freebsd.org Thu Jan 25 17:21:41 2018 Return-Path: Delivered-To: freebsd-hackers@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 4C00EEC0C09 for ; Thu, 25 Jan 2018 17:21:41 +0000 (UTC) (envelope-from kostikbel@gmail.com) Received: from mailman.ysv.freebsd.org (mailman.ysv.freebsd.org [IPv6:2001:1900:2254:206a::50:5]) by mx1.freebsd.org (Postfix) with ESMTP id D99A087A1A for ; Thu, 25 Jan 2018 17:21:40 +0000 (UTC) (envelope-from kostikbel@gmail.com) Received: by mailman.ysv.freebsd.org (Postfix) id 92322EC0C08; Thu, 25 Jan 2018 17:21:40 +0000 (UTC) Delivered-To: hackers@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 7E37BEC0C06 for ; Thu, 25 Jan 2018 17:21:40 +0000 (UTC) (envelope-from kostikbel@gmail.com) Received: from kib.kiev.ua (kib.kiev.ua [IPv6:2001:470:d5e7:1::1]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id E7DE187A16 for ; Thu, 25 Jan 2018 17:21:39 +0000 (UTC) (envelope-from kostikbel@gmail.com) Received: from tom.home (kib@localhost [127.0.0.1]) by kib.kiev.ua (8.15.2/8.15.2) with ESMTPS id w0PHLGY8042938 (version=TLSv1.2 cipher=DHE-RSA-AES256-GCM-SHA384 bits=256 verify=NO); Thu, 25 Jan 2018 19:21:19 +0200 (EET) (envelope-from kostikbel@gmail.com) DKIM-Filter: OpenDKIM Filter v2.10.3 kib.kiev.ua w0PHLGY8042938 Received: (from kostik@localhost) by tom.home (8.15.2/8.15.2/Submit) id w0PHLGfe042937; Thu, 25 Jan 2018 19:21:16 +0200 (EET) (envelope-from kostikbel@gmail.com) X-Authentication-Warning: tom.home: kostik set sender to kostikbel@gmail.com using -f Date: Thu, 25 Jan 2018 19:21:16 +0200 From: Konstantin Belousov To: Hartmut Brandt Cc: hackers@freebsd.org Subject: Re: allocating large piece of contiguous kernel memory Message-ID: <20180125172116.GS55707@kib.kiev.ua> References: MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: User-Agent: Mutt/1.9.2 (2017-12-15) X-Spam-Status: No, score=-2.0 required=5.0 tests=ALL_TRUSTED,BAYES_00, DKIM_ADSP_CUSTOM_MED,FREEMAIL_FROM,NML_ADSP_CUSTOM_MED autolearn=no autolearn_force=no version=3.4.1 X-Spam-Checker-Version: SpamAssassin 3.4.1 (2015-04-28) on tom.home X-BeenThere: freebsd-hackers@freebsd.org X-Mailman-Version: 2.1.25 Precedence: list List-Id: Technical Discussions relating to FreeBSD List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 25 Jan 2018 17:21:41 -0000 On Thu, Jan 25, 2018 at 05:52:57PM +0100, Hartmut Brandt wrote: > Hi all, > > for a device driver communicating with an FPGA I would like to allocate > an 8GByte piece or two 4GByte pieces of contiguous memory in the device > driver. The machine is amd64 and has 256GByte. > > The maximum I can allocate is 512MByte. If I try more (in one piece or in > two pieces) contigfree() crashes in pmap_resident_count_dec() with an > "pmap resident count underflow". > > Is this something which is not supposed to work? Or is there something > tunable or is this a bug? I suspect a bug. Print out the value of kernel_pmap->pm_stats.resident_count before and after contigmalloc. Also interesting are the values of the resident count and decrement at the panic time (but they are already printed by the panic, you did not shown them).