From owner-freebsd-ppc@freebsd.org Tue Feb 19 19:49:53 2019 Return-Path: Delivered-To: freebsd-ppc@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 F2B0514FB4D4 for ; Tue, 19 Feb 2019 19:49:52 +0000 (UTC) (envelope-from chmeeedalf@gmail.com) Received: from mail-it1-x12b.google.com (mail-it1-x12b.google.com [IPv6:2607:f8b0:4864:20::12b]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (Client CN "smtp.gmail.com", Issuer "Google Internet Authority G3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 0FE8C70B6E for ; Tue, 19 Feb 2019 19:49:52 +0000 (UTC) (envelope-from chmeeedalf@gmail.com) Received: by mail-it1-x12b.google.com with SMTP id h6so9306955itl.1 for ; Tue, 19 Feb 2019 11:49:52 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=date:from:to:cc:subject:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=rcjMA9pvfdXjt76IA5govBG4QzzW3auE+eW4HqKxWGw=; b=L8f7qKPUOv24xkgL3lrduStzR3wbfAMBAlkvHns8eQQCxf65C7Vh0wAIDrHhpMPfMY 0Cw1F/X3ejGJQIZX9gGnrHHAPiqflIsXxQjawuSLB31HkJDLSZwJkOTVWFJsAzCFKXd1 e31deYfO8oK23a4tNzu9lnc4CQl6LVlamOSxc1erOSIui0y425FFEdgqIffZEIpIC0Fi /IqTJ4PC+bKfjNtNPIXDI0nQZHc3qgcY1pY2M1Xo1gnkdsICd4+CWMFmC9kN67sZt1SI mDUoTUW873+UQU+0pdbKJtzsqPI4L3qPnYIw5G0qYHgExWzXtLh2JLatCGqc4nNLyECI TkOw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:date:from:to:cc:subject:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=rcjMA9pvfdXjt76IA5govBG4QzzW3auE+eW4HqKxWGw=; b=VDO8+SQ3uy9Lc4s6GHLgTlAXhSXUUXQbGknBn+xVMrx052apVDMH9FNVrpy33WVC8O g27kW4rECMAyQ2A+Mv5+xRrEFLxPjFmgyz3aW4xNtSaK+F/kfqZMgJddaQpZELCmi0DX nPytfK+KAw0R3csKb5Pe6bjvKNwF3ZhGEadxDdCU/pUY9B3eyYHLaP2chnS+TsPJV6Qb KeQhanyc6WVBgJmkOQztpkwJ+VKXhUrC586HSEi232qfXG/s7/vX7tdvBXJlLl06IW1k wZkzIiIfJopaLAytilvChbdUg+r4zjpKoPRriLblfqOgNi7GTwWZ9tDFmtqXVSG/OzqK tuVA== X-Gm-Message-State: AHQUAuY7DGj1JxB3Qcv6yDpojDMmjbkPWV6t2IPxyHlKg8wiNZJ8aizF huYEYIGnn7+fXMcNBj+xUdtpwzQK X-Google-Smtp-Source: AHgI3IbJjTbw6Ogf8+v971wbpYjx6fv4uLCCCZHDhHYo3lYmgSz1Tj6NHrvwAzeLSvyvfCP9D+RiXw== X-Received: by 2002:a24:88:: with SMTP id 130mr3107668ita.92.1550605791174; Tue, 19 Feb 2019 11:49:51 -0800 (PST) Received: from ralga.knownspace (173-25-245-129.client.mchsi.com. [173.25.245.129]) by smtp.gmail.com with ESMTPSA id 2sm1584661itw.11.2019.02.19.11.49.50 (version=TLS1_2 cipher=ECDHE-RSA-CHACHA20-POLY1305 bits=256/256); Tue, 19 Feb 2019 11:49:50 -0800 (PST) Date: Tue, 19 Feb 2019 13:49:46 -0600 From: Justin Hibbits To: Mark Millard Cc: FreeBSD PowerPC ML Subject: Re: Question on "Map the entire KVA range into the SLB. We must not fault there" vs. the modern VM_MAX_KERNEL_ADDRESS Message-ID: <20190219134946.125d91a9@ralga.knownspace> In-Reply-To: References: X-Mailer: Claws Mail 3.17.3 (GTK+ 2.24.32; powerpc64-portbld-freebsd13.0) MIME-Version: 1.0 Content-Type: text/plain; charset=US-ASCII Content-Transfer-Encoding: 7bit X-Rspamd-Queue-Id: 0FE8C70B6E X-Spamd-Bar: ------ Authentication-Results: mx1.freebsd.org; dkim=pass header.d=gmail.com header.s=20161025 header.b=L8f7qKPU; dmarc=pass (policy=none) header.from=gmail.com; spf=pass (mx1.freebsd.org: domain of chmeeedalf@gmail.com designates 2607:f8b0:4864:20::12b as permitted sender) smtp.mailfrom=chmeeedalf@gmail.com X-Spamd-Result: default: False [-6.42 / 15.00]; RCVD_VIA_SMTP_AUTH(0.00)[]; FREEMAIL_FROM(0.00)[gmail.com]; R_SPF_ALLOW(-0.20)[+ip6:2607:f8b0:4000::/36]; RCVD_COUNT_THREE(0.00)[3]; TO_DN_ALL(0.00)[]; DKIM_TRACE(0.00)[gmail.com:+]; RCPT_COUNT_TWO(0.00)[2]; DMARC_POLICY_ALLOW(-0.50)[gmail.com,none]; MX_GOOD(-0.01)[cached: alt3.gmail-smtp-in.l.google.com]; FREEMAIL_TO(0.00)[yahoo.com]; FROM_EQ_ENVFROM(0.00)[]; MIME_TRACE(0.00)[0:+]; FREEMAIL_ENVFROM(0.00)[gmail.com]; ASN(0.00)[asn:15169, ipnet:2607:f8b0::/32, country:US]; RCVD_TLS_LAST(0.00)[]; DWL_DNSWL_NONE(0.00)[gmail.com.dwl.dnswl.org : 127.0.5.0]; ARC_NA(0.00)[]; NEURAL_HAM_MEDIUM(-1.00)[-1.000,0]; R_DKIM_ALLOW(-0.20)[gmail.com:s=20161025]; FROM_HAS_DN(0.00)[]; NEURAL_HAM_SHORT(-0.98)[-0.980,0]; NEURAL_HAM_LONG(-1.00)[-1.000,0]; MIME_GOOD(-0.10)[text/plain]; PREVIOUSLY_DELIVERED(0.00)[freebsd-ppc@freebsd.org]; TO_MATCH_ENVRCPT_SOME(0.00)[]; RCVD_IN_DNSWL_NONE(0.00)[b.2.1.0.0.0.0.0.0.0.0.0.0.0.0.0.0.2.0.0.4.6.8.4.0.b.8.f.7.0.6.2.list.dnswl.org : 127.0.5.0]; IP_SCORE(-2.43)[ip: (-7.51), ipnet: 2607:f8b0::/32(-2.60), asn: 15169(-1.99), country: US(-0.07)] X-BeenThere: freebsd-ppc@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Porting FreeBSD to the PowerPC List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 19 Feb 2019 19:49:53 -0000 On Mon, 18 Feb 2019 18:58:43 -0800 Mark Millard wrote: > It takes me a bit to provide context for the question . . . > > I'll first note: > > #define VM_MAX_SAFE_KERNEL_ADDRESS VM_MAX_KERNEL_ADDRESS > > moea64_mid_bootstrap has: > > virtual_avail = VM_MIN_KERNEL_ADDRESS; > virtual_end = VM_MAX_SAFE_KERNEL_ADDRESS; > > /* > * Map the entire KVA range into the SLB. We must not fault > there. */ > #ifdef __powerpc64__ > for (va = virtual_avail; va < virtual_end; va += > SEGMENT_LENGTH) moea64_bootstrap_slb_prefault(va, 0); > #endif > > but the prefaulting is based on: > > #define > PCPU_MD_AIM64_FIELDS \ > struct slb slb[64]; \ > > where the slb is based on the upper 36 bits of the passed-in va values > (effective address value in powerpc terms). > > The address range now being covered is: > > #define VM_MIN_KERNEL_ADDRESS 0xe000000000000000 > #define VM_MAX_KERNEL_ADDRESS 0xe0000007ffffffff > > So for the upper 36 bits: > > 0xe000_0000_0 > 0xe000_0007_f > > and the range 0x00 through 0x7f has 128 possibilities. > > So more than the slb can track. (Also: slb[USER_SLB_SLOT] > is avoided so really 63 of the 64 are available.) > > Later (larger) va values are the replacing earlier > (smaller) va values via slb_insert_kernel usage that > in turn involves random replacements via (n_slbs > being 64 in the G5 context): > > i = mftb() % n_slbs; > if (i == USER_SLB_SLOT) > i = (i+1) % n_slbs; > > So apparently only the last 63 from: > > for (va = virtual_avail; va < virtual_end; va += > SEGMENT_LENGTH) moea64_bootstrap_slb_prefault(va, 0); > > are known to still be present in the slb. > > > > So the question . . . > > How can: > > "Map the entire KVA range into the SLB. We must not fault there" > > be true? Is it really a requirement? If it is, then something seems > to be wrong as far as handling the modern VM_MAX_KERNEL_ADDRESS value > goes. > > > The old VM_MAX_KERNEL_ADDRESS value would have 0x00 through 0x1c > and so would fit this particular constraint. The old value > 0xe0000001c7ffffff looks like something was being avoided > (why not 0xe0000001ffffffff ?). But I've not found what or why. If this were cause for concern I'd likely see it on my POWER9, which actually only has 32 SLB entries, 4 of which are pinned, the remaining 28 being FIFO. Much less than 64 on the G5. - Justin