From nobody Sun Sep 10 09:12:01 2023 X-Original-To: freebsd-hackers@mlmmj.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mlmmj.nyi.freebsd.org (Postfix) with ESMTP id 4Rk3yP33sKz4t7b9 for ; Sun, 10 Sep 2023 09:12:13 +0000 (UTC) (envelope-from freebsd@igalic.co) Received: from mail-4018.proton.ch (mail-4018.proton.ch [185.70.40.18]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "protonmail.com", Issuer "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4Rk3yP0b69z4YBc for ; Sun, 10 Sep 2023 09:12:13 +0000 (UTC) (envelope-from freebsd@igalic.co) Authentication-Results: mx1.freebsd.org; none Date: Sun, 10 Sep 2023 09:12:01 +0000 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=igalic.co; s=protonmail2; t=1694337129; x=1694596329; bh=RCtbbz1WrWsmc1L2GB4h6m3p4aIHzlc0c8NyAA5eAVI=; h=Date:To:From:Cc:Subject:Message-ID:In-Reply-To:References: Feedback-ID:From:To:Cc:Date:Subject:Reply-To:Feedback-ID: Message-ID:BIMI-Selector; b=gZvubbyJi6KapVjF/McaKS4Dr23GGjluDk1Hc8z0LFdpk9reRB64u9xm43HTB3eqr LP7vjmFmYdBpA3uqThooN5HYK6CPcFVbhiiSQ7XGS7Sy6tMGRjAkS7SCg9EHwudCS0 6f4ApbNM9EWJKQh3Jmri5wetl7p4jk5Kbhdu23qCK8hgRM+2RwHLi7eTy9AgwcfGsP pwhx5tFhLNE2PwpkmzUJcNJt/vxv5s1JqZFMCvfMULR8GNYvbNbKIefxYmjtGkr4ME K4UJ6kCJijcXVXqC0cpgWRc8qYbw+xVrJBn0644VcSMN/zhqigOFKHOMN8FWjEa7Nm AKCTdREjgkzqg== To: vmaffione@freebsd.org From: =?utf-8?Q?Mina_Gali=C4=87?= Cc: freebsd-hackers@freebsd.org, freebsd-virtualization@freebsd.org Subject: Re: Question about virtio_alloc_virtqueues Message-ID: In-Reply-To: References: Feedback-ID: 66573723:user:proton List-Id: Technical discussions relating to FreeBSD List-Archive: https://lists.freebsd.org/archives/freebsd-hackers List-Help: List-Post: List-Subscribe: List-Unsubscribe: Sender: owner-freebsd-hackers@freebsd.org MIME-Version: 1.0 Content-Type: multipart/alternative; boundary="b1_9dFz6Es1aV8lBvyxiMz8rPOdtFwL86XLXlfGXd1yQo" X-Spamd-Bar: ---- X-Rspamd-Pre-Result: action=no action; module=replies; Message is reply to one we originated X-Spamd-Result: default: False [-4.00 / 15.00]; REPLY(-4.00)[]; ASN(0.00)[asn:62371, ipnet:185.70.40.0/24, country:CH] X-Rspamd-Queue-Id: 4Rk3yP0b69z4YBc This is a multi-part message in MIME format. --b1_9dFz6Es1aV8lBvyxiMz8rPOdtFwL86XLXlfGXd1yQo Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: base64 dGhhdCBzb3VuZHMgbGlrZSB3ZSBjYW4ganVzdCByZW1vdmUgdGhlIGZsYWdzIHBhcmFtZXRlciBm cm9tIHZpcnRpb19hbGxvY192aXJ0cXVldWVzKCkgYmVjYXVzZSBpdCBkb2Vzbid0IGRvIGFueXRo aW5nCgpJJ20gc3VycHJpc2VkIGkgaGF2ZW4ndCBzZWVu4oCmIG5vdGljZWQgYW55IHdhcm5pbmdz IGFib3V0IHRoZSBmbGFncyBwYXJhbWV0ZXIgYmVpbmcgdW51c2VkLgoKS2luZCByZWdhcmRzLAoK TWluYS0tLS0tLS0tIE9yaWdpbmFsIE1lc3NhZ2UgLS0tLS0tLS0KT24gOSBTZXB0IDIwMjMsIDEx OjUzLCBWaW5jZW56byBNYWZmaW9uZSB3cm90ZToKCj4gSGksCj4gTG9va2luZyBhdCB0aGUgY29k ZSwgaXQgbG9va3MgbGlrZSB0aGF0IGNvbW1lbnQgd2FzIHdyaXR0ZW4gYXQgYSB0aW1lIHdoZXJl IHBlci12aXJ0cXVldWUgTVNJWCBpbnRlcnJ1cHRzIHdlcmUgbm90IGF2YWlsYWJsZSwgYW5kIHZp cnRpb19hbGxvY192aXJ0cXVldWVzKCkgQVBJIHdhcyBhbHJlYWR5IGRlc2lnbmVkIHRvIHJlY2Vp dmUgYSBmbGFnIHRvIGluZGljYXRlIHRoYXQgcGVyLXZpcnRxdWV1ZSBNU0lYIGludGVycnVwdHMg d2VyZSByZXF1ZXN0ZWQuIFRoZSBjb2RlIHlvdSBxdW90ZWQgd291bGQgbGlrZWx5IGhhdmUgYmVl biBhIHNpbXBsZSBwbGFjZWhvbGRlciwgdG8gYmUgcmVwbGFjZWQgd2l0aCBzb21ldGhpbmcgbGlr ZSAiZmxhZ3MgfD0gVklSVElPX1BFUlZRX0lOVFIiIG9uY2UgdGhlIHN1cHBvcnQgaGFkIGNvbWUu IEl0J3MgYSB2ZXJ5IGNvbW1vbiBwYXR0ZXJuIHRvIHN0YXJ0IHdpdGggc2V0dGluZyBmbGFncyA9 IDAsIGFuZCB0aGVuIGJpdHdpc2Ugb3IgfD0gZmxhZ3MgZGVwZW5kaW5nIG9uIHRoZSBzaXR1YXRp b24uCj4KPiBIb3dldmVyOgo+Cj4gLSBwZXItdmlydHF1ZXVlIE1TSVggaW50ZXJydXB0cyBhcmUg bm93IGF2YWlsYWJsZSAoZS5nLiBsb29rIGF0IHZ0cGNpX3NldHVwX2ludGVycnVwdHMoKSksIGFu ZAo+IC0gdmlydGlxdWV1ZXMgaW50ZXJydXB0IHNldHVwIGhhcHBlbnMgaW4gYSBzZXBhcmF0ZSBB UEksIGkuZS4gdmlydGlvX3NldHVwX2ludHIoKSwgd2hpY2ggdGFrZXMgY2FyZSBhbGwgdGhlIHBv c3NpYmxlIGNhc2VzCj4KPiBTbyBhcyBmYXIgYXMgSSBjYW4gdGVsbCB0aGF0IGNvbW1lbnQgaXMg bm90IHJlbGV2YW50IGFueW1vcmUgYW5kIGNhbiBiZSByZW1vdmVkIHRvZ2V0aGVyIHdpdGggdGhl IGZsYWdzLgo+IFVubGVzcyBJJ20gd3JvbmcsIG9mYy4KPgo+IENoZWVycywKPiBWaW5jZW56bwo+ Cj4gSWwgZ2lvcm5vIHZlbiA4IHNldCAyMDIzIGFsbGUgb3JlIDIxOjA1IE1pbmEgR2FsacSHIDxm cmVlYnNkQGlnYWxpYy5jbz4gaGEgc2NyaXR0bzoKPgo+PiBIaSBmb2xrcywKPj4KPj4gZm9yIHRo ZSBwYXN0IHR3byBvciBzbyB3ZWVrcywgSSd2ZSBiZWVuIHRyeWluZyB0byBkb2N1bWVudCB0aGUK Pj4gdmlydGlvIGZ1bmN0aW9uczogWW91IGNhbiBzZWUgc29tZSBvZiBteSBwcm9ncmVzcyBoZXJl Ogo+Pgo+PiBodHRwczovL2NvZGViZXJnLm9yZy9tZWVuYS9mcmVlYnNkLXNyYy9jb21taXRzL2Jy YW5jaC9pbXByb3ZlL3ZpcnRpbwo+Pgo+PiBJJ20gY3VycmVudGx5IHRyeWluZyB0byBkb2N1bWVu dCB2aXJ0aW9fYWxsb2NfdmlydHF1ZXVlcy4KPj4gVGhlIHNlY29uZCBhcmd1bWVudCwgZmxhZ3Ms IGlzIG9ubHkgZXZlciBjYWxsZWQgd2l0aCAwLCBhbmQKPj4gbmV2ZXIgcGFzc2VkIG9uIHRvIGFu eXRoaW5nLiBTbyBJIHRob3VnaHQgSSdkIHJlbW92ZSBpdC4KPj4gSG93ZXZlciwgdGhlcmUgKmlz KiB0aGlzIGNvbW1lbnQgaW4gaWZfdnRuZXQuYzoKPj4KPj4gLyoKPj4gKiBUT0RPOiBFbmFibGUg aW50ZXJydXB0IGJpbmRpbmcgaWYgdGhpcyBpcyBtdWx0aXF1ZXVlLiBUaGlzIHdpbGwKPj4gKiBv bmx5IG1hdHRlciB3aGVuIHBlci12aXJ0cXVldWUgTVNJWCBpcyBhdmFpbGFibGUuCj4+ICovCj4+ IGlmIChzYy0+dnRuZXRfZmxhZ3MgJiBWVE5FVF9GTEFHX01RKQo+PiBmbGFncyB8PSAwOwo+Pgo+ PiBhZnRlciB3aGljaCBmbGFncyBhcmUgc3RpbGwgc2V0IHRvIDAuIGZvciBub3c/Pwo+PiBXaGF0 IGRvZXMgdGhpcyBtZWFuPwo+Pgo+PiBLaW5kIHJlZ2FyZHMsCj4+Cj4+IE1pbmEgR2FsacSH --b1_9dFz6Es1aV8lBvyxiMz8rPOdtFwL86XLXlfGXd1yQo Content-Type: text/html; charset=utf-8 Content-Transfer-Encoding: base64 dGhhdCBzb3VuZHMgbGlrZSB3ZSBjYW4ganVzdCByZW1vdmUgdGhlIGZsYWdzIHBhcmFtZXRlciBm cm9tIHZpcnRpb19hbGxvY192aXJ0cXVldWVzKCkgYmVjYXVzZSBpdCBkb2Vzbid0IGRvIGFueXRo aW5nPGJyPjxicj5JJ20gc3VycHJpc2VkIGkgaGF2ZW4ndCBzZWVu4oCmIG5vdGljZWQgYW55IHdh cm5pbmdzIGFib3V0IHRoZSBmbGFncyBwYXJhbWV0ZXIgYmVpbmcgdW51c2VkLjxicj48YnI+S2lu ZCByZWdhcmRzLDxicj48YnI+TWluYS0tLS0tLS0tIE9yaWdpbmFsIE1lc3NhZ2UgLS0tLS0tLS08 YnI+T24gOSBTZXB0IDIwMjMsIDExOjUzLCBWaW5jZW56byBNYWZmaW9uZSA8IHZtYWZmaW9uZUBm cmVlYnNkLm9yZz4gd3JvdGU6PGJsb2NrcXVvdGUgY2xhc3M9InByb3Rvbm1haWxfcXVvdGUiPjxi cj48ZGl2IGRpcj0ibHRyIj48ZGl2PkhpLDwvZGl2PjxkaXY+wqAgTG9va2luZyBhdCB0aGUgY29k ZSwgaXQgbG9va3MgbGlrZSB0aGF0IGNvbW1lbnQgd2FzIHdyaXR0ZW4gYXQgYSB0aW1lIHdoZXJl IHBlci12aXJ0cXVldWUgTVNJWCBpbnRlcnJ1cHRzIHdlcmUgbm90IGF2YWlsYWJsZSwgYW5kIHZp cnRpb19hbGxvY192aXJ0cXVldWVzKCkgQVBJIHdhcyBhbHJlYWR5IGRlc2lnbmVkIHRvIHJlY2Vp dmUgYSBmbGFnIHRvIGluZGljYXRlIHRoYXQgcGVyLXZpcnRxdWV1ZSBNU0lYIGludGVycnVwdHMg d2VyZSByZXF1ZXN0ZWQuIFRoZSBjb2RlIHlvdSBxdW90ZWQgd291bGQgbGlrZWx5IGhhdmUgYmVl biBhIHNpbXBsZSBwbGFjZWhvbGRlciwgdG8gYmUgcmVwbGFjZWQgd2l0aCBzb21ldGhpbmcgbGlr ZSAmcXVvdDtmbGFncyB8PSBWSVJUSU9fUEVSVlFfSU5UUiZxdW90OyBvbmNlIHRoZSBzdXBwb3J0 IGhhZCBjb21lLiBJdCYjMzk7cyBhIHZlcnkgY29tbW9uIHBhdHRlcm4gdG8gc3RhcnQgd2l0aCBz ZXR0aW5nIGZsYWdzID0gMCwgYW5kIHRoZW4gYml0d2lzZSBvciB8PSBmbGFncyBkZXBlbmRpbmcg b24gdGhlIHNpdHVhdGlvbi48YnI+PC9kaXY+PGRpdj48YnI+PC9kaXY+PGRpdj5Ib3dldmVyOjwv ZGl2PjxkaXY+PHVsPjxsaT5wZXItdmlydHF1ZXVlIE1TSVggaW50ZXJydXB0cyBhcmUgbm93IGF2 YWlsYWJsZSAoZS5nLiBsb29rIGF0IHZ0cGNpX3NldHVwX2ludGVycnVwdHMoKSksIGFuZDwvbGk+ PGxpPnZpcnRpcXVldWVzIGludGVycnVwdCBzZXR1cCBoYXBwZW5zIGluIGEgc2VwYXJhdGUgQVBJ LCBpLmUuIHZpcnRpb19zZXR1cF9pbnRyKCksIHdoaWNoIHRha2VzIGNhcmUgYWxsIHRoZSBwb3Nz aWJsZSBjYXNlczxicj48L2xpPjwvdWw+PGRpdj5TbyBhcyBmYXIgYXMgSSBjYW4gdGVsbCB0aGF0 IGNvbW1lbnQgaXMgbm90IHJlbGV2YW50IGFueW1vcmUgYW5kIGNhbiBiZSByZW1vdmVkIHRvZ2V0 aGVyIHdpdGggdGhlIGZsYWdzLjwvZGl2PjxkaXY+VW5sZXNzIEkmIzM5O20gd3JvbmcsIG9mYy48 YnI+PC9kaXY+PGRpdj48YnI+PC9kaXY+PGRpdj5DaGVlcnMsPC9kaXY+PGRpdj7CoCBWaW5jZW56 bzxicj48L2Rpdj48L2Rpdj48L2Rpdj48YnI+PGRpdiBjbGFzcz0iZ21haWxfcXVvdGUiPjxkaXYg ZGlyPSJsdHIiIGNsYXNzPSJnbWFpbF9hdHRyIj5JbCBnaW9ybm8gdmVuIDggc2V0IDIwMjMgYWxs ZSBvcmUgMjE6MDUgTWluYSBHYWxpxIcgJmx0OzxhIGhyZWY9Im1haWx0bzpmcmVlYnNkQGlnYWxp Yy5jbyI+ZnJlZWJzZEBpZ2FsaWMuY288L2E+Jmd0OyBoYSBzY3JpdHRvOjxicj48L2Rpdj48Ymxv Y2txdW90ZSBjbGFzcz0iZ21haWxfcXVvdGUiIHN0eWxlPSJtYXJnaW46MHB4IDBweCAwcHggMC44 ZXg7Ym9yZGVyLWxlZnQ6MXB4IHNvbGlkIHJnYigyMDQsMjA0LDIwNCk7cGFkZGluZy1sZWZ0OjFl eCI+SGkgZm9sa3MsPGJyPg0KPGJyPg0KZm9yIHRoZSBwYXN0IHR3byBvciBzbyB3ZWVrcywgSSYj Mzk7dmUgYmVlbiB0cnlpbmcgdG8gZG9jdW1lbnQgdGhlPGJyPg0KdmlydGlvIGZ1bmN0aW9uczog WW91IGNhbiBzZWUgc29tZSBvZiBteSBwcm9ncmVzcyBoZXJlOjxicj4NCjxicj4NCjxhIGhyZWY9 Imh0dHBzOi8vY29kZWJlcmcub3JnL21lZW5hL2ZyZWVic2Qtc3JjL2NvbW1pdHMvYnJhbmNoL2lt cHJvdmUvdmlydGlvIiByZWw9Im5vcmVmZXJyZXIiIHRhcmdldD0iX2JsYW5rIj5odHRwczovL2Nv ZGViZXJnLm9yZy9tZWVuYS9mcmVlYnNkLXNyYy9jb21taXRzL2JyYW5jaC9pbXByb3ZlL3ZpcnRp bzwvYT48YnI+DQo8YnI+DQpJJiMzOTttIGN1cnJlbnRseSB0cnlpbmcgdG8gZG9jdW1lbnQgdmly dGlvX2FsbG9jX3ZpcnRxdWV1ZXMuPGJyPg0KVGhlIHNlY29uZCBhcmd1bWVudCwgZmxhZ3MsIGlz IG9ubHkgZXZlciBjYWxsZWQgd2l0aCAwLCBhbmQ8YnI+DQpuZXZlciBwYXNzZWQgb24gdG8gYW55 dGhpbmcuIFNvIEkgdGhvdWdodCBJJiMzOTtkIHJlbW92ZSBpdC48YnI+DQpIb3dldmVyLCB0aGVy ZSAqaXMqIHRoaXMgY29tbWVudCBpbiBpZl92dG5ldC5jOjxicj4NCjxicj4NCsKgIMKgIMKgIMKg IC8qPGJyPg0KwqAgwqAgwqAgwqAgwqAqIFRPRE86IEVuYWJsZSBpbnRlcnJ1cHQgYmluZGluZyBp ZiB0aGlzIGlzIG11bHRpcXVldWUuIFRoaXMgd2lsbDxicj4NCsKgIMKgIMKgIMKgIMKgKiBvbmx5 IG1hdHRlciB3aGVuIHBlci12aXJ0cXVldWUgTVNJWCBpcyBhdmFpbGFibGUuPGJyPg0KwqAgwqAg wqAgwqAgwqAqLzxicj4NCsKgIMKgIMKgIMKgIGlmIChzYy0mZ3Q7dnRuZXRfZmxhZ3MgJmFtcDsg VlRORVRfRkxBR19NUSk8YnI+DQrCoCDCoCDCoCDCoCDCoCDCoCDCoCDCoCBmbGFncyB8PSAwOzxi cj4NCjxicj4NCjxicj4NCmFmdGVyIHdoaWNoIGZsYWdzIGFyZSBzdGlsbCBzZXQgdG8gMC4gZm9y IG5vdz8/PGJyPg0KV2hhdCBkb2VzIHRoaXMgbWVhbj88YnI+DQo8YnI+DQpLaW5kIHJlZ2FyZHMs PGJyPg0KPGJyPg0KTWluYSBHYWxpxIc8YnI+DQo8YnI+DQo8L2Jsb2NrcXVvdGU+PC9kaXY+DQo8 L2Rpdj4= --b1_9dFz6Es1aV8lBvyxiMz8rPOdtFwL86XLXlfGXd1yQo-- From nobody Wed Sep 13 13:02:10 2023 X-Original-To: freebsd-hackers@mlmmj.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mlmmj.nyi.freebsd.org (Postfix) with ESMTP id 4Rm0wp5F2Qz4sXtr for ; Wed, 13 Sep 2023 13:02:34 +0000 (UTC) (envelope-from guy.helmer@gmail.com) Received: from mail-yw1-x1136.google.com (mail-yw1-x1136.google.com [IPv6:2607:f8b0:4864:20::1136]) (using TLSv1.3 with cipher TLS_AES_128_GCM_SHA256 (128/128 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (2048 bits) client-digest SHA256) (Client CN "smtp.gmail.com", Issuer "GTS CA 1D4" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4Rm0wn2PhSz3cZ8 for ; Wed, 13 Sep 2023 13:02:33 +0000 (UTC) (envelope-from guy.helmer@gmail.com) Authentication-Results: mx1.freebsd.org; dkim=pass header.d=gmail.com header.s=20221208 header.b=Lz3ZsglN; spf=pass (mx1.freebsd.org: domain of guy.helmer@gmail.com designates 2607:f8b0:4864:20::1136 as permitted sender) smtp.mailfrom=guy.helmer@gmail.com; dmarc=pass (policy=none) header.from=gmail.com Received: by mail-yw1-x1136.google.com with SMTP id 00721157ae682-59b50b4556eso56763717b3.1 for ; Wed, 13 Sep 2023 06:02:33 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20221208; t=1694610149; x=1695214949; darn=freebsd.org; h=to:date:message-id:subject:mime-version:from:from:to:cc:subject :date:message-id:reply-to; bh=Yib/unPWMHU4XLTmFbRRIdJlUBx51idGJArhsHmb7A4=; b=Lz3ZsglNBAz7JgXix5lJMDqFqHFbMn/CJypQ1KGS94PftgPnmNKgjRuiYiRzERsp9E V2vzdi/1eiZCyKdgMH93Tupo16anKziWVRh26+t5icmE76QGx3jRIx7VooZzsW+c2oaP tYSkG8oWc6bXCbhyDHNIzbdB+tv4y2aXabPQIsNNCDa5pnllDRN+HkUzg7QhPonMbVc4 g0xiB8nbT9tzAJSQePyFkUzVTn4wZEuP9xtX70g6zKhDGUlMhO5+J3AWknVxNl1G0SVZ SL5CzKNpo/1zDgdp8fyGTtb8RdtTx+QOYVnQe7hKUns1ec2icHK9UAOMYPi+BOmxV1zH vSiA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1694610149; x=1695214949; h=to:date:message-id:subject:mime-version:from:x-gm-message-state :from:to:cc:subject:date:message-id:reply-to; bh=Yib/unPWMHU4XLTmFbRRIdJlUBx51idGJArhsHmb7A4=; b=eMrilVIvh+Fc+WR6S23QFoLypCL3l7hGv3ACdWRF55ED2JRSQ2CC372G3nrpbesQDD o+RU73ZVVrhXPIWeYURQrGx1rdL5JXT/cG0x5/Q4lMzs86ZvKGsBEUiaKvD38KMCKzoF kaZImjJYEMCq+BWG0LZDMeim34lSjoaIMlIjxuDILwp5NmR5S1idbmA30FGkdqI43tA9 vgG5bG1Ish54cEF93oJjJSr9p+xuLtk4XmVAd6M3b6skdiuKcNu1mUkum1g8vE2eF6Cn dAgM93XVA2/3eUbCVY+w4EW+uc31igBugVINLQhZudo/yTHlzvor7du/G3QwgI5nELU7 gkkw== X-Gm-Message-State: AOJu0Yzy6LcOROjJvq1PM+xe4nLca4C7vUhj+RxaBRGftxtKsGfIvVfO xW7+Ojl94+k+D3CQ7OzdQlK0tnwQKA8= X-Google-Smtp-Source: AGHT+IHBVpqqtfkc/lxUnOLa/YNghv7QgBRxOFTm7CV2j8LEpqINFJESNDZkRfDm6JfconXsJPNayg== X-Received: by 2002:a81:7b42:0:b0:58d:7ec3:16c4 with SMTP id w63-20020a817b42000000b0058d7ec316c4mr2229508ywc.34.1694610144839; Wed, 13 Sep 2023 06:02:24 -0700 (PDT) Received: from smtpclient.apple (1636571-static.amesiaaa.metronetinc.net. [217.180.226.49]) by smtp.gmail.com with ESMTPSA id z63-20020a818942000000b00583d1fa1fccsm3128144ywf.0.2023.09.13.06.02.23 for (version=TLS1_2 cipher=ECDHE-ECDSA-AES128-GCM-SHA256 bits=128/128); Wed, 13 Sep 2023 06:02:23 -0700 (PDT) From: Guy Helmer Content-Type: multipart/alternative; boundary="Apple-Mail=_90D0AFE5-F318-406F-BFEB-84041663F383" List-Id: Technical discussions relating to FreeBSD List-Archive: https://lists.freebsd.org/archives/freebsd-hackers List-Help: List-Post: List-Subscribe: List-Unsubscribe: Sender: owner-freebsd-hackers@freebsd.org Mime-Version: 1.0 (Mac OS X Mail 16.0 \(3731.700.6\)) Subject: Unable to access GPT disk partitions - No such file or directory Message-Id: <0CAE8FD0-9F09-4CF6-A402-DF30B039DF23@gmail.com> Date: Wed, 13 Sep 2023 08:02:10 -0500 To: freebsd-hackers@freebsd.org X-Mailer: Apple Mail (2.3731.700.6) X-Spamd-Bar: --- X-Spamd-Result: default: False [-3.49 / 15.00]; NEURAL_HAM_LONG(-1.00)[-1.000]; NEURAL_HAM_MEDIUM(-1.00)[-1.000]; NEURAL_HAM_SHORT(-0.99)[-0.989]; MV_CASE(0.50)[]; DMARC_POLICY_ALLOW(-0.50)[gmail.com,none]; R_SPF_ALLOW(-0.20)[+ip6:2607:f8b0:4000::/36]; R_DKIM_ALLOW(-0.20)[gmail.com:s=20221208]; MIME_GOOD(-0.10)[multipart/alternative,text/plain]; TO_MATCH_ENVRCPT_ALL(0.00)[]; FROM_HAS_DN(0.00)[]; RCVD_VIA_SMTP_AUTH(0.00)[]; PREVIOUSLY_DELIVERED(0.00)[freebsd-hackers@freebsd.org]; ARC_NA(0.00)[]; RCVD_IN_DNSWL_NONE(0.00)[2607:f8b0:4864:20::1136:from]; RCPT_COUNT_ONE(0.00)[1]; MID_RHS_MATCH_FROM(0.00)[]; TAGGED_FROM(0.00)[]; MLMMJ_DEST(0.00)[freebsd-hackers@freebsd.org]; DKIM_TRACE(0.00)[gmail.com:+]; TO_DN_NONE(0.00)[]; FREEMAIL_FROM(0.00)[gmail.com]; DWL_DNSWL_NONE(0.00)[gmail.com:dkim]; FROM_EQ_ENVFROM(0.00)[]; MIME_TRACE(0.00)[0:+,1:+,2:~]; RCVD_TLS_LAST(0.00)[]; ASN(0.00)[asn:15169, ipnet:2607:f8b0::/32, country:US]; FREEMAIL_ENVFROM(0.00)[gmail.com]; RCVD_COUNT_TWO(0.00)[2] X-Rspamd-Queue-Id: 4Rm0wn2PhSz3cZ8 --Apple-Mail=_90D0AFE5-F318-406F-BFEB-84041663F383 Content-Transfer-Encoding: quoted-printable Content-Type: text/plain; charset=us-ascii Hi, looking for some advice to get some data back. I've had a FreeBSD 13 system (upgraded over the years from several = previous versions) on a VMware ESXi server suddenly loose access to its = UFS filesystems.=20 I cloned the disk image in the VMware server and have attached it to = another FreeBSD 13 virtual machine to try to recover access to the data = (I have old backups on a separate ZFS filesystem, but I'd sure like to = recover the current filesystem). There are no kernel messages about = problems with the virtual disk other than the expected boot messages: da2 at mpt0 bus 0 scbus2 target 2 lun 0 da2: Fixed Direct Access SCSI-2 device da2: 320.000MB/s transfers (160.000MHz, offset 127, 16bit) da2: Command Queueing enabled da2: 81920MB (167772160 512 byte sectors) da2: quirks=3D0x140 gpart shows its info: $ sudo gpart list da2 Geom name: da2 modified: false state: OK fwheads: 255 fwsectors: 63 last: 167772126 first: 34 entries: 128 scheme: GPT Providers: 1. Name: da2p1 Mediasize: 262144 (256K) Sectorsize: 512 Stripesize: 0 Stripeoffset: 20480 Mode: r0w0e0 efimedia: HD(1,GPT,76c936da-f200-11e4-b749-000c29d7feb4,0x28,0x200) rawuuid: 76c936da-f200-11e4-b749-000c29d7feb4 rawtype: 83bd6b9d-7f41-11dc-be0b-001560b84f0f label: gpboot1 length: 262144 offset: 20480 type: freebsd-boot index: 1 end: 551 start: 40 2. Name: da2p2 Mediasize: 4294967296 (4.0G) Sectorsize: 512 Stripesize: 0 Stripeoffset: 1048576 Mode: r0w0e0 efimedia: = HD(2,GPT,954100b0-f200-11e4-b749-000c29d7feb4,0x800,0x800000) rawuuid: 954100b0-f200-11e4-b749-000c29d7feb4 rawtype: 516e7cb6-6ecf-11d6-8ff8-00022d09712b label: gprootfs1 length: 4294967296 offset: 1048576 type: freebsd-ufs index: 2 end: 8390655 start: 2048 3. Name: da2p3 Mediasize: 4294967296 (4.0G) Sectorsize: 512 Stripesize: 0 Stripeoffset: 1048576 Mode: r0w0e0 efimedia: = HD(3,GPT,a2ed8c2e-f200-11e4-b749-000c29d7feb4,0x800800,0x800000) rawuuid: a2ed8c2e-f200-11e4-b749-000c29d7feb4 rawtype: 516e7cb5-6ecf-11d6-8ff8-00022d09712b label: gpswap1 length: 4294967296 offset: 4296015872 type: freebsd-swap index: 3 end: 16779263 start: 8390656 4. Name: da2p4 Mediasize: 77308345856 (72G) Sectorsize: 512 Stripesize: 0 Stripeoffset: 1048576 Mode: r0w0e0 efimedia: = HD(4,GPT,a84afad7-f200-11e4-b749-000c29d7feb4,0x1000800,0x8fff7df) rawuuid: a84afad7-f200-11e4-b749-000c29d7feb4 rawtype: 516e7cb6-6ecf-11d6-8ff8-00022d09712b label: gpusrfs1 length: 77308345856 offset: 8590983168 type: freebsd-ufs index: 4 end: 167772126 start: 16779264 Consumers: 1. Name: da2 Mediasize: 85899345920 (80G) Sectorsize: 512 Mode: r0w0e0 The /dev entries look OK to me: $ ls -l /dev/da2* crw-r----- 1 root operator 0x66 Sep 13 14:01 /dev/da2 crw-r----- 1 root operator 0x6c Sep 13 14:01 /dev/da2p1 crw-r----- 1 root operator 0x6d Sep 13 14:01 /dev/da2p2 crw-r----- 1 root operator 0x6e Sep 13 14:01 /dev/da2p3 crw-r----- 1 root operator 0x6f Sep 13 14:01 /dev/da2p4 $ ls -l /dev/gpt/ total 0 crw-r----- 1 root operator 0x75 Sep 13 14:01 gpboot1 crw-r----- 1 root operator 0x77 Sep 13 14:01 gprootfs1 crw-r----- 1 root operator 0x79 Sep 13 14:01 gpswap1 crw-r----- 1 root operator 0x7b Sep 13 14:01 gpusrfs1 However, any attempt to access the /dev entries fails with "No such file = or directory": $ sudo fsck /dev/da2p2 Can't open /dev/da2p2: No such file or directory $ sudo fsck /dev/da2p4 Can't open /dev/da2p4: No such file or directory $ sudo fsck /dev/gpt/gprootfs1=20 Can't open /dev/gpt/gprootfs1: No such file or directory $ sudo fsck /dev/gpt/gpusrfs1=20 Can't open /dev/gpt/gpusrfs1: No such file or directory I've never had an issue like this before and I can't find anything using = Google searches that resolves access to these disk devices. Any ideas? Thanks, Guy Helmer, Ph.D. --Apple-Mail=_90D0AFE5-F318-406F-BFEB-84041663F383 Content-Transfer-Encoding: quoted-printable Content-Type: text/html; charset=us-ascii
Hi, = looking for some advice to get some data = back.

I've had a FreeBSD 13 system (upgraded = over the years from several previous versions) on a VMware ESXi server = suddenly loose access to its UFS = filesystems. 

I cloned the disk image in = the VMware server and have attached it to another FreeBSD 13 virtual = machine to try to recover access to the data (I have old backups on a = separate ZFS filesystem, but I'd sure like to recover the current = filesystem). There are no kernel messages about problems with the = virtual disk other than the expected boot = messages:

da2 at mpt0 bus 0 scbus2 target 2 lun = 0
da2: <VMware Virtual disk 1.0> Fixed Direct Access = SCSI-2 device
da2: 320.000MB/s transfers (160.000MHz, offset = 127, 16bit)
da2: Command Queueing enabled
da2: = 81920MB (167772160 512 byte sectors)
da2: = quirks=3D0x140<RETRY_BUSY,STRICT_UNMAP>

gpa= rt shows its info:

$ sudo gpart list = da2
Geom name: da2
modified: false
state: = OK
fwheads: 255
fwsectors: 63
last: = 167772126
first: 34
entries: 128
scheme: = GPT
Providers:
1. Name: da2p1
  =  Mediasize: 262144 (256K)
   Sectorsize: = 512
   Stripesize: 0
  =  Stripeoffset: 20480
   Mode: = r0w0e0
   efimedia: = HD(1,GPT,76c936da-f200-11e4-b749-000c29d7feb4,0x28,0x200)
 =  rawuuid: 76c936da-f200-11e4-b749-000c29d7feb4
  =  rawtype: 83bd6b9d-7f41-11dc-be0b-001560b84f0f
  =  label: gpboot1
   length: = 262144
   offset: 20480
   type: = freebsd-boot
   index: 1
   end: = 551
   start: 40
2. Name: = da2p2
   Mediasize: 4294967296 = (4.0G)
   Sectorsize: 512
  =  Stripesize: 0
   Stripeoffset: = 1048576
   Mode: r0w0e0
  =  efimedia: = HD(2,GPT,954100b0-f200-11e4-b749-000c29d7feb4,0x800,0x800000)
&n= bsp;  rawuuid: = 954100b0-f200-11e4-b749-000c29d7feb4
   rawtype: = 516e7cb6-6ecf-11d6-8ff8-00022d09712b
   label: = gprootfs1
   length: 4294967296
  =  offset: 1048576
   type: = freebsd-ufs
   index: 2
   end: = 8390655
   start: 2048
3. Name: = da2p3
   Mediasize: 4294967296 = (4.0G)
   Sectorsize: 512
  =  Stripesize: 0
   Stripeoffset: = 1048576
   Mode: r0w0e0
  =  efimedia: = HD(3,GPT,a2ed8c2e-f200-11e4-b749-000c29d7feb4,0x800800,0x800000)
   rawuuid: = a2ed8c2e-f200-11e4-b749-000c29d7feb4
   rawtype: = 516e7cb5-6ecf-11d6-8ff8-00022d09712b
   label: = gpswap1
   length: 4294967296
  =  offset: 4296015872
   type: = freebsd-swap
   index: 3
   end: = 16779263
   start: 8390656
4. Name: = da2p4
   Mediasize: 77308345856 = (72G)
   Sectorsize: 512
  =  Stripesize: 0
   Stripeoffset: = 1048576
   Mode: r0w0e0
  =  efimedia: = HD(4,GPT,a84afad7-f200-11e4-b749-000c29d7feb4,0x1000800,0x8fff7df)
   rawuuid: = a84afad7-f200-11e4-b749-000c29d7feb4
   rawtype: = 516e7cb6-6ecf-11d6-8ff8-00022d09712b
   label: = gpusrfs1
   length: 77308345856
  =  offset: 8590983168
   type: = freebsd-ufs
   index: 4
   end: = 167772126
   start: = 16779264
Consumers:
1. Name: da2
  =  Mediasize: 85899345920 (80G)
   Sectorsize: = 512
   Mode: = r0w0e0

The /dev entries look OK to = me:
$ ls -l /dev/da2*
crw-r-----  1 root =  operator  0x66 Sep 13 14:01 /dev/da2
crw-r----- =  1 root  operator  0x6c Sep 13 14:01 = /dev/da2p1
crw-r-----  1 root  operator  0x6d = Sep 13 14:01 /dev/da2p2
crw-r-----  1 root  operator =  0x6e Sep 13 14:01 /dev/da2p3
crw-r-----  1 root =  operator  0x6f Sep 13 14:01 /dev/da2p4
$ ls -l = /dev/gpt/
total 0
crw-r-----  1 root =  operator  0x75 Sep 13 14:01 gpboot1
crw-r----- =  1 root  operator  0x77 Sep 13 14:01 = gprootfs1
crw-r-----  1 root  operator  0x79 = Sep 13 14:01 gpswap1
crw-r-----  1 root  operator =  0x7b Sep 13 14:01 gpusrfs1

However, = any attempt to access the /dev entries fails with "No such file or = directory":

$ sudo fsck = /dev/da2p2
Can't open /dev/da2p2: No such file or = directory
$ sudo fsck /dev/da2p4
Can't = open /dev/da2p4: No such file or directory
$ sudo = fsck /dev/gpt/gprootfs1 
Can't open /dev/gpt/gprootfs1: = No such file or directory
$ sudo fsck = /dev/gpt/gpusrfs1 
Can't open /dev/gpt/gpusrfs1: No such = file or directory

I've never had an issue = like this before and I can't find anything using Google searches that = resolves access to these disk devices. Any = ideas?

Thanks,
Guy Helmer, = Ph.D.

= --Apple-Mail=_90D0AFE5-F318-406F-BFEB-84041663F383-- From eugen@grosbein.net Wed Sep 13 13:35:15 2023 X-Original-To: freebsd-hackers@mlmmj.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mlmmj.nyi.freebsd.org (Postfix) with ESMTP id 4Rm1gt3ZLRz4srww for ; Wed, 13 Sep 2023 13:36:26 +0000 (UTC) (envelope-from eugen@grosbein.net) Received: from hz.grosbein.net (hz.grosbein.net [IPv6:2a01:4f8:c2c:26d8::2]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (2048 bits) client-digest SHA256) (Client CN "hz.grosbein.net", Issuer "hz.grosbein.net" (not verified)) by mx1.freebsd.org (Postfix) with ESMTPS id 4Rm1gs1qkzz4KBC for ; Wed, 13 Sep 2023 13:36:25 +0000 (UTC) (envelope-from eugen@grosbein.net) Authentication-Results: mx1.freebsd.org; dkim=none; spf=fail (mx1.freebsd.org: domain of eugen@grosbein.net does not designate 2a01:4f8:c2c:26d8::2 as permitted sender) smtp.mailfrom=eugen@grosbein.net; dmarc=fail reason="No valid SPF, No valid DKIM" header.from=grosbein.net (policy=none) Received: from eg.sd.rdtc.ru (root@eg.sd.rdtc.ru [62.231.161.221] (may be forged)) by hz.grosbein.net (8.17.1/8.17.1) with ESMTPS id 38DDaGQQ026027 (version=TLSv1.3 cipher=TLS_AES_256_GCM_SHA384 bits=256 verify=NOT); Wed, 13 Sep 2023 13:36:17 GMT (envelope-from eugen@grosbein.net) X-Envelope-From: eugen@grosbein.net X-Envelope-To: guy.helmer@gmail.com Received: from [10.58.0.11] (dadvw [10.58.0.11] (may be forged)) by eg.sd.rdtc.ru (8.17.1/8.17.1) with ESMTPS id 38DDaCxc044534 (version=TLSv1.2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128 verify=NOT); Wed, 13 Sep 2023 20:36:13 +0700 (+07) (envelope-from eugen@grosbein.net) Subject: Re: Unable to access GPT disk partitions - No such file or directory To: Guy Helmer , freebsd-hackers@freebsd.org References: <0CAE8FD0-9F09-4CF6-A402-DF30B039DF23@gmail.com> From: Eugene Grosbein Message-ID: Date: Wed, 13 Sep 2023 20:35:15 +0700 User-Agent: Mozilla/5.0 (Windows NT 6.3; WOW64; rv:45.0) Gecko/20100101 Thunderbird/45.8.0 List-Id: Technical discussions relating to FreeBSD List-Archive: https://lists.freebsd.org/archives/freebsd-hackers List-Help: List-Post: List-Subscribe: List-Unsubscribe: Sender: owner-freebsd-hackers@freebsd.org MIME-Version: 1.0 In-Reply-To: <0CAE8FD0-9F09-4CF6-A402-DF30B039DF23@gmail.com> Content-Type: text/plain; charset=windows-1252 Content-Transfer-Encoding: 7bit X-Spam-Status: No, score=-1.0 required=5.0 tests=ALL_TRUSTED,SHORTCIRCUIT autolearn=disabled version=3.4.6 X-Spam-Report: * -0.0 SHORTCIRCUIT No description available. * -1.0 ALL_TRUSTED Passed through trusted hosts only via SMTP X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on hz.grosbein.net X-Spamd-Bar: - X-Spamd-Result: default: False [-1.88 / 15.00]; NEURAL_HAM_LONG(-1.00)[-1.000]; R_SPF_FAIL(1.00)[-all]; NEURAL_HAM_MEDIUM(-1.00)[-1.000]; NEURAL_HAM_SHORT(-0.88)[-0.882]; MIME_GOOD(-0.10)[text/plain]; DMARC_POLICY_SOFTFAIL(0.10)[grosbein.net : No valid SPF, No valid DKIM,none]; MIME_TRACE(0.00)[0:+]; FREEMAIL_TO(0.00)[gmail.com,freebsd.org]; R_DKIM_NA(0.00)[]; RCVD_COUNT_TWO(0.00)[2]; FROM_EQ_ENVFROM(0.00)[]; ASN(0.00)[asn:24940, ipnet:2a01:4f8::/32, country:DE]; MLMMJ_DEST(0.00)[freebsd-hackers@freebsd.org]; TO_MATCH_ENVRCPT_SOME(0.00)[]; RCVD_TLS_ALL(0.00)[]; FROM_HAS_DN(0.00)[]; FREEFALL_USER(0.00)[eugen]; RCPT_COUNT_TWO(0.00)[2]; TO_DN_SOME(0.00)[]; TAGGED_RCPT(0.00)[]; ARC_NA(0.00)[]; MID_RHS_MATCH_FROM(0.00)[] X-Rspamd-Queue-Id: 4Rm1gs1qkzz4KBC 13.09.2023 20:02, Guy Helmer wrote: > $ sudo fsck /dev/da2p2 > Can't open /dev/da2p2: No such file or directory > $ sudo fsck /dev/da2p4 > Can't open /dev/da2p4: No such file or directory > $ sudo fsck /dev/gpt/gprootfs1 > Can't open /dev/gpt/gprootfs1: No such file or directory > $ sudo fsck /dev/gpt/gpusrfs1 > Can't open /dev/gpt/gpusrfs1: No such file or directory > > I've never had an issue like this before and I can't find anything using Google searches that resolves access to these disk devices. Any ideas? dmesg -a glabel status From nobody Wed Sep 13 17:20:29 2023 X-Original-To: freebsd-hackers@mlmmj.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mlmmj.nyi.freebsd.org (Postfix) with ESMTP id 4Rm6fc1vxgz4tcZp for ; Wed, 13 Sep 2023 17:20:40 +0000 (UTC) (envelope-from wojtek@puchar.net) Received: from puchar.net (puchar.net [194.1.144.90]) (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 4Rm6fZ5m38z4KHP for ; Wed, 13 Sep 2023 17:20:38 +0000 (UTC) (envelope-from wojtek@puchar.net) Authentication-Results: mx1.freebsd.org; dkim=pass header.d=puchar.net header.s=default header.b=Ddtq6Q6R; spf=pass (mx1.freebsd.org: domain of wojtek@puchar.net designates 194.1.144.90 as permitted sender) smtp.mailfrom=wojtek@puchar.net; dmarc=none Received: Received: from 127.0.0.1 (localhost [127.0.0.1]) by puchar.net (8.15.2/8.17.1) with ESMTPS id 38DHKThI029587 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NO); Wed, 13 Sep 2023 19:20:30 +0200 (CEST) (envelope-from wojtek@puchar.net) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=puchar.net; s=default; t=1694625630; bh=wU4U4TvXAWLmln9F8kf3OzTloVbT64UMksvcE6Qt644=; h=Date:From:To:cc:Subject:In-Reply-To:References; b=Ddtq6Q6RpNUm+ByouoOJB4j7pG5m6RGpB8K8EI6F9WEIo2z1JVoaCyX/7gufM7ykq ThPtYL9008zcgZ/CGfGtvclB8Dcl7begtL/fKfG0kHQPL/o0HhnpLSOE0ML8QIloc3 fsxIG+9/5/DIowAMZbmtSGSZ+EDLx1lGKZocVITo= Received: from wojtek.intra (localhost [127.0.0.1]) by wojtek.intra (8.16.1/8.16.1) with ESMTP id 38DHKTdX026155; Wed, 13 Sep 2023 19:20:29 +0200 (CEST) (envelope-from wojtek@puchar.net) Received: from localhost (wojtek@localhost) by wojtek.intra (8.16.1/8.16.1/Submit) with ESMTP id 38DHKTTd026152; Wed, 13 Sep 2023 19:20:29 +0200 (CEST) (envelope-from wojtek@puchar.net) X-Authentication-Warning: wojtek.intra: wojtek owned process doing -bs Date: Wed, 13 Sep 2023 19:20:29 +0200 (CEST) From: Wojciech Puchar To: Guy Helmer cc: freebsd-hackers@freebsd.org Subject: Re: Unable to access GPT disk partitions - No such file or directory In-Reply-To: <0CAE8FD0-9F09-4CF6-A402-DF30B039DF23@gmail.com> Message-ID: <7641162f-746f-8fda-2fbc-731bd17e844f@puchar.net> References: <0CAE8FD0-9F09-4CF6-A402-DF30B039DF23@gmail.com> List-Id: Technical discussions relating to FreeBSD List-Archive: https://lists.freebsd.org/archives/freebsd-hackers List-Help: List-Post: List-Subscribe: List-Unsubscribe: Sender: owner-freebsd-hackers@freebsd.org MIME-Version: 1.0 Content-Type: multipart/mixed; boundary="3974694515-57017809-1694625629=:26131" X-Spamd-Bar: -- X-Spamd-Result: default: False [-2.50 / 15.00]; NEURAL_HAM_LONG(-1.00)[-1.000]; NEURAL_HAM_MEDIUM(-1.00)[-1.000]; CTYPE_MIXED_BOGUS(1.00)[]; NEURAL_HAM_SHORT(-1.00)[-1.000]; R_DKIM_ALLOW(-0.20)[puchar.net:s=default]; R_SPF_ALLOW(-0.20)[+mx]; MIME_GOOD(-0.10)[multipart/mixed,text/plain]; MLMMJ_DEST(0.00)[freebsd-hackers@freebsd.org]; DKIM_TRACE(0.00)[puchar.net:+]; ARC_NA(0.00)[]; MIME_TRACE(0.00)[0:+,1:+]; FROM_EQ_ENVFROM(0.00)[]; FREEMAIL_TO(0.00)[gmail.com]; ASN(0.00)[asn:43476, ipnet:194.1.144.0/24, country:PL]; RCVD_TLS_LAST(0.00)[]; RCPT_COUNT_TWO(0.00)[2]; TO_MATCH_ENVRCPT_SOME(0.00)[]; RCVD_COUNT_TWO(0.00)[2]; TO_DN_SOME(0.00)[]; FROM_HAS_DN(0.00)[]; BLOCKLISTDE_FAIL(0.00)[194.1.144.90:server fail]; TAGGED_RCPT(0.00)[]; DMARC_NA(0.00)[puchar.net]; HAS_XAW(0.00)[]; MID_RHS_MATCH_FROM(0.00)[] X-Rspamd-Queue-Id: 4Rm6fZ5m38z4KHP This message is in MIME format. The first part should be readable text, while the remaining parts are likely unreadable without MIME-aware tools. --3974694515-57017809-1694625629=:26131 Content-Type: text/plain; charset=ISO-8859-15; format=flowed Content-Transfer-Encoding: 8BIT >    Mode: r0w0e0 > > The /dev entries look OK to me: > $ ls -l /dev/da2* > crw-r-----  1 root  operator  0x66 Sep 13 14:01 /dev/da2 > crw-r-----  1 root  operator  0x6c Sep 13 14:01 /dev/da2p1 > crw-r-----  1 root  operator  0x6d Sep 13 14:01 /dev/da2p2 > crw-r-----  1 root  operator  0x6e Sep 13 14:01 /dev/da2p3 > crw-r-----  1 root  operator  0x6f Sep 13 14:01 /dev/da2p4 > $ ls -l /dev/gpt/ > total 0 > crw-r-----  1 root  operator  0x75 Sep 13 14:01 gpboot1 > crw-r-----  1 root  operator  0x77 Sep 13 14:01 gprootfs1 > crw-r-----  1 root  operator  0x79 Sep 13 14:01 gpswap1 > crw-r-----  1 root  operator  0x7b Sep 13 14:01 gpusrfs1 > i don't think it's FreeBSD problem at all. Can you do dd from da2 or da2p2 to /dev/null? > However, any attempt to access the /dev entries fails with "No such file or directory": > > $ sudo fsck /dev/da2p2 > Can't open /dev/da2p2: No such file or directory > $ sudo fsck /dev/da2p4 > Can't open /dev/da2p4: No such file or directory > $ sudo fsck /dev/gpt/gprootfs1  > Can't open /dev/gpt/gprootfs1: No such file or directory > $ sudo fsck /dev/gpt/gpusrfs1  > Can't open /dev/gpt/gpusrfs1: No such file or directory > > I've never had an issue like this before and I can't find anything using Google searches that resolves access to these disk devices. > Any ideas? > > Thanks, > Guy Helmer, Ph.D. > > > --3974694515-57017809-1694625629=:26131-- From nobody Wed Sep 13 18:52:57 2023 X-Original-To: freebsd-hackers@mlmmj.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mlmmj.nyi.freebsd.org (Postfix) with ESMTP id 4Rm8jL3V8qz4sslx for ; Wed, 13 Sep 2023 18:53:10 +0000 (UTC) (envelope-from guy.helmer@gmail.com) Received: from mail-yb1-xb33.google.com (mail-yb1-xb33.google.com [IPv6:2607:f8b0:4864:20::b33]) (using TLSv1.3 with cipher TLS_AES_128_GCM_SHA256 (128/128 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (2048 bits) client-digest SHA256) (Client CN "smtp.gmail.com", Issuer "GTS CA 1D4" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4Rm8jL1s8bz4dbx for ; Wed, 13 Sep 2023 18:53:10 +0000 (UTC) (envelope-from guy.helmer@gmail.com) Authentication-Results: mx1.freebsd.org; none Received: by mail-yb1-xb33.google.com with SMTP id 3f1490d57ef6-d7b9c04591fso152739276.3 for ; Wed, 13 Sep 2023 11:53:10 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20221208; t=1694631189; x=1695235989; darn=freebsd.org; h=to:references:message-id:content-transfer-encoding:cc:date :in-reply-to:from:subject:mime-version:from:to:cc:subject:date :message-id:reply-to; bh=DqOPnsnViqaGuDJXfcP2WLtKn1pHbClkh7nly0awqQk=; b=THgetiLbOtx+riHVL2l6iJIGDnYOWDqdHNNrfyKG4xxHwQzNOu2Or+AlRYDSPD9WtQ 51eDPJSPInftu/n3QxkqhClUYEHHMywcZUPqe0G/fTvtQ5HnY2XdyFzxN8Y5wc+MelZI FmTcxC67H09iompIlZIxdmk0s69Gy/2X+OANGsOAlhPhCBl/dgMNU75e9r5F00u5HngG /oPHAvp2hKjGx0D6xsDBXSTK2C9lM4UoGBn+HyKj2WAn8aXDs7uzm22b10++VZ8cApUm pqYEtnyjqk+UQqc1aEmU7J/ZzOtx/KeIJMPTmJ90WhA09TnZu79k+OM3lO+jM5PUEnqS 2FNg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1694631189; x=1695235989; h=to:references:message-id:content-transfer-encoding:cc:date :in-reply-to:from:subject:mime-version:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=DqOPnsnViqaGuDJXfcP2WLtKn1pHbClkh7nly0awqQk=; b=G7tjE5+ipHzBdErGW+WB4dGTt+3dBONbW7zOODRWQNr7SiEPOznvnnfTMwQT+6WtMo pB4iwNo6Q3QdD/DuR1BBU6iDdT3UkhwTLsM7hrGkw82AeJFAzelWsP1FqRsq4tE0kzh5 YQsqyoivM1PskNC43rl8nGbkGjlSJM7raPzr1aZacFxefebS0QAUVTvvkU5Ff6Qwt9Mc ErEU4TuTWYnl7bdHg8QLmTEhVnnkbMm0MG5qK3Lo2JFPhp+h0uaXbFTrXWXJaE5nA1tb Z0X70CZ5t12A/KQuGsElYoFd/aqnL8Ih8ZceFv1SjlVIDyYH4Cp0C54K5KSgy8TWZRbU rs4Q== X-Gm-Message-State: AOJu0YwwQucdOQbI/JQXMgDukXKE490/pk0z+nPh+zfxckY+sKhTSATs zCV+4c3Pgkxq20Fio3LilNpZlydX6/k= X-Google-Smtp-Source: AGHT+IF9V1I80k7yV2xEFAc5P/J8i3/2iPpaDocDIqYzInA0cIzNwYBJy8Fzx1+rd1Ot1U0qoGfsOw== X-Received: by 2002:a25:dc0d:0:b0:d7a:cb32:2747 with SMTP id y13-20020a25dc0d000000b00d7acb322747mr3553011ybe.17.1694631189308; Wed, 13 Sep 2023 11:53:09 -0700 (PDT) Received: from smtpclient.apple (1636571-static.amesiaaa.metronetinc.net. [217.180.226.49]) by smtp.gmail.com with ESMTPSA id d1-20020a5b00c1000000b00d20d4ffbbdbsm2757197ybp.0.2023.09.13.11.53.08 (version=TLS1_2 cipher=ECDHE-ECDSA-AES128-GCM-SHA256 bits=128/128); Wed, 13 Sep 2023 11:53:08 -0700 (PDT) Content-Type: text/plain; charset=us-ascii List-Id: Technical discussions relating to FreeBSD List-Archive: https://lists.freebsd.org/archives/freebsd-hackers List-Help: List-Post: List-Subscribe: List-Unsubscribe: Sender: owner-freebsd-hackers@freebsd.org Mime-Version: 1.0 (Mac OS X Mail 16.0 \(3731.700.6\)) Subject: Re: Unable to access GPT disk partitions - No such file or directory From: Guy Helmer In-Reply-To: Date: Wed, 13 Sep 2023 13:52:57 -0500 Cc: freebsd-hackers@freebsd.org Content-Transfer-Encoding: quoted-printable Message-Id: References: <0CAE8FD0-9F09-4CF6-A402-DF30B039DF23@gmail.com> To: Eugene Grosbein X-Mailer: Apple Mail (2.3731.700.6) X-Spamd-Bar: ---- X-Rspamd-Pre-Result: action=no action; module=replies; Message is reply to one we originated X-Spamd-Result: default: False [-4.00 / 15.00]; REPLY(-4.00)[]; ASN(0.00)[asn:15169, ipnet:2607:f8b0::/32, country:US]; TAGGED_FROM(0.00)[] X-Rspamd-Queue-Id: 4Rm8jL1s8bz4dbx On Sep 13, 2023, at 8:35 AM, Eugene Grosbein wrote: >=20 > 13.09.2023 20:02, Guy Helmer wrote: >=20 >> $ sudo fsck /dev/da2p2 >> Can't open /dev/da2p2: No such file or directory >> $ sudo fsck /dev/da2p4 >> Can't open /dev/da2p4: No such file or directory >> $ sudo fsck /dev/gpt/gprootfs1=20 >> Can't open /dev/gpt/gprootfs1: No such file or directory >> $ sudo fsck /dev/gpt/gpusrfs1=20 >> Can't open /dev/gpt/gpusrfs1: No such file or directory >>=20 >> I've never had an issue like this before and I can't find anything = using Google searches that resolves access to these disk devices. Any = ideas? >=20 > dmesg -a > glabel status Hi, Eugene, thanks for inquiring. Appreciate any assistance! dmesg -a: $ dmesg -a ---<>--- Copyright (c) 1992-2019 The FreeBSD Project. Copyright (c) 1979, 1980, 1983, 1986, 1988, 1989, 1991, 1992, 1993, 1994 The Regents of the University of California. All rights = reserved. FreeBSD is a registered trademark of The FreeBSD Foundation. FreeBSD 12.0-STABLE r348375 GENERIC amd64 FreeBSD clang version 8.0.0 (tags/RELEASE_800/final 356365) (based on = LLVM 8.0.0) VT(vga): text 80x25 CPU: Intel(R) Xeon(R) W-2123 CPU @ 3.60GHz (3600.00-MHz K8-class CPU) Origin=3D"GenuineIntel" Id=3D0x50654 Family=3D0x6 Model=3D0x55 = Stepping=3D4 = Features=3D0x1f83fbff = Features2=3D0xfefa3203 AMD Features=3D0x2c100800 AMD Features2=3D0x101 Structured Extended Features=3D0x2c1 Structured Extended = Features3=3D0xbc000400 IA32_ARCH_CAPS=3D0xc TSC: P-state invariant Hypervisor: Origin =3D "VMwareVMware" real memory =3D 4294967296 (4096 MB) avail memory =3D 4099141632 (3909 MB) Event timer "LAPIC" quality 600 ACPI APIC Table: FreeBSD/SMP: Multiprocessor System Detected: 2 CPUs FreeBSD/SMP: 1 package(s) x 2 core(s) random: unblocking device. MADT: Forcing active-low polarity and level trigger for SCI ioapic0 irqs 0-23 on motherboard Launching APs: 1 random: entropy device external interface kbd1 at kbdmux0 000.000023 [4254] netmap_init netmap: loaded module [ath_hal] loaded module_register_init: MOD_LOAD (vesa, 0xffffffff8112d9c0, 0) error 19 random: registering fast source Intel Secure Key RNG random: fast provider: "Intel Secure Key RNG" nexus0 vtvga0: on motherboard cryptosoft0: on motherboard acpi0: on motherboard acpi0: Power Button (fixed) hpet0: iomem 0xfed00000-0xfed003ff on acpi0 Timecounter "HPET" frequency 14318180 Hz quality 950 cpu0: numa-domain 0 on acpi0 attimer0: port 0x40-0x43 irq 0 on acpi0 Timecounter "i8254" frequency 1193182 Hz quality 0 Event timer "i8254" frequency 1193182 Hz quality 100 atrtc0: port 0x70-0x71 irq 8 on acpi0 atrtc0: registered as a time-of-day clock, resolution 1.000000s Event timer "RTC" frequency 32768 Hz quality 0 Timecounter "ACPI-fast" frequency 3579545 Hz quality 900 acpi_timer0: <24-bit timer at 3.579545MHz> port 0x1008-0x100b on acpi0 pcib0: port 0xcf8-0xcff on acpi0 pci0: on pcib0 pcib1: at device 1.0 on pci0 pci1: on pcib1 isab0: at device 7.0 on pci0 isa0: on isab0 atapci0: port = 0x1f0-0x1f7,0x3f6,0x170-0x177,0x376,0x1060-0x106f at device 7.1 on pci0 ata0: at channel 0 on atapci0 ata1: at channel 1 on atapci0 pci0: at device 7.3 (no driver attached) vgapci0: port 0x1070-0x107f mem = 0xec000000-0xefffffff,0xfe000000-0xfe7fffff irq 16 at device 15.0 on = pci0 vgapci0: Boot video device mpt0: port 0x1400-0x14ff mem = 0xfeba0000-0xfebbffff,0xfebc0000-0xfebdffff irq 17 at device 16.0 on = pci0 mpt0: MPI Version=3D1.2.0.0 pcib2: at device 17.0 on pci0 pci2: on pcib2 em0: port 0x2000-0x203f mem = 0xfd5c0000-0xfd5dffff,0xfdff0000-0xfdffffff irq 18 at device 0.0 on pci2 em0: Using 1024 tx descriptors and 1024 rx descriptors em0: Ethernet address: 00:0c:29:98:11:54 em0: link state changed to UP em0: netmap queues/slots: TX 1/1024, RX 1/1024 pcib3: at device 21.0 on pci0 pcib3: [GIANT-LOCKED] pcib4: at device 21.1 on pci0 pcib4: [GIANT-LOCKED] pcib5: at device 21.2 on pci0 pcib5: [GIANT-LOCKED] pcib6: at device 21.3 on pci0 pcib6: [GIANT-LOCKED] pcib7: at device 21.4 on pci0 pcib7: [GIANT-LOCKED] pcib8: at device 21.5 on pci0 pcib8: [GIANT-LOCKED] pcib9: at device 21.6 on pci0 pcib9: [GIANT-LOCKED] pcib10: at device 21.7 on pci0 pcib10: [GIANT-LOCKED] pcib11: at device 22.0 on pci0 pcib11: [GIANT-LOCKED] pcib12: at device 22.1 on pci0 pcib12: [GIANT-LOCKED] pcib13: at device 22.2 on pci0 pcib13: [GIANT-LOCKED] pcib14: at device 22.3 on pci0 pcib14: [GIANT-LOCKED] pcib15: at device 22.4 on pci0 pcib15: [GIANT-LOCKED] pcib16: at device 22.5 on pci0 pcib16: [GIANT-LOCKED] pcib17: at device 22.6 on pci0 pcib17: [GIANT-LOCKED] pcib18: at device 22.7 on pci0 pcib18: [GIANT-LOCKED] pcib19: at device 23.0 on pci0 pcib19: [GIANT-LOCKED] pcib20: at device 23.1 on pci0 pcib20: [GIANT-LOCKED] pcib21: at device 23.2 on pci0 pcib21: [GIANT-LOCKED] pcib22: at device 23.3 on pci0 pcib22: [GIANT-LOCKED] pcib23: at device 23.4 on pci0 pcib23: [GIANT-LOCKED] pcib24: at device 23.5 on pci0 pcib24: [GIANT-LOCKED] pcib25: at device 23.6 on pci0 pcib25: [GIANT-LOCKED] pcib26: at device 23.7 on pci0 pcib26: [GIANT-LOCKED] pcib27: at device 24.0 on pci0 pcib27: [GIANT-LOCKED] pcib28: at device 24.1 on pci0 pcib28: [GIANT-LOCKED] pcib29: at device 24.2 on pci0 pcib29: [GIANT-LOCKED] pcib30: at device 24.3 on pci0 pcib30: [GIANT-LOCKED] pcib31: at device 24.4 on pci0 pcib31: [GIANT-LOCKED] pcib32: at device 24.5 on pci0 pcib32: [GIANT-LOCKED] pcib33: at device 24.6 on pci0 pcib33: [GIANT-LOCKED] pcib34: at device 24.7 on pci0 pcib34: [GIANT-LOCKED] acpi_acad0: on acpi0 atkbdc0: port 0x60,0x64 irq 1 on acpi0 atkbd0: irq 1 on atkbdc0 kbd0 at atkbd0 atkbd0: [GIANT-LOCKED] psm0: irq 12 on atkbdc0 psm0: [GIANT-LOCKED] psm0: model IntelliMouse, device ID 3 acpi_syscontainer0: on acpi0 ppc0: port 0x378-0x37b irq 7 on acpi0 ppc0: Generic chipset (NIBBLE-only) in COMPATIBLE mode ppbus0: on ppc0 lpt0: on ppbus0 lpt0: Interrupt-driven port ppi0: on ppbus0 uart0: <16550 or compatible> port 0x3f8-0x3ff irq 4 flags 0x10 on acpi0 uart1: <16550 or compatible> port 0x2f8-0x2ff irq 3 on acpi0 fdc0: port 0x3f0-0x3f5,0x3f7 irq 6 drq 2 on = acpi0 fd0: <1440-KB 3.5" drive> on fdc0 drive 0 orm0: at iomem = 0xc0000-0xc7fff,0xc8000-0xc9fff,0xca000-0xcafff,0xdc000-0xdffff,0xe0000-0x= e7fff pnpid ORM0000 on isa0 vga0: at port 0x3c0-0x3df iomem 0xa0000-0xbffff pnpid = PNP0900 on isa0 Timecounters tick every 10.000 msec usb_needs_explore_all: no devclass da0 at mpt0 bus 0 scbus2 target 0 lun 0 da0: Fixed Direct Access SCSI-2 device da0: 320.000MB/s transfers (160.000MHz, offset 127, 16bit) da0: Command Queueing enabled da0: 614400MB (1258291200 512 byte sectors) da0: quirks=3D0x140 da1 at mpt0 bus 0 scbus2 target 1 lun 0 da1: Fixed Direct Access SCSI-2 device da1: 320.000MB/s transfers (160.000MHz, offset 127, 16bit) da1: Command Queueing enabled da1: 614400MB (1258291200 512 byte sectors) da1: quirks=3D0x140 cd0 at ata1 bus 0 scbus1 target 0 lun 0 cd0: Removable CD-ROM SCSI device cd0: Serial Number 10000000000000000001 cd0: 33.300MB/s transfers (UDMA2, ATAPI 12bytes, PIO 65534bytes) cd0: 719MB (368571 2048 byte sectors) cd0: quirks=3D0x40 da2 at mpt0 bus 0 scbus2 target 2 lun 0 da2: Fixed Direct Access SCSI-2 device da2: 320.000MB/s transfers (160.000MHz, offset 127, 16bit) da2: Command Queueing enabled da2: 81920MB (167772160 512 byte sectors) da2: quirks=3D0x140 Trying to mount root from ufs:/dev/da0s1a [rw]... WARNING: / was not properly dismounted Setting hostuuid: 564df414-3428-030c-05fc-eee74d981154. Setting hostid: 0xb2316d34. ZFS NOTICE: Prefetch is disabled by default if less than 4GB of RAM is = present; to enable, add "vfs.zfs.prefetch_disable=3D0" to = /boot/loader.conf. ZFS filesystem version: 5 ZFS storage pool version: features support (5000) Starting file system checks: ** SU+J Recovering /dev/da0s1a ** Reading 33554432 byte journal from inode 4. ** Building recovery table. ** Resolving unreferenced inode list. ** Processing journal entries. ** 4 journal records in 512 bytes for 25.00% utilization ** Freed 2 inodes (0 dirs) 10 blocks, and 0 frags. ***** FILE SYSTEM MARKED CLEAN ***** Mounting local filesystems:. ELF ldconfig path: /lib /usr/lib /usr/lib/compat /usr/local/lib = /usr/local/lib/compat/pkg /usr/local/lib/compat/pkg = /usr/local/lib/perl5/5.28/mach/CORE /usr/local/lib/samba4 = /usr/local/lib/samba4/private 32-bit compatibility ldconfig path: /usr/lib32 Setting hostname: share.ghelmer.com. Setting up harvesting: = PURE_RDRAND,[UMA],[FS_ATIME],SWI,INTERRUPT,NET_NG,NET_ETHER,NET_TUN,MOUSE,= KEYBOARD,ATTACH,CACHED Feeding entropy: . lo0: link state changed to UP Starting Network: lo0 em0. lo0: flags=3D8049 metric 0 mtu 16384 options=3D680003 inet6 ::1 prefixlen 128 inet6 fe80::1%lo0 prefixlen 64 scopeid 0x2 inet 127.0.0.1 netmask 0xff000000 groups: lo nd6 options=3D21 em0: flags=3D8843 metric 0 mtu = 1500 = options=3D81009b ether 00:0c:29:98:11:54 media: Ethernet autoselect (1000baseT ) status: active nd6 options=3D29 Starting devd. Starting dhclient. DHCPDISCOVER on em0 to 255.255.255.255 port 67 interval 8 DHCPOFFER from 192.168.4.1 DHCPREQUEST on em0 to 255.255.255.255 port 67 DHCPACK from 192.168.4.1 bound to 192.168.5.184 -- renewal in 7200 seconds. add host 127.0.0.1: gateway lo0 fib 0: route already in table add host ::1: gateway lo0 fib 0: route already in table add net fe80::: gateway ::1 add net ff02::: gateway ::1 add net ::ffff:0.0.0.0: gateway ::1 add net ::0.0.0.0: gateway ::1 Creating and/or trimming log files. Starting syslogd. No core dumps found. Clearing /tmp (X related). Starting ntpd. Sep 13 14:02:13 share ntpd[585]: leapsecond file = ('/var/db/ntpd.leap-seconds.list'): expired less than 1173 days ago Updating motd:. Mounting late filesystems:. Configuring vt: blanktime. Performing sanity check on sshd configuration. Starting sshd. Starting cron. Starting background file system checks in 60 seconds. $ sudo glabel status Password: Name Status Components iso9660/11_2_BETA1_AMD64_CD N/A cd0 gpt/gpboot1 N/A da2p1 gptid/76c936da-f200-11e4-b749-000c29d7feb4 N/A da2p1 gpt/gprootfs1 N/A da2p2 gpt/gpswap1 N/A da2p3 gptid/a2ed8c2e-f200-11e4-b749-000c29d7feb4 N/A da2p3 gpt/gpusrfs1 N/A da2p4 gptid/a84afad7-f200-11e4-b749-000c29d7feb4 N/A da2p4 From nobody Wed Sep 13 18:57:28 2023 X-Original-To: freebsd-hackers@mlmmj.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mlmmj.nyi.freebsd.org (Postfix) with ESMTP id 4Rm8pY3D9yz4svLl for ; Wed, 13 Sep 2023 18:57:41 +0000 (UTC) (envelope-from guy.helmer@gmail.com) Received: from mail-yb1-xb35.google.com (mail-yb1-xb35.google.com [IPv6:2607:f8b0:4864:20::b35]) (using TLSv1.3 with cipher TLS_AES_128_GCM_SHA256 (128/128 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (2048 bits) client-digest SHA256) (Client CN "smtp.gmail.com", Issuer "GTS CA 1D4" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4Rm8pY0Mrvz4fVr for ; Wed, 13 Sep 2023 18:57:41 +0000 (UTC) (envelope-from guy.helmer@gmail.com) Authentication-Results: mx1.freebsd.org; none Received: by mail-yb1-xb35.google.com with SMTP id 3f1490d57ef6-d7260fae148so170223276.1 for ; Wed, 13 Sep 2023 11:57:41 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20221208; t=1694631460; x=1695236260; darn=freebsd.org; h=references:to:cc:in-reply-to:date:subject:mime-version:message-id :from:from:to:cc:subject:date:message-id:reply-to; bh=SyfVx8410vi6LcXJehW1i5bCFDNcABeE6QlNr4bSO58=; b=nVIgJ36TX1qkdcotgpb21eVeu0dwl7BAlAW64S6ovfhqWJtKwmmfkdkyRHYYZHCHsm VOYwtzY2y8Dgx7kj6sHBjuyXtMYcx3usudFUPIpFa0np8sr/GpyU0EIrkWcKASc4j9ao xRppHdHCyXaLoqLaowvsQsEy2RhWmFO+MpYJmCnHWT1u4zJAMu/pBqqzZM/ooEg+5djE fxbAgoVlJDrC/iAR13lIfI+qR8W2blc7b9Klqc5kmz1iNfYxY8/JMMGWFj7UI1kWooHz S6dp1ggKjQ+EPODmank+302qOA8OOxR81FsBYMUdPxqSSxYHPPfkuOaQGHjpUQTWrKan aFqA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1694631460; x=1695236260; h=references:to:cc:in-reply-to:date:subject:mime-version:message-id :from:x-gm-message-state:from:to:cc:subject:date:message-id:reply-to; bh=SyfVx8410vi6LcXJehW1i5bCFDNcABeE6QlNr4bSO58=; b=crP7ZOBeEq7pkhsT9XpCfIKUPE4kwuPmpSPabx/MNi/fHECXT/waLJ6N9R9xhKj9xh cF6fCqiCuTgchQxzf69Nm31l+AnSXur2p77FW7rbLsyqVE+vjxZsXdNdlD7qs9COPuNq nTn5AV86ZnF2XEXqW5ulZg4WKtNPPu1cwOleGD2GxidkKMVFQXOu0bL5NTVsoYn03Ptx R+NF7hqXa4oEKEc3kwFJb5nd6FhHqRwbPK7Qc4UL2NyfGjVlXvZJ23OwTMWA/wxHXHps Ti0wlOG2RG/szK5H1frGIQ71ZTjs5m7Rr7zbLgH6P+MqS9t/YlZP8EW/sgMNeCr6XsgV do5w== X-Gm-Message-State: AOJu0YwNEHDRDA64f5AlW1Pxme14DTyGXBDsZ8Ou1UM8BsRt3jKpF5ao MGKjeMRMcHRTsL35dqEdyubpVP/lyE4= X-Google-Smtp-Source: AGHT+IGE1kGdPvhvMPa5IcsLhDi1htvkfEInw8o6ptt9YaniyZzZXYCIKGY0AidJxjPkhzcubUYcrQ== X-Received: by 2002:a25:be05:0:b0:d7a:c85b:278c with SMTP id h5-20020a25be05000000b00d7ac85b278cmr3138993ybk.56.1694631460193; Wed, 13 Sep 2023 11:57:40 -0700 (PDT) Received: from smtpclient.apple (1636571-static.amesiaaa.metronetinc.net. [217.180.226.49]) by smtp.gmail.com with ESMTPSA id g25-20020a25b119000000b00d748501d9b4sm2867363ybj.21.2023.09.13.11.57.39 (version=TLS1_2 cipher=ECDHE-ECDSA-AES128-GCM-SHA256 bits=128/128); Wed, 13 Sep 2023 11:57:39 -0700 (PDT) From: Guy Helmer Message-Id: <4FA71559-A6D5-4DDF-95A1-DA714C5C32EB@gmail.com> Content-Type: multipart/alternative; boundary="Apple-Mail=_1560409D-1B16-410E-8314-EDE9DB7E1515" List-Id: Technical discussions relating to FreeBSD List-Archive: https://lists.freebsd.org/archives/freebsd-hackers List-Help: List-Post: List-Subscribe: List-Unsubscribe: Sender: owner-freebsd-hackers@freebsd.org Mime-Version: 1.0 (Mac OS X Mail 16.0 \(3731.700.6\)) Subject: Re: Unable to access GPT disk partitions - No such file or directory Date: Wed, 13 Sep 2023 13:57:28 -0500 In-Reply-To: <7641162f-746f-8fda-2fbc-731bd17e844f@puchar.net> Cc: freebsd-hackers@freebsd.org To: Wojciech Puchar References: <0CAE8FD0-9F09-4CF6-A402-DF30B039DF23@gmail.com> <7641162f-746f-8fda-2fbc-731bd17e844f@puchar.net> X-Mailer: Apple Mail (2.3731.700.6) X-Spamd-Bar: ---- X-Rspamd-Pre-Result: action=no action; module=replies; Message is reply to one we originated X-Spamd-Result: default: False [-4.00 / 15.00]; REPLY(-4.00)[]; ASN(0.00)[asn:15169, ipnet:2607:f8b0::/32, country:US]; TAGGED_FROM(0.00)[] X-Rspamd-Queue-Id: 4Rm8pY0Mrvz4fVr --Apple-Mail=_1560409D-1B16-410E-8314-EDE9DB7E1515 Content-Transfer-Encoding: quoted-printable Content-Type: text/plain; charset=us-ascii > On Sep 13, 2023, at 12:20 PM, Wojciech Puchar = wrote: >=20 >> Mode: r0w0e0 >> The /dev entries look OK to me: >> $ ls -l /dev/da2* >> crw-r----- 1 root operator 0x66 Sep 13 14:01 /dev/da2 >> crw-r----- 1 root operator 0x6c Sep 13 14:01 /dev/da2p1 >> crw-r----- 1 root operator 0x6d Sep 13 14:01 /dev/da2p2 >> crw-r----- 1 root operator 0x6e Sep 13 14:01 /dev/da2p3 >> crw-r----- 1 root operator 0x6f Sep 13 14:01 /dev/da2p4 >> $ ls -l /dev/gpt/ >> total 0 >> crw-r----- 1 root operator 0x75 Sep 13 14:01 gpboot1 >> crw-r----- 1 root operator 0x77 Sep 13 14:01 gprootfs1 >> crw-r----- 1 root operator 0x79 Sep 13 14:01 gpswap1 >> crw-r----- 1 root operator 0x7b Sep 13 14:01 gpusrfs1 >>=20 >=20 > i don't think it's FreeBSD problem at all. >=20 > Can you do dd from da2 or da2p2 to /dev/null? >=20 >> However, any attempt to access the /dev entries fails with "No such = file or directory": >> $ sudo fsck /dev/da2p2 >> Can't open /dev/da2p2: No such file or directory >> $ sudo fsck /dev/da2p4 >> Can't open /dev/da2p4: No such file or directory >> $ sudo fsck /dev/gpt/gprootfs1=20 >> Can't open /dev/gpt/gprootfs1: No such file or directory >> $ sudo fsck /dev/gpt/gpusrfs1=20 >> Can't open /dev/gpt/gpusrfs1: No such file or directory >> I've never had an issue like this before and I can't find anything = using Google searches that resolves access to these disk devices. >> Any ideas? >> Thanks, >> Guy Helmer, Ph.D. Hi, Wojciech, thanks for the response - appreciate any assistance. dd = seems to be able to read OK from the devices: $ sudo dd if=3D/dev/da2 of=3D/dev/null bs=3D4096 count=3D1000 1000+0 records in 1000+0 records out 4096000 bytes transferred in 0.109224 secs (37500992 bytes/sec) $ sudo dd if=3D/dev/da2p2 of=3D/dev/null bs=3D4096 1048576+0 records in 1048576+0 records out 4294967296 bytes transferred in 56.561789 secs (75934078 bytes/sec) $ sudo dd if=3D/dev/da2p4 of=3D/dev/null bs=3D4096 count=3D1000 1000+0 records in 1000+0 records out 4096000 bytes transferred in 0.119445 secs (34291805 bytes/sec) Guy --Apple-Mail=_1560409D-1B16-410E-8314-EDE9DB7E1515 Content-Transfer-Encoding: quoted-printable Content-Type: text/html; charset=us-ascii
On Sep 13, 2023, = at 12:20 PM, Wojciech Puchar <wojtek@puchar.net> wrote:

   Mode: r0w0e0
The /dev entries = look OK to me:
$ ls -l /dev/da2*
crw-r-----  1 root =  operator  0x66 Sep 13 14:01 /dev/da2
crw-r-----  1 = root  operator  0x6c Sep 13 14:01 /dev/da2p1
crw-r----- =  1 root  operator  0x6d Sep 13 14:01 = /dev/da2p2
crw-r-----  1 root  operator  0x6e Sep 13 = 14:01 /dev/da2p3
crw-r-----  1 root  operator  0x6f = Sep 13 14:01 /dev/da2p4
$ ls -l /dev/gpt/
total 0
crw-r----- =  1 root  operator  0x75 Sep 13 14:01 = gpboot1
crw-r-----  1 root  operator  0x77 Sep 13 = 14:01 gprootfs1
crw-r-----  1 root  operator  0x79 Sep = 13 14:01 gpswap1
crw-r-----  1 root  operator  0x7b = Sep 13 14:01 gpusrfs1


i don't = think it's FreeBSD problem at all.

Can you = do dd from da2 or da2p2 to /dev/null?

However, any attempt to access the /dev entries = fails with "No such file or directory":
$ sudo fsck = /dev/da2p2
Can't open /dev/da2p2: No such file or directory
$ sudo = fsck /dev/da2p4
Can't open /dev/da2p4: No such file or directory
$ = sudo fsck /dev/gpt/gprootfs1 
Can't open /dev/gpt/gprootfs1: No = such file or directory
$ sudo fsck /dev/gpt/gpusrfs1 
Can't = open /dev/gpt/gpusrfs1: No such file or directory
I've never had an = issue like this before and I can't find anything using Google searches = that resolves access to these disk devices.
Any = ideas?
Thanks,
Guy Helmer, = Ph.D.

Hi, Wojciech, thanks = for the response - appreciate any assistance. dd seems to be able to = read OK from the devices:

$ sudo dd = if=3D/dev/da2 of=3D/dev/null bs=3D4096 count=3D1000
1000+0 records = in
1000+0 records out
4096000 bytes transferred in 0.109224 secs = (37500992 bytes/sec)
$ sudo dd if=3D/dev/da2p2 of=3D/dev/null = bs=3D4096
1048576+0 records in
1048576+0 records = out
4294967296 bytes transferred in 56.561789 secs (75934078 = bytes/sec)
$ sudo dd if=3D/dev/da2p4 of=3D/dev/null = bs=3D4096 count=3D1000
1000+0 records in
1000+0 = records out
4096000 bytes transferred in 0.119445 secs = (34291805 = bytes/sec)

Guy

= = --Apple-Mail=_1560409D-1B16-410E-8314-EDE9DB7E1515-- From nobody Thu Sep 14 03:54:13 2023 X-Original-To: freebsd-hackers@mlmmj.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mlmmj.nyi.freebsd.org (Postfix) with ESMTP id 4RmNjq7234z4sYq5 for ; Thu, 14 Sep 2023 03:54:23 +0000 (UTC) (envelope-from grahamperrin@gmail.com) Received: from mail-ed1-x52a.google.com (mail-ed1-x52a.google.com [IPv6:2a00:1450:4864:20::52a]) (using TLSv1.3 with cipher TLS_AES_128_GCM_SHA256 (128/128 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (2048 bits) client-digest SHA256) (Client CN "smtp.gmail.com", Issuer "GTS CA 1D4" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4RmNjq1Hyqz4HS7 for ; Thu, 14 Sep 2023 03:54:23 +0000 (UTC) (envelope-from grahamperrin@gmail.com) Authentication-Results: mx1.freebsd.org; dkim=pass header.d=gmail.com header.s=20221208 header.b=atWUrA3J; spf=pass (mx1.freebsd.org: domain of grahamperrin@gmail.com designates 2a00:1450:4864:20::52a as permitted sender) smtp.mailfrom=grahamperrin@gmail.com; dmarc=pass (policy=none) header.from=gmail.com Received: by mail-ed1-x52a.google.com with SMTP id 4fb4d7f45d1cf-52a39a1c4d5so493040a12.3 for ; Wed, 13 Sep 2023 20:54:23 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20221208; t=1694663659; x=1695268459; darn=freebsd.org; h=content-transfer-encoding:in-reply-to:subject:from:cc :content-language:references:to:user-agent:mime-version:date :message-id:from:to:cc:subject:date:message-id:reply-to; bh=0cqq7xZZWMT1DLdbLMURXt9vXJkdtg+dDbyO8VJwIvg=; b=atWUrA3JYCGWPlkaOV92FMAdvnPfjo5FZ7zgdWKHN6CGpvulZmM+9X6OJYk+Oo5Jiw Qvi3wWykqi152rUYApYH3eF7fyrYnRVk8EojB//n3uqY46rWGF5M9Ch7AkY59rOFphGs vnbfwr9K7OCMVzZUtkBzM172xhFqEN+MvNjN5sVUUh/9Mb7FBOvPGCsatSHqqJJOvNxx Rj6hdCnzmb/3dcdsahQRD37ynY4YD5X8ySnMTTqdWTGyn/oiqYcRpexw1W8KambO2XPP qs0C3HnDk1h9civpjnKoZdxyKZ+mvkvZgxORG6QvDJhjSFwHzUYZx6RooNzqQDNPCSnX 1XlA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1694663659; x=1695268459; h=content-transfer-encoding:in-reply-to:subject:from:cc :content-language:references:to:user-agent:mime-version:date :message-id:x-gm-message-state:from:to:cc:subject:date:message-id :reply-to; bh=0cqq7xZZWMT1DLdbLMURXt9vXJkdtg+dDbyO8VJwIvg=; b=w85+GtUqSifAwlFkmfimjudgWx0rNfJEvMm8FDOtPFDhEem1HZoD+DhUh+XC3VSgds jvyQ/GfI+YpkhHn5ek8wo7ekCC0c7AeOZIQMvUnZvoSyRghTuNWL9hqBYzM7MGLHxROg Sd6TnlQREbWNwSBEmUs4fOfPZu35SMr6mAfB7aZo8RG8hqXHBBvzw6BINGxZJLlkXJtw YTH/d9dCA0axaFiZ1zaRaHha+nxarg5joZTdQvnPnWf7ni4uFbt2q/yT+RohKymq/nGE MoY8/wZkgRJNX9NbMgaLTn//9rba2FYuILw4tUG87WeP7gz5UyxnNy/yi2mTTSB5uZwQ ru7w== X-Gm-Message-State: AOJu0YxcqFw7RDp7fh4QyS3Q5Rnoee1wHxeZbBAMPKX/EipQ4H9Rtykk JYn4rq8j7QySOANN3Tdm3wI= X-Google-Smtp-Source: AGHT+IE2SzxAhbSdUYCHFZePCVweBOzA5sPMO6aeTronQ9KofVbsFlvkjnB+UxUchsRQeZF7t0PrHA== X-Received: by 2002:aa7:c607:0:b0:523:b225:701a with SMTP id h7-20020aa7c607000000b00523b225701amr3846812edq.11.1694663658964; Wed, 13 Sep 2023 20:54:18 -0700 (PDT) Received: from [192.168.1.6] (80-42-66-93.dynamic.dsl.as9105.com. [80.42.66.93]) by smtp.gmail.com with ESMTPSA id g24-20020a056402115800b0052338f5b2a4sm340316edw.86.2023.09.13.20.54.17 (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Wed, 13 Sep 2023 20:54:17 -0700 (PDT) Message-ID: Date: Thu, 14 Sep 2023 04:54:13 +0100 List-Id: Technical discussions relating to FreeBSD List-Archive: https://lists.freebsd.org/archives/freebsd-hackers List-Help: List-Post: List-Subscribe: List-Unsubscribe: Sender: owner-freebsd-hackers@freebsd.org MIME-Version: 1.0 User-Agent: Mozilla/5.0 (X11; FreeBSD amd64; rv:102.0) Gecko/20100101 Thunderbird/102.15.0 To: Guy Helmer References: <0CAE8FD0-9F09-4CF6-A402-DF30B039DF23@gmail.com> Content-Language: en-US Cc: freebsd-hackers@freebsd.org From: Graham Perrin Subject: Re: Unable to access GPT disk partitions - No such file or directory In-Reply-To: Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 8bit X-Spamd-Bar: --- X-Spamd-Result: default: False [-3.98 / 15.00]; NEURAL_HAM_LONG(-1.00)[-1.000]; NEURAL_HAM_MEDIUM(-1.00)[-1.000]; NEURAL_HAM_SHORT(-0.98)[-0.984]; DMARC_POLICY_ALLOW(-0.50)[gmail.com,none]; R_SPF_ALLOW(-0.20)[+ip6:2a00:1450:4000::/36]; R_DKIM_ALLOW(-0.20)[gmail.com:s=20221208]; MIME_GOOD(-0.10)[text/plain]; FROM_HAS_DN(0.00)[]; FREEFALL_USER(0.00)[grahamperrin]; RCVD_VIA_SMTP_AUTH(0.00)[]; ARC_NA(0.00)[]; RCVD_IN_DNSWL_NONE(0.00)[2a00:1450:4864:20::52a:from]; TAGGED_RCPT(0.00)[]; TO_MATCH_ENVRCPT_SOME(0.00)[]; PREVIOUSLY_DELIVERED(0.00)[freebsd-hackers@freebsd.org]; DWL_DNSWL_NONE(0.00)[gmail.com:dkim]; MID_RHS_MATCH_FROM(0.00)[]; ASN(0.00)[asn:15169, ipnet:2a00:1450::/32, country:US]; DKIM_TRACE(0.00)[gmail.com:+]; RCPT_COUNT_TWO(0.00)[2]; FREEMAIL_FROM(0.00)[gmail.com]; TO_DN_SOME(0.00)[]; MLMMJ_DEST(0.00)[freebsd-hackers@freebsd.org]; FREEMAIL_TO(0.00)[gmail.com]; RCVD_TLS_LAST(0.00)[]; FROM_EQ_ENVFROM(0.00)[]; FREEMAIL_ENVFROM(0.00)[gmail.com]; MIME_TRACE(0.00)[0:+]; RCVD_COUNT_TWO(0.00)[2] X-Rspamd-Queue-Id: 4RmNjq1Hyqz4HS7 On 13/09/2023 19:52, Guy Helmer wrote: > … > > dmesg -a: > > $ dmesg -a > ---<>--- > … > FreeBSD 12.0-STABLE r348375 GENERIC amd64 > … Maybe not relevant to the problem, your opening post mentioned FreeBSD 13 systems alone. From nobody Thu Sep 14 13:04:24 2023 X-Original-To: freebsd-hackers@mlmmj.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mlmmj.nyi.freebsd.org (Postfix) with ESMTP id 4Rmcwh4M7rz4tMQl for ; Thu, 14 Sep 2023 13:04:36 +0000 (UTC) (envelope-from guy.helmer@gmail.com) Received: from mail-yw1-x112f.google.com (mail-yw1-x112f.google.com [IPv6:2607:f8b0:4864:20::112f]) (using TLSv1.3 with cipher TLS_AES_128_GCM_SHA256 (128/128 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (2048 bits) client-digest SHA256) (Client CN "smtp.gmail.com", Issuer "GTS CA 1D4" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4Rmcwh3xHfz3bYk for ; Thu, 14 Sep 2023 13:04:36 +0000 (UTC) (envelope-from guy.helmer@gmail.com) Authentication-Results: mx1.freebsd.org; none Received: by mail-yw1-x112f.google.com with SMTP id 00721157ae682-59b5484fbe6so11182327b3.1 for ; Thu, 14 Sep 2023 06:04:36 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20221208; t=1694696676; x=1695301476; darn=freebsd.org; h=to:references:message-id:content-transfer-encoding:cc:date :in-reply-to:from:subject:mime-version:from:to:cc:subject:date :message-id:reply-to; bh=VCI0FKJra62An+9PuUO2hb/2uGo5WE8jhvt+lIVk8f0=; b=g0paGhzVvSFfNLuQbXUqMJ0HU9KDZClPWYiGT+TVh0f0y+GG3fYDw+J0k+rZv03j+y +nCvX7Q6nYl7LoJOdlx/D/oG+OdDayYIlj+ggOoauvhg3jO373Q0euqw7lOIUn4CcUvm 96ci3/gOQiUvglDjQe+4yweAUwy5un+b8FAR+vg8Ni2H6goyWCQ9DJ3jEcqO5oqt/V7p sWwUpwxl1AH3N+ni8HEqw4VQRQY2r7Iq9X8d54Tv6Gx6xQTh6GgBo13lEILgcoCgH3+G 0PjSvmnYOQqBLc0SkCYj2vubfgplrovdewAqIj/0FFOlPK+dvpZRaOl9vMKIZuizJyTK lLXw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1694696676; x=1695301476; h=to:references:message-id:content-transfer-encoding:cc:date :in-reply-to:from:subject:mime-version:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=VCI0FKJra62An+9PuUO2hb/2uGo5WE8jhvt+lIVk8f0=; b=u8nw5T8k5zy5Did7WQrJAH18SIdEhlWwRFZrYzA8sWEhwqsKe9+BXV2a5qVTq+N93/ pJT+IPCErPTkuN8+uIhiTYQjdkjwSxMCBJKItYrA1/ZlIOuRtwt3zWA1DgbPSotNN35u eJW0TgSmPm2Fjp9rrodKekJy5NlHzd6vhPRiNrcmh2qD2QY/YRIvjxe6nBZLPwXu9jDs pX51rKFVcbVxrOHw7rL0g7zxrNHanX6dqZFoTng/tjACesKJ8PjkNj/hptAFf4Peifjm Afqy+pSw7BF6gfVSOhNA1SGKuvdt0HQfFl0r55y1C5Fz098DxJvfa/YPyJ/5X1hyUJat 6qzQ== X-Gm-Message-State: AOJu0YyCYwOKkQT+SKdUgUX0J5qmaQIrdsXDQk2wJszreaOFX5qhKJ1V Vf8fVfLz9FArk0liH7s2DRuB94ivAFw= X-Google-Smtp-Source: AGHT+IFwfsXr4J1jWy3UgcWBR3gKVUQe+wfTg33i//SRx6PTFl39VKvkixx1kbDOYfHv5G51Th5MlA== X-Received: by 2002:a25:2e10:0:b0:d42:d029:ff99 with SMTP id u16-20020a252e10000000b00d42d029ff99mr5255908ybu.55.1694696675758; Thu, 14 Sep 2023 06:04:35 -0700 (PDT) Received: from smtpclient.apple (1636571-static.amesiaaa.metronetinc.net. [217.180.226.49]) by smtp.gmail.com with ESMTPSA id 62-20020a251041000000b00d7b8a1074d4sm317111ybq.57.2023.09.14.06.04.35 (version=TLS1_2 cipher=ECDHE-ECDSA-AES128-GCM-SHA256 bits=128/128); Thu, 14 Sep 2023 06:04:35 -0700 (PDT) Content-Type: text/plain; charset=utf-8 List-Id: Technical discussions relating to FreeBSD List-Archive: https://lists.freebsd.org/archives/freebsd-hackers List-Help: List-Post: List-Subscribe: List-Unsubscribe: Sender: owner-freebsd-hackers@freebsd.org Mime-Version: 1.0 (Mac OS X Mail 16.0 \(3731.700.6\)) Subject: Re: Unable to access GPT disk partitions - No such file or directory From: Guy Helmer In-Reply-To: Date: Thu, 14 Sep 2023 08:04:24 -0500 Cc: freebsd-hackers@freebsd.org Content-Transfer-Encoding: quoted-printable Message-Id: References: <0CAE8FD0-9F09-4CF6-A402-DF30B039DF23@gmail.com> To: Graham Perrin X-Mailer: Apple Mail (2.3731.700.6) X-Spamd-Bar: ---- X-Rspamd-Pre-Result: action=no action; module=replies; Message is reply to one we originated X-Spamd-Result: default: False [-4.00 / 15.00]; REPLY(-4.00)[]; ASN(0.00)[asn:15169, ipnet:2607:f8b0::/32, country:US]; TAGGED_FROM(0.00)[] X-Rspamd-Queue-Id: 4Rmcwh3xHfz3bYk > On Sep 13, 2023, at 10:54 PM, Graham Perrin = wrote: >=20 > On 13/09/2023 19:52, Guy Helmer wrote: >> =E2=80=A6 >>=20 >> dmesg -a: >>=20 >> $ dmesg -a >> ---<>--- >> =E2=80=A6 >> FreeBSD 12.0-STABLE r348375 GENERIC amd64 >> =E2=80=A6 > Maybe not relevant to the problem, your opening post mentioned FreeBSD = 13 systems alone. Right, I had attached the broken virtual disk to a FreeBSD 12 VM I had = available on the same VMware server to research and attempt to recover = the filesystems. I've since updated this working VM to 13.2 and I'm = getting a bit more informative error messages out of tools like = fsck_ufs. It's looking like either something trashed the superblocks, or the = partition offsets were changed.=20 It's quite a mystery at the moment. Regards, Guy From nobody Thu Sep 14 14:40:01 2023 X-Original-To: freebsd-hackers@mlmmj.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mlmmj.nyi.freebsd.org (Postfix) with ESMTP id 4Rmg4F1DDLz4sWCH for ; Thu, 14 Sep 2023 14:41:17 +0000 (UTC) (envelope-from c@bow.st) Received: from comms.drone (in.bow.st [71.19.146.166]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 4Rmg3t0Yk8z4Qds; Thu, 14 Sep 2023 14:40:57 +0000 (UTC) (envelope-from c@bow.st) Authentication-Results: mx1.freebsd.org; dkim=none; spf=pass (mx1.freebsd.org: domain of c@bow.st designates 71.19.146.166 as permitted sender) smtp.mailfrom=c@bow.st; dmarc=none Received: from homebase (unknown [IPv6:fe80::ff1d:976a:a7e4:ee6a]) by comms.drone (Postfix) with ESMTPSA id 3B050FCFD; Thu, 14 Sep 2023 14:40:46 +0000 (UTC) From: "Mathew\, Cherry G.*" To: freebsd-hackers@freebsd.org Cc: Alexander Leidinger , adridg@freebsd.org Subject: Re: ARC model specified in spinroot/promela References: <85jzt96qjz.fsf@bow.st> <9c424a574cdd39fc879c9ed9192556c0@Leidinger.net> <858r9o6ee0.fsf@bow.st> <85pm304dzi.fsf@bow.st> <85a5u22oxx.fsf@bow.st> <85y1hjecna.fsf@bow.st> <85o7icapb8.fsf@bow.st> Date: Thu, 14 Sep 2023 14:40:01 +0000 In-Reply-To: <85o7icapb8.fsf@bow.st> (Cherry G. Mathew's message of "Fri, 08 Sep 2023 11:15:39 +0000") Message-ID: <854jjw3jjy.fsf@bow.st> User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/26.3 (berkeley-unix) List-Id: Technical discussions relating to FreeBSD List-Archive: https://lists.freebsd.org/archives/freebsd-hackers List-Help: List-Post: List-Subscribe: List-Unsubscribe: Sender: owner-freebsd-hackers@freebsd.org MIME-Version: 1.0 Content-Type: text/plain X-Spamd-Bar: - X-Spamd-Result: default: False [-1.79 / 15.00]; HFILTER_HELO_IP_A(1.00)[comms.drone]; NEURAL_HAM_MEDIUM(-1.00)[-1.000]; NEURAL_HAM_LONG(-1.00)[-1.000]; NEURAL_HAM_SHORT(-0.89)[-0.886]; HFILTER_HELO_NORES_A_OR_MX(0.30)[comms.drone]; R_SPF_ALLOW(-0.20)[+mx]; MIME_GOOD(-0.10)[text/plain]; ONCE_RECEIVED(0.10)[]; TO_DN_SOME(0.00)[]; R_DKIM_NA(0.00)[]; FROM_EQ_ENVFROM(0.00)[]; MIME_TRACE(0.00)[0:+]; RCVD_TLS_ALL(0.00)[]; ASN(0.00)[asn:47066, ipnet:71.19.146.0/24, country:US]; FROM_HAS_DN(0.00)[]; MLMMJ_DEST(0.00)[freebsd-hackers@freebsd.org]; ARC_NA(0.00)[]; RCPT_COUNT_THREE(0.00)[3]; RCVD_COUNT_ONE(0.00)[1]; DMARC_NA(0.00)[bow.st]; TO_MATCH_ENVRCPT_SOME(0.00)[]; MID_RHS_MATCH_FROM(0.00)[]; RCVD_VIA_SMTP_AUTH(0.00)[] X-Rspamd-Queue-Id: 4Rmg3t0Yk8z4Qds >>>>> Mathew, Cherry G * writes: [...] > With that thought, I take leave for the weekend, and hope to put > my money where my mouth is, by debugging the current C > implementation using ideas described above. > $ make prog $ ./arc > should give you a crash dump for gdb, which, I'm getting a SEG > fault at delLRU() well into the caching input trace (T1 has 59 out > of 64 entries filled!) Hello again, Reporting back after a really interesting weekend. Highlights are: - The "D3" methodology seems to work as advertised - the system found a little sneaky "ordering" bug related to "list"->qcount inc/dec and TAILQ() ops. - the segfault turned out to be namespace collision related complications unrelated to the ARC algo. I wrote up an "Equivalence Verification" subdirectory (see arc_queue/ below) - and moved around a few files. Other than these, everything shoud be self explanatory. A few things remain WIP. Obviously, this is a "toy" model - it has stack based "memory" management, and a directory buffer size of 64. So that needs to be hammered on a bit more. Further, I'm keen to now dip my toes into re-entrancy. If you noticed in the earlier patches, there were model routines for "mutex_enter()/mutex_exit()". I'll re-look these and play around a little bit with concurrent entry of ARC() (ARC() is now strictly entered sequentially in a loop - see arc.drv). Once things settle down, I will look at making an actual block disk driver with an ARC(9) managed cache using this code. Another area of further work would be the *.inv files, where the invariant specifications are made. I also noticed that the arc input trace makes the extracted and hand-coded models exlclude slightly different looking codepaths. I need to review these to understand how/what is different. Finally, need to update the input trace itself to exercise all possible codepaths in both. TLDR, "I want to try this": Pre-requisites: installed spin and modex in $PATH $ make spin-gen spin-run;make clean;make modex-gen spin-run;make clean;make prog;./arc;make clean Ditto above after: $ cd arc_queue If you want to inspect the generated / hand coded spinmodel.pml do so after the respective '*-gen' targets run above - they create and overwrite the pre-existing spinmodel.pml in $PWD As always, looking forward to bricks and bats! Many Thanks. -- ~cherry diff -urN arc.null/arc.c arc/arc.c --- arc.null/arc.c 1970-01-01 00:00:00.000000000 +0000 +++ arc/arc.c 2023-09-14 13:59:20.607107308 +0000 @@ -0,0 +1,173 @@ +/* C Implementation of the Adaptive Replacement Cache algorithm. Written by cherry */ + +/* + * We implement the following algorithm from page 10, Figure 4. + * https://www.usenix.org/legacy/events/fast03/tech/full_papers/megiddo/megiddo.pdf + * + * + * ARC(c) + * + * INPUT: The request stream x1,x2,....,xt,.... + * INITIALIZATION: Set p = 0 and set the LRU lists T1, B1, T2, and B2 to empty. + * + * For every t>=1 and any xt, one and only one of the following four cases must occur. + * Case I: xt is in T1 or T2. A cache hit has occurred in ARC(c) and DBL(2c). + * Move xt to MRU position in T2. + * + * Case II: xt is in B1. A cache miss (resp. hit) has occurred in ARC(c) (resp. DBL(2c)). + * ADAPTATION: Update p = min { p + d1,c } + * where d1 = { 1 if |B1| >= |B2|, |B2|/|B1| otherwise + * + * REPLACE(xt, p). Move xt from B1 to the MRU position in T2 (also fetch xt to the cache). + * + * Case III: xt is in B2. A cache miss (resp. hit) has occurred in ARC(c) (resp. DBL(2c)). + * ADAPTATION: Update p = max { p - d2,0 } + * where d2 = { 1 if |B2| >= |B1|, |B1|/|B2| otherwise + * + * REPLACE(xt, p). Move xt from B2 to the MRU position in T2 (also fetch xt to the cache). + * + * Case IV: xt is not in T1 U B1 U T2 U B2. A cache miss has occurred in ARC(c) and DBL(2c). + * Case A: L1 = T1 U B1 has exactly c pages. + * If (|T1| < c) + * Delete LRU page in B1. REPLACE(xt,p). + * else + * Here B1 is empty. Delete LRU page in T1 (also remove it from the cache). + * endif + * Case B: L1 = T1 U B1 has less than c pages. + * If (|T1| + |T2| + |B1| + |B2| >= c) + * Delete LRU page in B2, if (|T1| + |T2| + |B1| + |B2| = 2c). + * REPLACE(xt, p). + * endif + * + * Finally, fetch xt to the cache and move it to MRU position in T1. + * + * Subroutine REPLACE(xt,p) + * If ( (|T1| is not empty) and ((|T1| exceeds the target p) or (xt is in B2 and |T1| = p)) ) + * Delete the LRU page in T1 (also remove it from the cache), and move it to MRU position in B1. + * else + * Delete the LRU page in T2 (also remove it from the cache), and move it to MRU position in B2. + * endif + */ + +#include "arc_queue/arc.h" + +static void arc_list_init(struct arc_list *_arc_list) +{ + TAILQ_INIT(&_arc_list->qhead); + _arc_list->qcount = 0; + + int i; + for(i = 0; i < ARCLEN; i++) { + init_arc_item(&_arc_list->item_list[i], IID_INVAL, false); + }; +} + +int p, d1, d2; +struct arc_list _B1, *B1 = &_B1, _B2, *B2 = &_B2, _T1, *T1 = &_T1, _T2, *T2 = &_T2; + +void arc_init(void) +{ + p = d1 = d2 = 0; + + arc_list_init(B1); + arc_list_init(B2); + arc_list_init(T1); + arc_list_init(T2); +} + +struct arc_item _LRUitem, *LRUitem = &_LRUitem; + +static void +REPLACE(struct arc_item *x_t, int p) +{ + + + init_arc_item(LRUitem, IID_INVAL, false); + + if ((lengthof(T1) != 0) && + ((lengthof(T1) > p) || + (memberof(B2, x_t) && (lengthof(T1) == p)))) { + readLRU(T1, LRUitem); + delLRU(T1); + cacheremove(LRUitem); + addMRU(B1, LRUitem); + } else { + readLRU(T2, LRUitem); + delLRU(T2); + cacheremove(LRUitem); + addMRU(B2, LRUitem); + } +} + +void +ARC(struct arc_item *x_t) +{ + if (memberof(T1, x_t)) { /* Case I */ + delitem(T1, x_t); + addMRU(T2, x_t); + } + + if (memberof(T2, x_t)) { /* Case I */ + delitem(T2, x_t); + addMRU(T2, x_t); + } + + if (memberof(B1, x_t)) { /* Case II */ + d1 = ((lengthof(B1) >= lengthof(B2)) ? 1 : (lengthof(B2)/lengthof(B1))); + p = min((p + d1), C); + + REPLACE(x_t, p); + + delitem(B1, x_t); + addMRU(T2, x_t); + cachefetch(x_t); + } + + if (memberof(B2, x_t)) { /* Case III */ + d2 = ((lengthof(B2) >= lengthof(B1)) ? 1 : (lengthof(B1)/lengthof(B2))); + p = max((p - d2), 0); + + REPLACE(x_t, p); + + delitem(B2, x_t); + addMRU(T2, x_t); + cachefetch(x_t); + } + + if (!(memberof(T1, x_t) || + memberof(B1, x_t) || + memberof(T2, x_t) || + memberof(B2, x_t))) { /* Case IV */ + + if ((lengthof(T1) + lengthof(B1)) == C) { /* Case A */ + if (lengthof(T1) < C) { + delLRU(B1); + REPLACE(x_t, p); + } else { + assert(lengthof(B1) == 0); + readLRU(T1, LRUitem); + delLRU(T1); + cacheremove(LRUitem); + } + } + + if ((lengthof(T1) + lengthof(B1)) < C) { + if ((lengthof(T1) + + lengthof(T2) + + lengthof(B1) + + lengthof(B2)) >= C) { + if ((lengthof(T1) + + lengthof(T2) + + lengthof(B1) + + lengthof(B2)) == (2 * C)) { + + delLRU(B2); + } + + REPLACE(x_t, p); + } + } + cachefetch(x_t); + addMRU(T1, x_t); + } +} diff -urN arc.null/arc.drv arc/arc.drv --- arc.null/arc.drv 1970-01-01 00:00:00.000000000 +0000 +++ arc/arc.drv 2023-09-07 16:43:18.906339006 +0000 @@ -0,0 +1,52 @@ +/* Spin process model for Adaptive Replacement Cache algorithm. Written by cherry */ + +/* Note: What we're attempting in this driver file, is to generate an + * input trace that would exercise all code-paths of the model specified + * in arc.pml + * + * Feeding a static trace to the algorithm in array _x[N_ITEMS] is a + * acceptable alternative. + */ +/* #include "arc.pmh" See Makefile , spinmodel.pml */ + +#define N_ITEMS (2 * C) /* Number of distinct cache items to test with */ +#define ITEM_REPS (C / 4) /* Max repeat item requests */ +#define N_ITERATIONS 3 + +hidden arc_item _x[N_ITEMS]; /* Input state is irrelevant from a verification PoV */ +hidden int _x_iid = 0; +hidden int _item_rep = 0; +hidden int _iterations = 0; + +/* Drive the procs */ +init { + + atomic { + do + :: + _iterations < N_ITERATIONS -> + + _x_iid = 0; + do + :: _x_iid < N_ITEMS -> + init_arc_item(_x[_x_iid], _x_iid, false); + _item_rep = 0; + do + :: _item_rep < (_x_iid % ITEM_REPS) -> + ARC(_x[_x_iid]); + _item_rep++; + :: _item_rep >= (_x_iid % ITEM_REPS) -> + break; + od + _x_iid++; + :: _x_iid >= N_ITEMS -> + break; + od + _iterations++; + :: + _iterations >= N_ITERATIONS -> + break; + od + } + +} diff -urN arc.null/arc_drv.c arc/arc_drv.c --- arc.null/arc_drv.c 1970-01-01 00:00:00.000000000 +0000 +++ arc/arc_drv.c 2023-09-14 14:01:04.826170703 +0000 @@ -0,0 +1,35 @@ +/* See arc.drv for design details */ + +#include "arc_queue/arc.h" + +#define N_ITEMS (2 * C) /* Number of distinct cache items to test with */ +#define ITEM_REPS (C / 4) /* Max repeat item requests */ +#define N_ITERATIONS 3 + +static struct arc_item _x[N_ITEMS]; /* Input state is irrelevant from a verification PoV */ +static int _x_iid = 0; +static int _item_rep = 0; +static int _iterations = 0; + +/* Drive ARC() with a preset input trace */ + +void +main(void) +{ + arc_init(); /* Init module state */ + + while (_iterations < N_ITERATIONS) { + _x_iid = 0; + while (_x_iid < N_ITEMS) { + init_arc_item(&_x[_x_iid], _x_iid, false); + _item_rep = 0; + while(_item_rep < (_x_iid % ITEM_REPS) ) { + ARC(&_x[_x_iid]); + _item_rep++; + } + _x_iid++; + } + _iterations++; + } +} + diff -urN arc.null/arc.inv arc/arc.inv --- arc.null/arc.inv 1970-01-01 00:00:00.000000000 +0000 +++ arc/arc.inv 2023-09-14 08:39:49.817804660 +0000 @@ -0,0 +1,59 @@ +/* $NetBSD$ */ + +/* These are Linear Temporal Logic invariants (and constraints) + * applied over the statespace created by the promela + * specification. Correctness is implied by Logical consistency. + */ +ltl +{ + /* Liveness - all threads, except control must finally exit */ + eventually always (_nr_pr == 1) && + /* c.f Section I. B, on page 3 of paper */ + always ((lengthof(T1) + + lengthof(B1) + + lengthof(T2) + + lengthof(B2)) <= (2 * C)) && + + /* Reading together Section III. A., on page 7, and + * Section III. B., on pages 7,8 + */ + always ((lengthof(T1) + lengthof(B1)) <= C) && + always ((lengthof(T2) + lengthof(B2)) < (2 * C)) && + + /* Section III. B, Remark III.1 */ + always ((lengthof(T1) + lengthof(T2)) <= C) && + + /* TODO: III B, A.1 */ + + /* III B, A.2 */ + always (((lengthof(T1) + + lengthof(B1) + + lengthof(T2) + + lengthof(B2)) < C) + implies ((lengthof(B1) == 0) && + lengthof(B2) == 0)) && + + /* III B, A.3 */ + always (((lengthof(T1) + + lengthof(B1) + + lengthof(T2) + + lengthof(B2)) >= C) + implies ((lengthof(T1) + + lengthof(T2) == C))) && + + /* TODO: III B, A.4 */ + + /* TODO: III B, A.5 */ + + /* IV A. */ + always (p <= C) && + + /* Not strictly true, but these force us to generate a "good" + * input trace via arc.drv + */ + + eventually /* always ? */ ((lengthof(T1) == p) && lengthof(T2) == (C - p)) && + + eventually (p > 0) + +} diff -urN arc.null/arc.pml arc/arc.pml --- arc.null/arc.pml 1970-01-01 00:00:00.000000000 +0000 +++ arc/arc.pml 2023-09-14 07:06:50.440288307 +0000 @@ -0,0 +1,212 @@ +/* Spin process model for Adaptive Replacement Cache algorithm. Written by cherry */ + +/* + * We implement the following algorithm from page 10, Figure 4. + * https://www.usenix.org/legacy/events/fast03/tech/full_papers/megiddo/megiddo.pdf + * + * + * ARC(c) + * + * INPUT: The request stream x1,x2,....,xt,.... + * INITIALIZATION: Set p = 0 and set the LRU lists T1, B1, T2, and B2 to empty. + * + * For every t>=1 and any xt, one and only one of the following four cases must occur. + * Case I: xt is in T1 or T2. A cache hit has occurred in ARC(c) and DBL(2c). + * Move xt to MRU position in T2. + * + * Case II: xt is in B1. A cache miss (resp. hit) has occurred in ARC(c) (resp. DBL(2c)). + * ADAPTATION: Update p = min { p + d1,c } + * where d1 = { 1 if |B1| >= |B2|, |B2|/|B1| otherwise + * + * REPLACE(xt, p). Move xt from B1 to the MRU position in T2 (also fetch xt to the cache). + * + * Case III: xt is in B2. A cache miss (resp. hit) has occurred in ARC(c) (resp. DBL(2c)). + * ADAPTATION: Update p = max { p - d2,0 } + * where d2 = { 1 if |B2| >= |B1|, |B1|/|B2| otherwise + * + * REPLACE(xt, p). Move xt from B2 to the MRU position in T2 (also fetch xt to the cache). + * + * Case IV: xt is not in T1 U B1 U T2 U B2. A cache miss has occurred in ARC(c) and DBL(2c). + * Case A: L1 = T1 U B1 has exactly c pages. + * If (|T1| < c) + * Delete LRU page in B1. REPLACE(xt,p). + * else + * Here B1 is empty. Delete LRU page in T1 (also remove it from the cache). + * endif + * Case B: L1 = T1 U B1 has less than c pages. + * If (|T1| + |T2| + |B1| + |B2| >= c) + * Delete LRU page in B2, if (|T1| + |T2| + |B1| + |B2| = 2c). + * REPLACE(xt, p). + * endif + * + * Finally, fetch xt to the cache and move it to MRU position in T1. + * + * Subroutine REPLACE(xt,p) + * If ( (|T1| is not empty) and ((|T1| exceeds the target p) or (xt is in B2 and |T1| = p)) ) + * Delete the LRU page in T1 (also remove it from the cache), and move it to MRU position in B1. + * else + * Delete the LRU page in T2 (also remove it from the cache), and move it to MRU position in B2. + * endif + */ + +/* Temp variable to hold LRU item */ +hidden arc_item LRUitem; + +/* Adaptation "delta" variables */ +int d1, d2; +int p = 0; + +/* Declare arc lists - "shadow/ghost cache directories" */ +arc_list B1, B2, T1, T2; + +inline REPLACE(/* arc_item */ x_t, /* int */ p) +{ + /* + * Since LRUitem is declared in scope p_ARC, we expect it to be only accessible from there and REPLACE() + * as REPLACE() is only expected to be called from p_ARC. + * XXX: May need to revisit due to Modex related limitations. + */ + init_arc_item(LRUitem, IID_INVAL, false); + + if + :: + (lengthof(T1) != 0) && + ((lengthof(T1) > p) || (memberof(B2, x_t) && (lengthof(T1) == p))) + -> + { + readLRU(T1, LRUitem); + delLRU(T1); + cacheremove(LRUitem); + addMRU(B1, LRUitem); + } + + :: + else + -> + { + readLRU(T2, LRUitem); + delLRU(T2); + cacheremove(LRUitem); + addMRU(B2, LRUitem); + } + fi +} + +inline ARC(/* arc_item */ x_t) +{ + if + :: /* Case I */ + memberof(T1, x_t) + -> + { + delitem(T1, x_t); + addMRU(T2, x_t); + } + :: /* Case I */ + memberof(T2, x_t) + -> + { + delitem(T2, x_t); + addMRU(T2, x_t); + } + :: /* Case II */ + memberof(B1, x_t) + -> + d1 = ((lengthof(B1) >= lengthof(B2)) -> 1 : (lengthof(B2)/lengthof(B1))); + p = min((p + d1), C); + + REPLACE(x_t, p); + { + delitem(B1, x_t); + addMRU(T2, x_t); + cachefetch(x_t); + } + :: /* Case III */ + memberof(B2, x_t) + -> + d2 = ((lengthof(B2) >= lengthof(B1)) -> 1 : (lengthof(B1)/lengthof(B2))); + p = max(p - d2, 0); + + REPLACE(x_t, p); + { + delitem(B2, x_t); + addMRU(T2, x_t); + cachefetch(x_t); + } + :: /* Case IV */ + !(memberof(T1, x_t) || + memberof(B1, x_t) || + memberof(T2, x_t) || + memberof(B2, x_t)) + -> + if + :: /* Case A */ + ((lengthof(T1) + lengthof(B1)) == C) + -> + if + :: + (lengthof(T1) < C) + -> + delLRU(B1); + REPLACE(x_t, p); + :: + else + -> + assert(lengthof(B1) == 0); + { + readLRU(T1, LRUitem); + delLRU(T1); + cacheremove(LRUitem); + } + fi + :: /* Case B */ + ((lengthof(T1) + lengthof(B1)) < C) + -> + if + :: + ((lengthof(T1) + + lengthof(T2) + + lengthof(B1) + + lengthof(B2)) >= C) + -> + if + :: + ((lengthof(T1) + + lengthof(T2) + + lengthof(B1) + + lengthof(B2)) == (2 * C)) + -> + delLRU(B2); + :: + else + -> + skip; + fi + REPLACE(x_t, p); + :: + else + -> + skip; + fi + :: + else + -> + skip; + fi + cachefetch(x_t); + addMRU(T1, x_t); + fi + +} + +#if 0 /* Resolve this after modex extract foo */ +proctype p_arc(arc_item x_t) +{ + /* Serialise entry */ + mutex_enter(sc_lock); + + ARC(x_t); + + mutex_exit(sc_lock); +} +#endif diff -urN arc.null/arc.prx arc/arc.prx --- arc.null/arc.prx 1970-01-01 00:00:00.000000000 +0000 +++ arc/arc.prx 2023-09-14 07:06:38.900036315 +0000 @@ -0,0 +1,80 @@ +// Spin model extractor harness written by cherry +// +%F arc.c +%X -n REPLACE +%X -n ARC +%H +// Disable effects of all included files and try to implement a subset of the APIs they provide. +#define _ARC_H_ +%% +//%C // c_code {} +//%% +//%D // c_cdecl {} +//%% +%L +// We use spin primitives and data objects. +// See %P Below +NonState hidden _LRUitem +NonState hidden LRUitem +NonState hidden _B2 +NonState hidden B2 +NonState hidden _B1 +NonState hidden B1 +NonState hidden _T2 +NonState hidden T2 +NonState hidden _T1 +NonState hidden T1 +NonState hidden x_t + + + +assert(... keep +REPLACE(... keep +init_arc_item(... keep +lengthof(... keep +memberof(... keep +addMRU(... keep +readLRU(... keep +delLRU(... keep +delitem(... keep +cacheremove(... keep +cachefetch(... keep + + +Substitute c_expr { ((lengthof(T1)!=0)&&((lengthof(T1)>now.p)||(memberof(B2,x_t)&&(lengthof(T1)==now.p)))) } (lengthof(T1) != 0) && ((lengthof(T1) > p) || (memberof(B2, x_t) && (lengthof(T1) == p))) +Substitute c_code { now.d1=((lengthof(B1)>=lengthof(B2)) ? Int 1\n : (lengthof(B2)/lengthof(B1))); } d1 = ((lengthof(B1) >= lengthof(B2)) -> 1 : (lengthof(B2)/lengthof(B1))) +Substitute c_code { now.p=min((now.p+now.d1),C); } p = min((p + d1), C) + +Substitute c_code { now.d2=((lengthof(B2)>=lengthof(B1)) ? Int 1\n : (lengthof(B1)/lengthof(B2))); } d2 = ((lengthof(B2) >= lengthof(B1)) -> 1 : (lengthof(B1)/lengthof(B2))); +Substitute c_code { now.p=max((now.p-now.d2),0); } p = max(p - d2, 0); +Substitute c_expr { (!(((memberof(T1,x_t)||memberof(B1,x_t))||memberof(T2,x_t))||memberof(B2,x_t))) } !(memberof(T1, x_t) || memberof(B1, x_t) || memberof(T2, x_t) || memberof(B2, x_t)) +Substitute c_expr { ((lengthof(T1)+lengthof(B1))==C) } ((lengthof(T1) + lengthof(B1)) == C) +Substitute c_expr { (lengthof(T1)=C) } ((lengthof(T1) + lengthof(T2) + lengthof(B1) + lengthof(B2)) >= C) +Substitute c_expr { ((((lengthof(T1)+lengthof(T2))+lengthof(B1))+lengthof(B2))==(2*C)) } ((lengthof(T1) + lengthof(T2) + lengthof(B1) + lengthof(B2)) == (2 * C)) +%% + +%P + +/* Temp variable to hold LRU item */ +hidden arc_item LRUitem; + +arc_list B1, B2, T1, T2; + +#define p_REPLACE(_arg1, _arg2) REPLACE(_arg1, _arg2) /* Demo arbitrary Cfunc->PMLproc transformation */ +inline p_REPLACE(/* arc_item */ x_t, /* int */ p) +{ + +#include "_modex_REPLACE.pml" + +} + +#define p_ARC(_arg1) ARC(_arg1) +inline p_ARC(/* arc_item */ x_t) +{ + +#include "_modex_ARC.pml" + +} +%% \ No newline at end of file diff -urN arc.null/arc_queue/arc.h arc/arc_queue/arc.h --- arc.null/arc_queue/arc.h 1970-01-01 00:00:00.000000000 +0000 +++ arc/arc_queue/arc.h 2023-09-14 13:58:22.433238237 +0000 @@ -0,0 +1,170 @@ +/* + * The objective of the header here is to provide a set of macros that + * reflect the interfaces designed in arc.pmh + */ + +#ifndef _ARC_H_ +#define _ARC_H_ + +#ifdef MODEX +/* Glue for model extraction run */ +#else +/* Defaults to POSIX */ +#include +#include +#include +#endif + +#include "queue.h" /* We use the NetBSD version as it has no + * dependencies (except for -DNULL) . */ + +#define C 64 + +#define ARCLEN (2 * C) /* c.f ghost cache directory length constraints in arc.inv */ + +#define IID_INVAL -1 + +struct arc_item { + TAILQ_ENTRY(arc_item) qlink; + int iid; /* Unique identifier for item */ + bool cached; +}; + +struct arc_list { + TAILQ_HEAD(arc_qhead, arc_item) qhead; + int qcount; + struct arc_item item_list[ARCLEN]; /* We use static memory for demo purposes */ +}; + +inline static struct arc_item * allocmember(struct arc_list *); +inline static void freemember(struct arc_item *); +inline static struct arc_item * findmember(struct arc_list *, struct arc_item *); + +#define init_arc_item(/* &struct arc_item [] */ _arc_item_addr, \ + /* int */_iid, /*bool*/_cached) do { \ + struct arc_item *_arc_item = _arc_item_addr; \ + assert(_arc_item != NULL); \ + _arc_item->iid = _iid; \ + _arc_item->cached = _cached; \ + } while (/*CONSTCOND*/0) + +#define lengthof(/* struct arc_list* */_arc_list) (_arc_list->qcount) +#define memberof(/* struct arc_list* */_arc_list, \ + /* struct arc_item* */_arc_item) \ + ((findmember(_arc_list, \ + _arc_item) != TAILQ_END(&_arc_list->qhead)) ? \ + true : false) + +/* + * We follow spin's channel rx/tx semantics here: "send" means + * duplicate onto queue ("_arc_list.item_list!_arc_item.iid"), and + * recieve means "duplicate" from queue but leave the data source on + * queue ("_arc_list.item_list?<_arc_item.iid>"). + * + * It is an error to addMRU() on a full queue. Likewise, it is an + * error to readLRU() on an empty queue. The verifier is expected to + * have covered any case where these happen. We use assert()s to + * indicate the error. + * + * Note: We use spin's channel mechanism in our design, only because + * it's the easiest. We could have chosen another + * mechanism/implementation, if the semantics were specified + * differently due to, for eg: convention, architectural or efficiency + * reasons. + */ +#define addMRU(/* struct arc_list* */_arc_list, \ + /* struct arc_item* */_arc_item) do { \ + assert(_arc_list->qcount < ARCLEN); \ + struct arc_item *aitmp; aitmp = allocmember(_arc_list); \ + assert(aitmp != NULL); \ + *aitmp = *_arc_item; \ + TAILQ_INSERT_TAIL(&_arc_list->qhead, aitmp, qlink); \ + _arc_list->qcount++; \ + } while (/*CONSTCOND*/0) + +#define readLRU(/* struct arc_list* */_arc_list, \ + /* struct arc_item* */_arc_item) do { \ + assert(!TAILQ_EMPTY(&_arc_list->qhead)); \ + assert(_arc_item != NULL); \ + *_arc_item = *(struct arc_item *)TAILQ_FIRST(&_arc_list->qhead);\ + } while (/*CONSTCOND*/0) + +#define delLRU(/* struct arc_list* */_arc_list) \ + if (!TAILQ_EMPTY(&_arc_list->qhead)) { \ + struct arc_item *aitmp; aitmp = TAILQ_FIRST(&_arc_list->qhead); \ + TAILQ_REMOVE(&_arc_list->qhead, aitmp, qlink); \ + freemember(aitmp); \ + _arc_list->qcount--; assert(_arc_list->qcount >= 0); \ + } else assert(false) + +#define delitem(/* struct arc_list* */_arc_list, \ + /* struct arc_item* */_arc_item) do { \ + struct arc_item *aitmp; \ + aitmp = findmember(_arc_list, _arc_item); \ + if (aitmp != TAILQ_END(&_arc_list->qhead)) { \ + TAILQ_REMOVE(&_arc_list->qhead, aitmp, qlink); \ + freemember(aitmp); \ + _arc_list->qcount--; assert(_arc_list->qcount >= 0); \ + } \ + } while (/*CONSTCOND*/0) + +#define cachefetch(/* struct arc_item* */_arc_item) do { \ + _arc_item->cached = true; /* XXX:TODO */ \ + } while (/*CONSTCOND*/0) + +#define cacheremove(/* struct arc_item* */_arc_item) do { \ + _arc_item->cached = false; /* XXX:TODO */ \ + } while (/*CONSTCOND*/0) + +#define min(a, b) ((a < b) ? a : b) +#define max(a, b) ((a > b) ? a : b) + +/* These routines deal with our home-rolled mem management for the + * ghost cache directory memory embedded within statically defined + * struct arc_list buffers. + * Note that any pointers emerging from these should be treated as + * "opaque"/cookies - ie; they should not be assumed by other routines + * to have any specific properties (such as being part of any specific + * array etc.) They are solely for the consumption of these + * routines. Their contents however may be freely copied/written to. + */ +inline static struct arc_item * +allocmember(struct arc_list *_arc_list) +{ + /* Search for the first unallocated item in given list */ + struct arc_item *aitmp = NULL; + int i; + for (i = 0; i < ARCLEN; i++) { + if (_arc_list->item_list[i].iid == IID_INVAL) { + assert(_arc_list->item_list[i].cached == false); + aitmp = &_arc_list->item_list[i]; + } + } + return aitmp; +} + +inline static void +freemember(struct arc_item *aip) +{ + assert(aip != NULL); + init_arc_item(aip, IID_INVAL, false); +} + +static inline struct arc_item * +findmember(struct arc_list *_arc_list, struct arc_item *aikey) +{ + assert(_arc_list != NULL && aikey != NULL); + assert(aikey->iid != IID_INVAL); + struct arc_item *aitmp; + TAILQ_FOREACH(aitmp, &_arc_list->qhead, qlink) { + if (aitmp->iid == aikey->iid) { + return aitmp; + } + } + return aitmp; /* returns TAILQ_END() on non-membership */ +} + +void ARC(struct arc_item * /* x_t */); +void arc_init(void); + +#endif /* _ARC_H_ */ diff -urN arc.null/arc_queue/arc.pmh arc/arc_queue/arc.pmh --- arc.null/arc_queue/arc.pmh 1970-01-01 00:00:00.000000000 +0000 +++ arc/arc_queue/arc.pmh 2023-09-14 08:04:48.032313330 +0000 @@ -0,0 +1,42 @@ +/* Spin process model for Adaptive Replacement Cache algorithm. Written by cherry */ + +#ifndef _ARC_INC +#define _ARC_INC + +#define C 64 /* Cache size - use judiciously - adds to statespace */ + +#define ARCLEN (2 * C) + +#define IID_INVAL -1 + +typedef arc_item { + int iid; /* Unique identifier for item */ + bool cached; +}; + +/* Note that we use the arc_item.iid as the member lookup handle to reduce state space */ +typedef arc_list { + chan item_list = [ ARCLEN ] of { int }; /* A list of page items */ +}; + + +#define init_arc_item(_arc_item, _iid, _cached) \ + { \ + _arc_item.iid = _iid; \ + _arc_item.cached = _cached; \ + } + +#define lengthof(_arc_list) len(_arc_list.item_list) +#define memberof(_arc_list, _arc_item) _arc_list.item_list??[eval(_arc_item.iid)] +#define addMRU(_arc_list, _arc_item) _arc_list.item_list!_arc_item.iid +#define readLRU(_arc_list, _arc_item) _arc_list.item_list?<_arc_item.iid> +#define delLRU(_arc_list) _arc_list.item_list?_ +#define delitem(_arc_list, _arc_item) if :: lengthof(_arc_list) > 0; _arc_list.item_list??eval(_arc_item.iid) :: else; skip; fi + +#define cachefetch(_arc_item) _arc_item.cached = true +#define cacheremove(_arc_item) _arc_item.cached = false + +#define min(a, b) ((a < b) -> a : b) +#define max(a, b) ((a > b) -> a : b) + +#endif /* _ARC_INC_ */ \ No newline at end of file diff -urN arc.null/arc_queue/arc_queue.c arc/arc_queue/arc_queue.c --- arc.null/arc_queue/arc_queue.c 1970-01-01 00:00:00.000000000 +0000 +++ arc/arc_queue/arc_queue.c 2023-09-11 11:38:49.468321594 +0000 @@ -0,0 +1,26 @@ +/* Mostly to pull in macros into functions, so that modex can parse them */ + +#include "arc.h" + +void arc_addMRU(struct arc_list *Q, + struct arc_item *I) +{ + addMRU(Q, I); +} + +void arc_readLRU(struct arc_list *Q, + struct arc_item *I) +{ + readLRU(Q, I); +} + +void arc_delLRU(struct arc_list *Q) +{ + delLRU(Q); +} + +void arc_delitem(struct arc_list *Q, + struct arc_item *I) +{ + delitem(Q, I); +} diff -urN arc.null/arc_queue/arc_queue.drv arc/arc_queue/arc_queue.drv --- arc.null/arc_queue/arc_queue.drv 1970-01-01 00:00:00.000000000 +0000 +++ arc/arc_queue/arc_queue.drv 2023-09-14 14:09:51.189956593 +0000 @@ -0,0 +1,43 @@ +/* Drive the procs */ + +arc_item _x; + +init { + + atomic { /* Load up Q */ + I.iid = 0; + do + :: I.iid < ARCLEN -> + p_arc_addMRU( /* Q, I */ ); + I.iid++; + :: I.iid >= ARCLEN -> + break; + od + } + + _x.iid = ARCLEN; + + atomic { /* Read and remove from head */ + do + :: _x.iid > (ARCLEN/2) -> + _x.iid--; + p_arc_readLRU( /* Q, I */ ); + assert(I.iid == (ARCLEN - (_x.iid + 1))); + p_arc_delLRU( /* Q */); + :: _x.iid <= (ARCLEN/2) -> + break; + od + } + + atomic { /* Remove from tail */ + do + :: _x.iid >= 0 -> /* delitem() semantics allow attempt on empty list */ + _x.iid--; + I.iid = _x.iid + ARCLEN/2; + p_arc_delitem( /* Q, I */); + :: _x.iid < 0 -> + break; + od + } + +} diff -urN arc.null/arc_queue/arc_queue_drv.c arc/arc_queue/arc_queue_drv.c --- arc.null/arc_queue/arc_queue_drv.c 1970-01-01 00:00:00.000000000 +0000 +++ arc/arc_queue/arc_queue_drv.c 2023-09-13 10:04:05.819212718 +0000 @@ -0,0 +1,52 @@ +#include "arc.h" +#include "arc_queue.h" + +#include + +static void arc_list_init(struct arc_list *_arc_list) +{ + TAILQ_INIT(&_arc_list->qhead); + _arc_list->qcount = 0; + + int i; + for(i = 0; i < ARCLEN; i++) { + init_arc_item(&_arc_list->item_list[i], IID_INVAL, false); + }; +} + +void main(void) +{ + struct arc_list Q; + struct arc_item I, _x; + + arc_list_init(&Q); + + I.iid = 0; + + do { + printf("addMRU(): I.iid == %d\n", I.iid); + arc_addMRU(&Q, &I); + I.iid++; + } while(I.iid < ARCLEN); + + _x.iid = ARCLEN; + + do { + _x.iid--; + arc_readLRU(&Q, &I); + printf("readLRU(): I.iid == %d, _x.iid == %d\n", I.iid, _x.iid); + assert(I.iid == (ARCLEN - (_x.iid + 1))); + arc_delLRU(&Q); + } while(_x.iid > (ARCLEN/2)); + + + do { /* Remove from tail */ + _x.iid--; + I.iid = _x.iid + ARCLEN/2; + arc_delitem( &Q, &I); + printf("delitem(): I.iid == %d, _x.iid == %d\n", I.iid, _x.iid); + } while(_x.iid >= 0); /* delitem() semantics allow attempt on empty list */ + +} + + diff -urN arc.null/arc_queue/arc_queue.h arc/arc_queue/arc_queue.h --- arc.null/arc_queue/arc_queue.h 1970-01-01 00:00:00.000000000 +0000 +++ arc/arc_queue/arc_queue.h 2023-09-11 09:23:01.999474035 +0000 @@ -0,0 +1,16 @@ +#ifndef _ARC_QUEUE_H_ +#define _ARC_QUEUE_H_ + +void arc_lengthof(struct arc_list *); + +void arc_memberof(struct arc_list *, struct arc_item *); + +void arc_addMRU(struct arc_list *, struct arc_item *); + +void arc_readLRU(struct arc_list *, struct arc_item *); + +void arc_delLRU(struct arc_list *); + +void arc_delitem(struct arc_list *, struct arc_item *); + +#endif /* _ARC_QUEUE_H_ */ diff -urN arc.null/arc_queue/arc_queue.inv arc/arc_queue/arc_queue.inv --- arc.null/arc_queue/arc_queue.inv 1970-01-01 00:00:00.000000000 +0000 +++ arc/arc_queue/arc_queue.inv 2023-09-14 08:51:59.057339095 +0000 @@ -0,0 +1,17 @@ +/* These are Linear Temporal Logic invariants (and constraints) + * applied over the statespace created by the promela + * specification. Correctness is implied by Logical consistency. + */ +ltl +{ + /* Liveness - all threads, except control must finally exit */ + eventually always (_nr_pr == 1) && + + eventually (len(Q.item_list) == ARCLEN) && /* We fill up Q first */ + + eventually always (len(Q.item_list) == 0) && /* We drain the Q in the end */ + + true + + +} \ No newline at end of file diff -urN arc.null/arc_queue/arc_queue.pmh arc/arc_queue/arc_queue.pmh --- arc.null/arc_queue/arc_queue.pmh 1970-01-01 00:00:00.000000000 +0000 +++ arc/arc_queue/arc_queue.pmh 2023-09-13 08:02:28.647475795 +0000 @@ -0,0 +1,23 @@ +#define C 64 + +#define ARCLEN (2 * C) + +#define IID_INVAL -1 + +typedef arc_item { + int iid; +} + +/* Note that we use the arc_item.iid as the member lookup handle to reduce state space */ +typedef arc_list { + chan item_list = [ ARCLEN ] of { int }; /* A list of page items */ +}; + +#define TAILQ_INSERT_TAIL(_qh, _var, _ent) _qh ! _var.iid +#define TAILQ_EMPTY(_qh) (len(_qh) == 0) +#define TAILQ_REMOVE(_qh, _var, _ent) _qh ?? eval(_var.iid) +#define TAILQ_FIRST(_qh, _var) _qh ? <_var.iid> +#define TAILQ_END(_qh) IID_INVAL +#define allocmember(_arc_list, _aitmp) skip; _aitmp.iid = IID_INVAL +#define freemember(_arc_item) _arc_item.iid = IID_INVAL +#define findmember(_arc_list, _arc_item) (TAILQ_EMPTY(_arc_list.item_list) -> TAILQ_END(_arc_list.item_list) : (_arc_list.item_list ?? [eval(_arc_item.iid)] -> _arc_item.iid : IID_INVAL)) diff -urN arc.null/arc_queue/arc_queue.pml arc/arc_queue/arc_queue.pml --- arc.null/arc_queue/arc_queue.pml 1970-01-01 00:00:00.000000000 +0000 +++ arc/arc_queue/arc_queue.pml 2023-09-14 07:01:26.549121004 +0000 @@ -0,0 +1,29 @@ +/* This model fronts the "equivalance" model which is exported. + * The idea here is to drive it identically in such a way that + * invariants hold from both the extracted, as well as the + * hand-crafted model. + */ + +int qcount; +arc_item I; +arc_list Q; + +inline p_arc_delitem() +{ + delitem(Q, I); +} + +inline p_arc_delLRU() +{ + delLRU(Q); +} + +inline p_arc_readLRU() +{ + readLRU(Q, I); +} + +inline p_arc_addMRU() +{ + addMRU(Q, I); +} \ No newline at end of file diff -urN arc.null/arc_queue/arc_queue.prx arc/arc_queue/arc_queue.prx --- arc.null/arc_queue/arc_queue.prx 1970-01-01 00:00:00.000000000 +0000 +++ arc/arc_queue/arc_queue.prx 2023-09-13 07:51:32.144705226 +0000 @@ -0,0 +1,51 @@ +// Spin model extractor harness written by cherry +// +%F arc_queue.c +%X -i arc_addMRU +%X -i arc_readLRU +%X -i arc_delLRU +%X -i arc_delitem +%H +// arc.h glue +#define bool int +#define false 0 +#define _SYS_QUEUE_H_ /* Don't expand queue.h macros, as we model them */ + +%% +//%C // c_code {} +//%% +//%D // c_cdecl {} +//%% +%L +// We use spin primitives and data objects. +// See %P Below +NonState hidden Q +NonState hidden I +NonState hidden aitmp + + +Substitute c_code [Q] { Q->qcount--; } qcount-- +Substitute c_code [Q] { Q->qcount++; } qcount++ +Substitute c_code [(Q->qcount>=0)] { ; } assert(qcount >= 0) +Substitute c_code { aitmp=findmember(Q,I); } aitmp.iid=findmember(Q, I) +Substitute c_expr { (aitmp!=TAILQ_END((&(Q->qhead)))) } (aitmp.iid != TAILQ_END(Q.item_list)) +Substitute c_code [Q] { TAILQ_REMOVE((&(Q->qhead)),aitmp,qlink); } TAILQ_REMOVE(Q.item_list, aitmp, _) +Substitute c_code { freemember(aitmp); } freemember(aitmp) +Substitute c_expr { (!TAILQ_EMPTY((&(Q->qhead)))) } (!TAILQ_EMPTY(Q.item_list)) +Substitute c_code [(!TAILQ_EMPTY((&(Q->qhead))))] { ; } assert((!TAILQ_EMPTY(Q.item_list))) +Substitute c_code [(I!=NULL)] { ; } assert(I.iid != IID_INVAL) +Substitute c_code [Q && (struct arc_item *)TAILQ_FIRST((&(Q->qhead))) && I] { (*I)=(*((struct arc_item *)TAILQ_FIRST((&(Q->qhead))))); } TAILQ_FIRST(Q.item_list, I) +Substitute c_code [(Q->qcount<(2*64))] { ; } assert(qcount < ARCLEN) +Substitute c_code [(aitmp!=NULL)] { ; } assert(aitmp.iid == IID_INVAL) +Substitute c_code [I && aitmp] { (*aitmp)=(*I); } aitmp.iid = I.iid +Substitute c_code [Q] { TAILQ_INSERT_TAIL((&(Q->qhead)),aitmp,qlink); } TAILQ_INSERT_TAIL(Q.item_list, aitmp, _); aitmp.iid = IID_INVAL +Substitute c_code { aitmp=allocmember(Q); } allocmember(Q.item_list, aitmp) +Substitute c_code [Q] { aitmp=TAILQ_FIRST((&(Q->qhead))); } TAILQ_FIRST(Q.item_list, aitmp) +%% + +%P +int qcount; +hidden arc_item aitmp; +arc_item I; +arc_list Q; +%% \ No newline at end of file diff -urN arc.null/arc_queue/Makefile arc/arc_queue/Makefile --- arc.null/arc_queue/Makefile 1970-01-01 00:00:00.000000000 +0000 +++ arc/arc_queue/Makefile 2023-09-14 14:07:27.103171180 +0000 @@ -0,0 +1,62 @@ +# Equivalence verification +# We attempt to verify that the arc queue implementation in C is consistent with its model. +# Note that the simplified model is in arc_queue/arc.pmh and the C +# implementation equivalent model is in arc_queue/arc_queue.pmh +# +# Thus, spin-gen: uses arc.pmh as the model interface, whereas +# modex-gen: uses arc_queue.pmh + +spin-gen: arc_queue.pml arc_queue.drv arc_queue.inv + cp arc_queue.pml model #mimic modex + cat arc.pmh model > spinmodel.pml;cat arc_queue.drv >> spinmodel.pml;cat arc_queue.inv >> spinmodel.pml; + spin -am spinmodel.pml + +spin-build: #Could be spin-gen or modex-gen + cc -DVECTORSZ=65536 -o pan pan.c + +all: spin-gen spin-build prog + +# Verification related targets. +spin-run: spin-build + ./pan -a #Generate arc.pml.trail on error + +# You run the trace only if the spin run above failed and created a trail +spin-trace: spinmodel.pml.trail + spin -t spinmodel.pml -p -g # -p (statements) -g (globals) -l (locals) -s (send) -r (recv) + ./pan -r spinmodel.pml.trail -g + +# Build the implementation +prog: arc_queue.c arc.h + cc -g -o arc_queue arc_queue_drv.c arc_queue.c + +# Modex Extracts from C code to 'model' - see arc_queue.prx +modex-gen: arc_queue.prx arc_queue.c + modex -v -w arc_queue.prx + cat arc_queue.pmh model > spinmodel.pml;cat arc_queue.drv >> spinmodel.pml;cat arc_queue.inv >> spinmodel.pml; + spin -a spinmodel.pml #Sanity check + +# Housekeeping +modex-gen-clean: + rm -f spinmodel.pml # Our consolidated model file + rm -f _spin_nvr.tmp # Never claim file + rm -f model # modex generated intermediate "model" file + rm -f pan.* # Spin generated source files + rm -f _modex* # modex generated script files + rm -f *.I *.M + +prog-clean: + rm -f arc_queue +spin-run-clean: + rm -f spinmodel.pml.trail + +spin-build-clean: + rm -f pan + +spin-gen-clean: + rm -f spinmodel.pml # Our consolidated model file + rm -f _spin_nvr.tmp # Never claim file + rm -f model # Intermediate "model" file + rm -f pan.* # Spin generated source files + +clean: modex-gen-clean spin-gen-clean spin-build-clean spin-run-clean prog-clean + rm -f *~ diff -urN arc.null/arc_queue/queue.h arc/arc_queue/queue.h --- arc.null/arc_queue/queue.h 1970-01-01 00:00:00.000000000 +0000 +++ arc/arc_queue/queue.h 2023-09-11 04:48:17.669520444 +0000 @@ -0,0 +1,655 @@ +/* $NetBSD: queue.h,v 1.76 2021/01/16 23:51:51 chs Exp $ */ + +/* + * Copyright (c) 1991, 1993 + * The Regents of the University of California. All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * 3. Neither the name of the University nor the names of its contributors + * may be used to endorse or promote products derived from this software + * without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND + * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE + * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL + * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS + * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) + * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT + * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY + * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF + * SUCH DAMAGE. + * + * @(#)queue.h 8.5 (Berkeley) 8/20/94 + */ + +#ifndef _SYS_QUEUE_H_ +#define _SYS_QUEUE_H_ + +/* + * This file defines five types of data structures: singly-linked lists, + * lists, simple queues, tail queues, and circular queues. + * + * A singly-linked list is headed by a single forward pointer. The + * elements are singly linked for minimum space and pointer manipulation + * overhead at the expense of O(n) removal for arbitrary elements. New + * elements can be added to the list after an existing element or at the + * head of the list. Elements being removed from the head of the list + * should use the explicit macro for this purpose for optimum + * efficiency. A singly-linked list may only be traversed in the forward + * direction. Singly-linked lists are ideal for applications with large + * datasets and few or no removals or for implementing a LIFO queue. + * + * A list is headed by a single forward pointer (or an array of forward + * pointers for a hash table header). The elements are doubly linked + * so that an arbitrary element can be removed without a need to + * traverse the list. New elements can be added to the list before + * or after an existing element or at the head of the list. A list + * may only be traversed in the forward direction. + * + * A simple queue is headed by a pair of pointers, one the head of the + * list and the other to the tail of the list. The elements are singly + * linked to save space, so elements can only be removed from the + * head of the list. New elements can be added to the list after + * an existing element, at the head of the list, or at the end of the + * list. A simple queue may only be traversed in the forward direction. + * + * A tail queue is headed by a pair of pointers, one to the head of the + * list and the other to the tail of the list. The elements are doubly + * linked so that an arbitrary element can be removed without a need to + * traverse the list. New elements can be added to the list before or + * after an existing element, at the head of the list, or at the end of + * the list. A tail queue may be traversed in either direction. + * + * For details on the use of these macros, see the queue(3) manual page. + */ + +/* + * Include the definition of NULL only on NetBSD because sys/null.h + * is not available elsewhere. This conditional makes the header + * portable and it can simply be dropped verbatim into any system. + * The caveat is that on other systems some other header + * must provide NULL before the macros can be used. + */ +#ifdef __NetBSD__ +#include +#endif + +#if defined(_KERNEL) && defined(DIAGNOSTIC) +#define QUEUEDEBUG 1 +#endif + +#if defined(QUEUEDEBUG) +# if defined(_KERNEL) +# define QUEUEDEBUG_ABORT(...) panic(__VA_ARGS__) +# else +# include +# define QUEUEDEBUG_ABORT(...) err(1, __VA_ARGS__) +# endif +#endif + +/* + * Singly-linked List definitions. + */ +#define SLIST_HEAD(name, type) \ +struct name { \ + struct type *slh_first; /* first element */ \ +} + +#define SLIST_HEAD_INITIALIZER(head) \ + { NULL } + +#define SLIST_ENTRY(type) \ +struct { \ + struct type *sle_next; /* next element */ \ +} + +/* + * Singly-linked List access methods. + */ +#define SLIST_FIRST(head) ((head)->slh_first) +#define SLIST_END(head) NULL +#define SLIST_EMPTY(head) ((head)->slh_first == NULL) +#define SLIST_NEXT(elm, field) ((elm)->field.sle_next) + +#define SLIST_FOREACH(var, head, field) \ + for((var) = (head)->slh_first; \ + (var) != SLIST_END(head); \ + (var) = (var)->field.sle_next) + +#define SLIST_FOREACH_SAFE(var, head, field, tvar) \ + for ((var) = SLIST_FIRST((head)); \ + (var) != SLIST_END(head) && \ + ((tvar) = SLIST_NEXT((var), field), 1); \ + (var) = (tvar)) + +/* + * Singly-linked List functions. + */ +#define SLIST_INIT(head) do { \ + (head)->slh_first = SLIST_END(head); \ +} while (/*CONSTCOND*/0) + +#define SLIST_INSERT_AFTER(slistelm, elm, field) do { \ + (elm)->field.sle_next = (slistelm)->field.sle_next; \ + (slistelm)->field.sle_next = (elm); \ +} while (/*CONSTCOND*/0) + +#define SLIST_INSERT_HEAD(head, elm, field) do { \ + (elm)->field.sle_next = (head)->slh_first; \ + (head)->slh_first = (elm); \ +} while (/*CONSTCOND*/0) + +#define SLIST_REMOVE_AFTER(slistelm, field) do { \ + (slistelm)->field.sle_next = \ + SLIST_NEXT(SLIST_NEXT((slistelm), field), field); \ +} while (/*CONSTCOND*/0) + +#define SLIST_REMOVE_HEAD(head, field) do { \ + (head)->slh_first = (head)->slh_first->field.sle_next; \ +} while (/*CONSTCOND*/0) + +#define SLIST_REMOVE(head, elm, type, field) do { \ + if ((head)->slh_first == (elm)) { \ + SLIST_REMOVE_HEAD((head), field); \ + } \ + else { \ + struct type *curelm = (head)->slh_first; \ + while(curelm->field.sle_next != (elm)) \ + curelm = curelm->field.sle_next; \ + curelm->field.sle_next = \ + curelm->field.sle_next->field.sle_next; \ + } \ +} while (/*CONSTCOND*/0) + + +/* + * List definitions. + */ +#define LIST_HEAD(name, type) \ +struct name { \ + struct type *lh_first; /* first element */ \ +} + +#define LIST_HEAD_INITIALIZER(head) \ + { NULL } + +#define LIST_ENTRY(type) \ +struct { \ + struct type *le_next; /* next element */ \ + struct type **le_prev; /* address of previous next element */ \ +} + +/* + * List access methods. + */ +#define LIST_FIRST(head) ((head)->lh_first) +#define LIST_END(head) NULL +#define LIST_EMPTY(head) ((head)->lh_first == LIST_END(head)) +#define LIST_NEXT(elm, field) ((elm)->field.le_next) + +#define LIST_FOREACH(var, head, field) \ + for ((var) = ((head)->lh_first); \ + (var) != LIST_END(head); \ + (var) = ((var)->field.le_next)) + +#define LIST_FOREACH_SAFE(var, head, field, tvar) \ + for ((var) = LIST_FIRST((head)); \ + (var) != LIST_END(head) && \ + ((tvar) = LIST_NEXT((var), field), 1); \ + (var) = (tvar)) + +#define LIST_MOVE(head1, head2, field) do { \ + LIST_INIT((head2)); \ + if (!LIST_EMPTY((head1))) { \ + (head2)->lh_first = (head1)->lh_first; \ + (head2)->lh_first->field.le_prev = &(head2)->lh_first; \ + LIST_INIT((head1)); \ + } \ +} while (/*CONSTCOND*/0) + +/* + * List functions. + */ +#if defined(QUEUEDEBUG) +#define QUEUEDEBUG_LIST_INSERT_HEAD(head, elm, field) \ + if ((head)->lh_first && \ + (head)->lh_first->field.le_prev != &(head)->lh_first) \ + QUEUEDEBUG_ABORT("LIST_INSERT_HEAD %p %s:%d", (head), \ + __FILE__, __LINE__); +#define QUEUEDEBUG_LIST_OP(elm, field) \ + if ((elm)->field.le_next && \ + (elm)->field.le_next->field.le_prev != \ + &(elm)->field.le_next) \ + QUEUEDEBUG_ABORT("LIST_* forw %p %s:%d", (elm), \ + __FILE__, __LINE__); \ + if (*(elm)->field.le_prev != (elm)) \ + QUEUEDEBUG_ABORT("LIST_* back %p %s:%d", (elm), \ + __FILE__, __LINE__); +#define QUEUEDEBUG_LIST_POSTREMOVE(elm, field) \ + (elm)->field.le_next = (void *)1L; \ + (elm)->field.le_prev = (void *)1L; +#else +#define QUEUEDEBUG_LIST_INSERT_HEAD(head, elm, field) +#define QUEUEDEBUG_LIST_OP(elm, field) +#define QUEUEDEBUG_LIST_POSTREMOVE(elm, field) +#endif + +#define LIST_INIT(head) do { \ + (head)->lh_first = LIST_END(head); \ +} while (/*CONSTCOND*/0) + +#define LIST_INSERT_AFTER(listelm, elm, field) do { \ + QUEUEDEBUG_LIST_OP((listelm), field) \ + if (((elm)->field.le_next = (listelm)->field.le_next) != \ + LIST_END(head)) \ + (listelm)->field.le_next->field.le_prev = \ + &(elm)->field.le_next; \ + (listelm)->field.le_next = (elm); \ + (elm)->field.le_prev = &(listelm)->field.le_next; \ +} while (/*CONSTCOND*/0) + +#define LIST_INSERT_BEFORE(listelm, elm, field) do { \ + QUEUEDEBUG_LIST_OP((listelm), field) \ + (elm)->field.le_prev = (listelm)->field.le_prev; \ + (elm)->field.le_next = (listelm); \ + *(listelm)->field.le_prev = (elm); \ + (listelm)->field.le_prev = &(elm)->field.le_next; \ +} while (/*CONSTCOND*/0) + +#define LIST_INSERT_HEAD(head, elm, field) do { \ + QUEUEDEBUG_LIST_INSERT_HEAD((head), (elm), field) \ + if (((elm)->field.le_next = (head)->lh_first) != LIST_END(head))\ + (head)->lh_first->field.le_prev = &(elm)->field.le_next;\ + (head)->lh_first = (elm); \ + (elm)->field.le_prev = &(head)->lh_first; \ +} while (/*CONSTCOND*/0) + +#define LIST_REMOVE(elm, field) do { \ + QUEUEDEBUG_LIST_OP((elm), field) \ + if ((elm)->field.le_next != NULL) \ + (elm)->field.le_next->field.le_prev = \ + (elm)->field.le_prev; \ + *(elm)->field.le_prev = (elm)->field.le_next; \ + QUEUEDEBUG_LIST_POSTREMOVE((elm), field) \ +} while (/*CONSTCOND*/0) + +#define LIST_REPLACE(elm, elm2, field) do { \ + if (((elm2)->field.le_next = (elm)->field.le_next) != NULL) \ + (elm2)->field.le_next->field.le_prev = \ + &(elm2)->field.le_next; \ + (elm2)->field.le_prev = (elm)->field.le_prev; \ + *(elm2)->field.le_prev = (elm2); \ + QUEUEDEBUG_LIST_POSTREMOVE((elm), field) \ +} while (/*CONSTCOND*/0) + +/* + * Simple queue definitions. + */ +#define SIMPLEQ_HEAD(name, type) \ +struct name { \ + struct type *sqh_first; /* first element */ \ + struct type **sqh_last; /* addr of last next element */ \ +} + +#define SIMPLEQ_HEAD_INITIALIZER(head) \ + { NULL, &(head).sqh_first } + +#define SIMPLEQ_ENTRY(type) \ +struct { \ + struct type *sqe_next; /* next element */ \ +} + +/* + * Simple queue access methods. + */ +#define SIMPLEQ_FIRST(head) ((head)->sqh_first) +#define SIMPLEQ_END(head) NULL +#define SIMPLEQ_EMPTY(head) ((head)->sqh_first == SIMPLEQ_END(head)) +#define SIMPLEQ_NEXT(elm, field) ((elm)->field.sqe_next) + +#define SIMPLEQ_FOREACH(var, head, field) \ + for ((var) = ((head)->sqh_first); \ + (var) != SIMPLEQ_END(head); \ + (var) = ((var)->field.sqe_next)) + +#define SIMPLEQ_FOREACH_SAFE(var, head, field, next) \ + for ((var) = ((head)->sqh_first); \ + (var) != SIMPLEQ_END(head) && \ + ((next = ((var)->field.sqe_next)), 1); \ + (var) = (next)) + +/* + * Simple queue functions. + */ +#define SIMPLEQ_INIT(head) do { \ + (head)->sqh_first = NULL; \ + (head)->sqh_last = &(head)->sqh_first; \ +} while (/*CONSTCOND*/0) + +#define SIMPLEQ_INSERT_HEAD(head, elm, field) do { \ + if (((elm)->field.sqe_next = (head)->sqh_first) == NULL) \ + (head)->sqh_last = &(elm)->field.sqe_next; \ + (head)->sqh_first = (elm); \ +} while (/*CONSTCOND*/0) + +#define SIMPLEQ_INSERT_TAIL(head, elm, field) do { \ + (elm)->field.sqe_next = NULL; \ + *(head)->sqh_last = (elm); \ + (head)->sqh_last = &(elm)->field.sqe_next; \ +} while (/*CONSTCOND*/0) + +#define SIMPLEQ_INSERT_AFTER(head, listelm, elm, field) do { \ + if (((elm)->field.sqe_next = (listelm)->field.sqe_next) == NULL)\ + (head)->sqh_last = &(elm)->field.sqe_next; \ + (listelm)->field.sqe_next = (elm); \ +} while (/*CONSTCOND*/0) + +#define SIMPLEQ_REMOVE_HEAD(head, field) do { \ + if (((head)->sqh_first = (head)->sqh_first->field.sqe_next) == NULL) \ + (head)->sqh_last = &(head)->sqh_first; \ +} while (/*CONSTCOND*/0) + +#define SIMPLEQ_REMOVE_AFTER(head, elm, field) do { \ + if (((elm)->field.sqe_next = (elm)->field.sqe_next->field.sqe_next) \ + == NULL) \ + (head)->sqh_last = &(elm)->field.sqe_next; \ +} while (/*CONSTCOND*/0) + +#define SIMPLEQ_REMOVE(head, elm, type, field) do { \ + if ((head)->sqh_first == (elm)) { \ + SIMPLEQ_REMOVE_HEAD((head), field); \ + } else { \ + struct type *curelm = (head)->sqh_first; \ + while (curelm->field.sqe_next != (elm)) \ + curelm = curelm->field.sqe_next; \ + if ((curelm->field.sqe_next = \ + curelm->field.sqe_next->field.sqe_next) == NULL) \ + (head)->sqh_last = &(curelm)->field.sqe_next; \ + } \ +} while (/*CONSTCOND*/0) + +#define SIMPLEQ_CONCAT(head1, head2) do { \ + if (!SIMPLEQ_EMPTY((head2))) { \ + *(head1)->sqh_last = (head2)->sqh_first; \ + (head1)->sqh_last = (head2)->sqh_last; \ + SIMPLEQ_INIT((head2)); \ + } \ +} while (/*CONSTCOND*/0) + +#define SIMPLEQ_LAST(head, type, field) \ + (SIMPLEQ_EMPTY((head)) ? \ + NULL : \ + ((struct type *)(void *) \ + ((char *)((head)->sqh_last) - offsetof(struct type, field)))) + +/* + * Tail queue definitions. + */ +#define _TAILQ_HEAD(name, type, qual) \ +struct name { \ + qual type *tqh_first; /* first element */ \ + qual type *qual *tqh_last; /* addr of last next element */ \ +} +#define TAILQ_HEAD(name, type) _TAILQ_HEAD(name, struct type,) + +#define TAILQ_HEAD_INITIALIZER(head) \ + { TAILQ_END(head), &(head).tqh_first } + +#define _TAILQ_ENTRY(type, qual) \ +struct { \ + qual type *tqe_next; /* next element */ \ + qual type *qual *tqe_prev; /* address of previous next element */\ +} +#define TAILQ_ENTRY(type) _TAILQ_ENTRY(struct type,) + +/* + * Tail queue access methods. + */ +#define TAILQ_FIRST(head) ((head)->tqh_first) +#define TAILQ_END(head) (NULL) +#define TAILQ_NEXT(elm, field) ((elm)->field.tqe_next) +#define TAILQ_LAST(head, headname) \ + (*(((struct headname *)(void *)((head)->tqh_last))->tqh_last)) +#define TAILQ_PREV(elm, headname, field) \ + (*(((struct headname *)(void *)((elm)->field.tqe_prev))->tqh_last)) +#define TAILQ_EMPTY(head) (TAILQ_FIRST(head) == TAILQ_END(head)) + + +#define TAILQ_FOREACH(var, head, field) \ + for ((var) = ((head)->tqh_first); \ + (var) != TAILQ_END(head); \ + (var) = ((var)->field.tqe_next)) + +#define TAILQ_FOREACH_SAFE(var, head, field, next) \ + for ((var) = ((head)->tqh_first); \ + (var) != TAILQ_END(head) && \ + ((next) = TAILQ_NEXT(var, field), 1); (var) = (next)) + +#define TAILQ_FOREACH_REVERSE(var, head, headname, field) \ + for ((var) = TAILQ_LAST((head), headname); \ + (var) != TAILQ_END(head); \ + (var) = TAILQ_PREV((var), headname, field)) + +#define TAILQ_FOREACH_REVERSE_SAFE(var, head, headname, field, prev) \ + for ((var) = TAILQ_LAST((head), headname); \ + (var) != TAILQ_END(head) && \ + ((prev) = TAILQ_PREV((var), headname, field), 1); (var) = (prev)) + +/* + * Tail queue functions. + */ +#if defined(QUEUEDEBUG) +#define QUEUEDEBUG_TAILQ_INSERT_HEAD(head, elm, field) \ + if ((head)->tqh_first && \ + (head)->tqh_first->field.tqe_prev != &(head)->tqh_first) \ + QUEUEDEBUG_ABORT("TAILQ_INSERT_HEAD %p %s:%d", (head), \ + __FILE__, __LINE__); +#define QUEUEDEBUG_TAILQ_INSERT_TAIL(head, elm, field) \ + if (*(head)->tqh_last != NULL) \ + QUEUEDEBUG_ABORT("TAILQ_INSERT_TAIL %p %s:%d", (head), \ + __FILE__, __LINE__); +#define QUEUEDEBUG_TAILQ_OP(elm, field) \ + if ((elm)->field.tqe_next && \ + (elm)->field.tqe_next->field.tqe_prev != \ + &(elm)->field.tqe_next) \ + QUEUEDEBUG_ABORT("TAILQ_* forw %p %s:%d", (elm), \ + __FILE__, __LINE__); \ + if (*(elm)->field.tqe_prev != (elm)) \ + QUEUEDEBUG_ABORT("TAILQ_* back %p %s:%d", (elm), \ + __FILE__, __LINE__); +#define QUEUEDEBUG_TAILQ_PREREMOVE(head, elm, field) \ + if ((elm)->field.tqe_next == NULL && \ + (head)->tqh_last != &(elm)->field.tqe_next) \ + QUEUEDEBUG_ABORT("TAILQ_PREREMOVE head %p elm %p %s:%d",\ + (head), (elm), __FILE__, __LINE__); +#define QUEUEDEBUG_TAILQ_POSTREMOVE(elm, field) \ + (elm)->field.tqe_next = (void *)1L; \ + (elm)->field.tqe_prev = (void *)1L; +#else +#define QUEUEDEBUG_TAILQ_INSERT_HEAD(head, elm, field) +#define QUEUEDEBUG_TAILQ_INSERT_TAIL(head, elm, field) +#define QUEUEDEBUG_TAILQ_OP(elm, field) +#define QUEUEDEBUG_TAILQ_PREREMOVE(head, elm, field) +#define QUEUEDEBUG_TAILQ_POSTREMOVE(elm, field) +#endif + +#define TAILQ_INIT(head) do { \ + (head)->tqh_first = TAILQ_END(head); \ + (head)->tqh_last = &(head)->tqh_first; \ +} while (/*CONSTCOND*/0) + +#define TAILQ_INSERT_HEAD(head, elm, field) do { \ + QUEUEDEBUG_TAILQ_INSERT_HEAD((head), (elm), field) \ + if (((elm)->field.tqe_next = (head)->tqh_first) != TAILQ_END(head))\ + (head)->tqh_first->field.tqe_prev = \ + &(elm)->field.tqe_next; \ + else \ + (head)->tqh_last = &(elm)->field.tqe_next; \ + (head)->tqh_first = (elm); \ + (elm)->field.tqe_prev = &(head)->tqh_first; \ +} while (/*CONSTCOND*/0) + +#define TAILQ_INSERT_TAIL(head, elm, field) do { \ + QUEUEDEBUG_TAILQ_INSERT_TAIL((head), (elm), field) \ + (elm)->field.tqe_next = TAILQ_END(head); \ + (elm)->field.tqe_prev = (head)->tqh_last; \ + *(head)->tqh_last = (elm); \ + (head)->tqh_last = &(elm)->field.tqe_next; \ +} while (/*CONSTCOND*/0) + +#define TAILQ_INSERT_AFTER(head, listelm, elm, field) do { \ + QUEUEDEBUG_TAILQ_OP((listelm), field) \ + if (((elm)->field.tqe_next = (listelm)->field.tqe_next) != \ + TAILQ_END(head)) \ + (elm)->field.tqe_next->field.tqe_prev = \ + &(elm)->field.tqe_next; \ + else \ + (head)->tqh_last = &(elm)->field.tqe_next; \ + (listelm)->field.tqe_next = (elm); \ + (elm)->field.tqe_prev = &(listelm)->field.tqe_next; \ +} while (/*CONSTCOND*/0) + +#define TAILQ_INSERT_BEFORE(listelm, elm, field) do { \ + QUEUEDEBUG_TAILQ_OP((listelm), field) \ + (elm)->field.tqe_prev = (listelm)->field.tqe_prev; \ + (elm)->field.tqe_next = (listelm); \ + *(listelm)->field.tqe_prev = (elm); \ + (listelm)->field.tqe_prev = &(elm)->field.tqe_next; \ +} while (/*CONSTCOND*/0) + +#define TAILQ_REMOVE(head, elm, field) do { \ + QUEUEDEBUG_TAILQ_PREREMOVE((head), (elm), field) \ + QUEUEDEBUG_TAILQ_OP((elm), field) \ + if (((elm)->field.tqe_next) != TAILQ_END(head)) \ + (elm)->field.tqe_next->field.tqe_prev = \ + (elm)->field.tqe_prev; \ + else \ + (head)->tqh_last = (elm)->field.tqe_prev; \ + *(elm)->field.tqe_prev = (elm)->field.tqe_next; \ + QUEUEDEBUG_TAILQ_POSTREMOVE((elm), field); \ +} while (/*CONSTCOND*/0) + +#define TAILQ_REPLACE(head, elm, elm2, field) do { \ + if (((elm2)->field.tqe_next = (elm)->field.tqe_next) != \ + TAILQ_END(head)) \ + (elm2)->field.tqe_next->field.tqe_prev = \ + &(elm2)->field.tqe_next; \ + else \ + (head)->tqh_last = &(elm2)->field.tqe_next; \ + (elm2)->field.tqe_prev = (elm)->field.tqe_prev; \ + *(elm2)->field.tqe_prev = (elm2); \ + QUEUEDEBUG_TAILQ_POSTREMOVE((elm), field); \ +} while (/*CONSTCOND*/0) + +#define TAILQ_CONCAT(head1, head2, field) do { \ + if (!TAILQ_EMPTY(head2)) { \ + *(head1)->tqh_last = (head2)->tqh_first; \ + (head2)->tqh_first->field.tqe_prev = (head1)->tqh_last; \ + (head1)->tqh_last = (head2)->tqh_last; \ + TAILQ_INIT((head2)); \ + } \ +} while (/*CONSTCOND*/0) + +/* + * Singly-linked Tail queue declarations. + */ +#define STAILQ_HEAD(name, type) \ +struct name { \ + struct type *stqh_first; /* first element */ \ + struct type **stqh_last; /* addr of last next element */ \ +} + +#define STAILQ_HEAD_INITIALIZER(head) \ + { NULL, &(head).stqh_first } + +#define STAILQ_ENTRY(type) \ +struct { \ + struct type *stqe_next; /* next element */ \ +} + +/* + * Singly-linked Tail queue access methods. + */ +#define STAILQ_FIRST(head) ((head)->stqh_first) +#define STAILQ_END(head) NULL +#define STAILQ_NEXT(elm, field) ((elm)->field.stqe_next) +#define STAILQ_EMPTY(head) (STAILQ_FIRST(head) == STAILQ_END(head)) + +/* + * Singly-linked Tail queue functions. + */ +#define STAILQ_INIT(head) do { \ + (head)->stqh_first = NULL; \ + (head)->stqh_last = &(head)->stqh_first; \ +} while (/*CONSTCOND*/0) + +#define STAILQ_INSERT_HEAD(head, elm, field) do { \ + if (((elm)->field.stqe_next = (head)->stqh_first) == NULL) \ + (head)->stqh_last = &(elm)->field.stqe_next; \ + (head)->stqh_first = (elm); \ +} while (/*CONSTCOND*/0) + +#define STAILQ_INSERT_TAIL(head, elm, field) do { \ + (elm)->field.stqe_next = NULL; \ + *(head)->stqh_last = (elm); \ + (head)->stqh_last = &(elm)->field.stqe_next; \ +} while (/*CONSTCOND*/0) + +#define STAILQ_INSERT_AFTER(head, listelm, elm, field) do { \ + if (((elm)->field.stqe_next = (listelm)->field.stqe_next) == NULL)\ + (head)->stqh_last = &(elm)->field.stqe_next; \ + (listelm)->field.stqe_next = (elm); \ +} while (/*CONSTCOND*/0) + +#define STAILQ_REMOVE_HEAD(head, field) do { \ + if (((head)->stqh_first = (head)->stqh_first->field.stqe_next) == NULL) \ + (head)->stqh_last = &(head)->stqh_first; \ +} while (/*CONSTCOND*/0) + +#define STAILQ_REMOVE(head, elm, type, field) do { \ + if ((head)->stqh_first == (elm)) { \ + STAILQ_REMOVE_HEAD((head), field); \ + } else { \ + struct type *curelm = (head)->stqh_first; \ + while (curelm->field.stqe_next != (elm)) \ + curelm = curelm->field.stqe_next; \ + if ((curelm->field.stqe_next = \ + curelm->field.stqe_next->field.stqe_next) == NULL) \ + (head)->stqh_last = &(curelm)->field.stqe_next; \ + } \ +} while (/*CONSTCOND*/0) + +#define STAILQ_FOREACH(var, head, field) \ + for ((var) = ((head)->stqh_first); \ + (var); \ + (var) = ((var)->field.stqe_next)) + +#define STAILQ_FOREACH_SAFE(var, head, field, tvar) \ + for ((var) = STAILQ_FIRST((head)); \ + (var) && ((tvar) = STAILQ_NEXT((var), field), 1); \ + (var) = (tvar)) + +#define STAILQ_CONCAT(head1, head2) do { \ + if (!STAILQ_EMPTY((head2))) { \ + *(head1)->stqh_last = (head2)->stqh_first; \ + (head1)->stqh_last = (head2)->stqh_last; \ + STAILQ_INIT((head2)); \ + } \ +} while (/*CONSTCOND*/0) + +#define STAILQ_LAST(head, type, field) \ + (STAILQ_EMPTY((head)) ? \ + NULL : \ + ((struct type *)(void *) \ + ((char *)((head)->stqh_last) - offsetof(struct type, field)))) + +#endif /* !_SYS_QUEUE_H_ */ diff -urN arc.null/Makefile arc/Makefile --- arc.null/Makefile 1970-01-01 00:00:00.000000000 +0000 +++ arc/Makefile 2023-09-14 14:07:51.871667720 +0000 @@ -0,0 +1,92 @@ +# This set of spinroot related files were written by cherry +# in the Gregorian Calendar year AD.2023, in the month +# of February that year. +# +# We have two specification files and a properties file (".inv") +# +# The properties file contains "constraint" sections +# such as ltl or never claims (either or, not both). +# The specification is divided into two files: +# the file with suffix '.drv' is a "driver" which +# instantiates processes that will ultimately "drive" the +# models under test. +# The file with the suffix '.pml' contains the process +# model code, which, is intended to be the formal specification +# for the code we are interested in writing in C. +# +# We process these files in slightly different ways during +# the dev cycle, but broadly speaking, the idea is to create +# a file called 'spinmodel.pml' which contains the final +# model file that is fed to spin. +# +# Note that when we use the model extractor tool "modex" to +# extract the 'specification' from C code written to implement +# the model defined above. We use a 'harness' file (see file with +# suffix '.prx' below. +# +# Once the harness has been run, spinmodel.pml should be +# synthesised and processed as usual. +# +# The broad idea is that software dev starts by writing the spec +# first, validating the model, and then implementing the model in +# C, after which we come back to extract the model from the C file +# and cross check our implementation using spin. +# +# If things go well, the constraints specified in the '.inv' file +# should hold exactly for both the handwritten model, and the +# extracted one. + +spin-gen: arc.pml arc.drv arc.inv + cp arc.pml model #mimic modex + cat arc_queue/arc.pmh model > spinmodel.pml;cat arc.drv >> spinmodel.pml;cat arc.inv >> spinmodel.pml; + spin -am spinmodel.pml + +spin-build: #Could be spin-gen or modex-gen + cc -DVECTORSZ=65536 -o pan pan.c + +all: spin-gen spin-build prog + +# Verification related targets. +spin-run: spin-build + ./pan -a #Generate arc.pml.trail on error + +# You run the trace only if the spin run above failed and created a trail +spin-trace: spinmodel.pml.trail + spin -t spinmodel.pml -p -g # -p (statements) -g (globals) -l (locals) -s (send) -r (recv) + ./pan -r spinmodel.pml.trail -g + +# Build the implementation +prog: arc.c arc_queue/arc.h + cc -g -o arc arc_drv.c arc.c + +# Modex Extracts from C code to 'model' - see arc.prx +modex-gen: arc.prx arc.c + modex -v -w arc.prx + cat arc_queue/arc.pmh model > spinmodel.pml;cat arc.drv >> spinmodel.pml;cat arc.inv >> spinmodel.pml; + spin -a spinmodel.pml #Sanity check + +# Housekeeping +modex-gen-clean: + rm -f spinmodel.pml # Our consolidated model file + rm -f _spin_nvr.tmp # Never claim file + rm -f model # modex generated intermediate "model" file + rm -f pan.* # Spin generated source files + rm -f _modex* # modex generated script files + rm -f *.I *.M + +prog-clean: + rm -f arc +spin-run-clean: + rm -f spinmodel.pml.trail + +spin-build-clean: + rm -f pan + +spin-gen-clean: + rm -f spinmodel.pml # Our consolidated model file + rm -f _spin_nvr.tmp # Never claim file + rm -f model # Intermediate "model" file + rm -f pan.* # Spin generated source files + +clean: modex-gen-clean spin-gen-clean spin-build-clean spin-run-clean prog-clean + rm -f *~ From nobody Thu Sep 14 15:11:02 2023 X-Original-To: freebsd-hackers@mlmmj.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mlmmj.nyi.freebsd.org (Postfix) with ESMTP id 4Rmgkw0BSjz4sdsH for ; Thu, 14 Sep 2023 15:11:20 +0000 (UTC) (envelope-from marklmi@yahoo.com) Received: from sonic317-20.consmr.mail.gq1.yahoo.com (sonic317-20.consmr.mail.gq1.yahoo.com [98.137.66.146]) (using TLSv1.3 with cipher TLS_AES_128_GCM_SHA256 (128/128 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 4Rmgkt65Gmz4cRs for ; Thu, 14 Sep 2023 15:11:18 +0000 (UTC) (envelope-from marklmi@yahoo.com) Authentication-Results: mx1.freebsd.org; dkim=pass header.d=yahoo.com header.s=s2048 header.b=ZcTBCSO8; spf=pass (mx1.freebsd.org: domain of marklmi@yahoo.com designates 98.137.66.146 as permitted sender) smtp.mailfrom=marklmi@yahoo.com; dmarc=pass (policy=reject) header.from=yahoo.com DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=yahoo.com; s=s2048; t=1694704276; bh=Olq4ASIGLE7QZZHPlIdCccQdXHFlisVPbYkl/FFD2nE=; h=From:Subject:Date:To:References:From:Subject:Reply-To; b=ZcTBCSO8l5BxbwMwgAcdpiU5q2s1NLJxsyTBGF+0i4cRBlAWt4D3XU1qymOxRPcRBNLklDROTpPYj6GldZA8WtGJPX/WnjCwg0xyIxQs7FI8S3G90jrxoEn7fKUi3y8WEaD5CB8BQ190ezWl1s2jE23lMWtaqn0P30LpkYgSqq8Tc8Orsz0aBc+NGL5Zyfgpd7gmsfc+ZSIHTGSHkkGcwKaEoHexP9P6WxBE3z6pc3PFsZEe0vM+ZPC4HSKTGK2JZVz3MbYUo9zjFHLwVm1elsa1Zns+RmqUeQtrcbg5RjIRL8VbwqG1VurXTxQ/K+s2EJbReeOQ1BpupgeftGRS0g== X-SONIC-DKIM-SIGN: v=1; a=rsa-sha256; c=relaxed/relaxed; d=yahoo.com; s=s2048; t=1694704276; bh=QbgC4G8YvCs5eHwCVUOcfnxYxc1CSldr4lm240zKjZZ=; h=X-Sonic-MF:From:Subject:Date:To:From:Subject; b=XZMkGFSnP2axSqolVx6gGgU7F2NhGWOIlWiYwmOkxiusn1WnMxWwSNa8Hau2lrxYt1guYs/DBRjyrm16mjCsEv8aVj0nUkJtSyWTL70RULmvq7BCSV5QtevgaQ5SmMb8Ut3T4YMD9gq6aaL2XwEGjDc2c1sw3N+Bj3AZOhmj3fjZeB3IXwouWp4DSx0qxWjPVbRiseiGz7WNtUIy5DOIU5YVL041x2LSb0vIYADnFDl8f/+pz5xw0bGfwuTuxf0RQBPgPhIOt1wNnjsRtXaj2Gmfx4waKR8XMJXO/l4N/FNjB5BkxrrFCY8NOjaPF6cGziKME/fyGPMvMIdHp0dajQ== X-YMail-OSG: cXIlUHgVM1lpcaKuQUOIUzmzNKUoM85iA7M9JtUZEkyXZwPuHCOaCje1VKrRqvx T2p4kxfhxxwRmOvKjd0n8WdaDirRBZy4RS0dvB_HKtOA8Q1myEfrHyeIiGW4RQEiaiD3tvcmE08f vzZAXYjD7JAVEN4slylt_xSD8l_g1Q5wx7OZDRZxBPZkbqoBK.Lviw6RI16nSD1w855_7sTOQBZV RE5Qy3oGWEgqSpDVpGRYgdbdSm4tf4TY0SN4giH4o.e6rzqBXr8HcPiKdaT1sKEtf4vYFpRBWllL 7Sq8cRl.c83JJZuNY4qfjOIc_9WyMMhNA23y1i9.DOCkPt53dqAUxL0pWcHjueTyOCOonYmpnlWl Cl7BJUL_CAZwU13eRf9oZXpgZpnWbQ.oSb.rKB14LOcRRdRIuYZ6hh9tVR5eS_QZkpO15RxultSF DboLuJQ2QJPwPtstsZxogr9mhSij.sEaWJaTfBNdzCJFkDkXdmkANFoEtCJ2BMjJHDAMygqoDKiZ oCZvV9uNUsA3LHSXpHgXwp9gy9_EHgh6VcePcNee3NIs88RlWQ1R7zN_Cu7eoUXSOqmUw5ftyZkW UGqH5FI0467P1yL89FEDNuBp2idgdGI_gqfkpFTbre7mU2eLh.1piSLyilMAxfIA0_ycOygfH3PL w3jhEEtMLjyHoBQ_PQontjXwNAZTU.Fy6GjLn7xjgEzzY5OurydMqjIcCOrqIZyf0ftwGITjdpWa n1cbFs2w48nsKAR3SDmTLGVuPbzz3rJIc2XWSEWzQTFSwVxVqzXb3h1QjCPfbn9GFxcgDo3lxudt kxDAFSZ7I4xCVdHdX06XarNImwNJFl2QyyIz_6Tn371jApEw5.sybxgI_.m31tjH71EMjv.V2gZA 3wxHj1QS6qfDPP2xa_iEplei6JqKw36tGAw1NpDNZ0K4qgxBXFNpZwzDUStRBweYULgK.8ytF77s ANw2sQe03i9YJp42DGThl7FgzhOpzI7azryAx3qoNYFe_qmA7myDdzCmIStUQdMysdiO5ya1ma.W kRs677w0pUwQymT7IcjXQJAE8LWfSyfpE_dQUxHZyvuhosSSgw6j7iSGkhGyhDWhZTbOAjVFrRLA aGQAvQCokquccWulxL0EvpzvDFlJfjlprx1LWpKKo.EqRNKXv7ykQSobL1FstXkH.MiVdpzweFLH 87uP0zMq.5SYJ4v.q_yHScuDtIzPWsVqRiucdQ_lNI8xT.J3VIMNM2zqX0OqG1rvEWn9PzQAscBX .13HR3JTExB3EeXzE.65St.h2K0aNIdhPlMke56CnE.niJ2jONg0CF8b5spzRQc9Z1J1e0C74E1r LYXJYr6XpZUTseIL_6M3wZduR8vQVvzDNra85miQ5LFMsG8YrLk4GlT4AufdoyeLDYXiefzHHRXC ObydW8NiUzG7DLk5m9plgtu5hFinIUKOpBI1nqFTYwKhi3Ti7NHGGLnxAgyIJC_MnCQTQD8qQLat oayP6kx1uyBfiDAfgPfAGog06Wo03ntBdUERV2w.MBP7Z4lQCRlC3jCita3Se.Oni7BdG.50tP62 W5CkYlXtHoSW7.ZtKBqIfhp.qvFd8F_Iy2MN3FuM8dNQoXHJ.L1wMj1xgW.hxDz1L7N5PKjZY5H8 jOk3qWMBA11EsSFftnvwf2OX4M4xZRJsz.JHAUCE5RHf_PhCsx2ZiRrx_SNdhh6FFveY10sHelmc 3StPjJZubWvxBPmLBFlmApNt_JyqECT54aquZ9fsoQbjXKEmqVE_Pso2X4dpt.UZIPqKwtOizq96 m4YcMgDT45LrWdnXHj3zuPNPNnzq6X8ASCYritCcnI7UErquimNcNO4ZbHN5GrhZkLM0__NnxrU1 8Xg41dTJvSZ5G4IGkFJLk41QkvWjxJQ9GuYQ72Gv21cwYO8Oxf.J57CTv3RXbrJbdoURdpZZ.2.s KrIfbzdEoh3nq3j_XOn5lmXfcskAx8dnoAcOXsehAT1Apm5_EU_96M9oJmvRFN2jmrwozahlS_8g 05uNDOS5dgzMecHMT7.2OCcMnAw8kLtiS3WDZiovUFUxX.iBHKOJRvzEeYXGEha1dTINhgvhd86k BMyW6p7u298oV3L0dSYWtc4Ed9JLiiSqBntv3C9H8SngR3VCXXyTo_8OASYxBlAiEsYG5nWD2DoO rI0P0YYY6B93k1Vx8BWvKcLUMUGxXCKJw3XIAsv1AkMgR3Fh0cAarg.urfJPHafnRa3ocBkG1NPw F8h8nm8aaxyx0uXEm2s_ZjUDE2xe.mf8ZfRXyOhl.3RGU_lMvsCXwYAeuY.bherbdz2ch1W7lrT9 J X-Sonic-MF: X-Sonic-ID: 09ee3cf0-8f8a-45da-8014-6872d03ef9ff Received: from sonic.gate.mail.ne1.yahoo.com by sonic317.consmr.mail.gq1.yahoo.com with HTTP; Thu, 14 Sep 2023 15:11:16 +0000 Received: by hermes--production-ne1-6cbd549489-fvhzw (Yahoo Inc. Hermes SMTP Server) with ESMTPA ID 8c264cfef135ee8efba4f3fe0ee6109a; Thu, 14 Sep 2023 15:11:14 +0000 (UTC) From: Mark Millard Content-Type: text/plain; charset=us-ascii Content-Transfer-Encoding: quoted-printable List-Id: Technical discussions relating to FreeBSD List-Archive: https://lists.freebsd.org/archives/freebsd-hackers List-Help: List-Post: List-Subscribe: List-Unsubscribe: Sender: owner-freebsd-hackers@freebsd.org Mime-Version: 1.0 (Mac OS X Mail 16.0 \(3731.700.6\)) Subject: A lock order reversal that I've not seen before (zfs and tmpfs during poudriere bulk using USE_TMPFS=all) Message-Id: Date: Thu, 14 Sep 2023 08:11:02 -0700 To: Current FreeBSD , FreeBSD Hackers X-Mailer: Apple Mail (2.3731.700.6) References: X-Spamd-Bar: --- X-Spamd-Result: default: False [-3.11 / 15.00]; NEURAL_HAM_LONG(-1.00)[-1.000]; NEURAL_HAM_MEDIUM(-1.00)[-1.000]; NEURAL_HAM_SHORT(-0.61)[-0.608]; DMARC_POLICY_ALLOW(-0.50)[yahoo.com,reject]; MV_CASE(0.50)[]; R_SPF_ALLOW(-0.20)[+ptr:yahoo.com]; R_DKIM_ALLOW(-0.20)[yahoo.com:s=s2048]; MIME_GOOD(-0.10)[text/plain]; FROM_HAS_DN(0.00)[]; RCVD_VIA_SMTP_AUTH(0.00)[]; TO_MATCH_ENVRCPT_SOME(0.00)[]; ARC_NA(0.00)[]; MLMMJ_DEST(0.00)[freebsd-hackers@freebsd.org]; RCVD_IN_DNSWL_NONE(0.00)[98.137.66.146:from]; DWL_DNSWL_NONE(0.00)[yahoo.com:dkim]; ASN(0.00)[asn:36647, ipnet:98.137.64.0/20, country:US]; RWL_MAILSPIKE_POSSIBLE(0.00)[98.137.66.146:from]; DKIM_TRACE(0.00)[yahoo.com:+]; TO_DN_ALL(0.00)[]; FREEMAIL_FROM(0.00)[yahoo.com]; MID_RHS_MATCH_FROM(0.00)[]; RCPT_COUNT_TWO(0.00)[2]; RCVD_TLS_LAST(0.00)[]; FROM_EQ_ENVFROM(0.00)[]; FREEMAIL_ENVFROM(0.00)[yahoo.com]; MIME_TRACE(0.00)[0:+]; RCVD_COUNT_TWO(0.00)[2] X-Rspamd-Queue-Id: 4Rmgkt65Gmz4cRs I've never figured out how to tell important lock order reversal notices from unimportant ones. So I mostly report only unfamiliar ones. (But I normally do not do poudriere bulk builds with a debug kernel in use.) During a poudriere bulk that is using USE_TMPFS=3Dall it reported: lock order reversal: 1st 0xffffa0027b7e83f0 zfs (zfs, lockmgr) @ = /usr/src/sys/kern/vfs_mount.c:2240 2nd 0xffffa0023db44070 tmpfs (tmpfs, lockmgr) @ = /usr/src/sys/kern/vfs_subr.c:3886 lock order tmpfs -> zfs established at: #0 0xffff0000004d7824 at witness_checkorder+0x304 #1 0xffff000000435bfc at lockmgr_xlock+0x50 #2 0xffff00015d0ce814 at null_lock+0xb0 #3 0xffff00000056cdf0 at _vn_lock+0x54 #4 0xffff000000557170 at vflush+0x12c #5 0xffff00015d0cd6b0 at nullfs_unmount+0x40 #6 0xffff00000054c318 at dounmount+0x714 #7 0xffff00000054bb94 at kern_unmount+0x298 #8 0xffff0000007fe6ac at do_el0_sync+0x520 #9 0xffff0000007da110 at handle_el0_sync+0x44 lock order zfs -> tmpfs attempted at: #0 0xffff0000004d7fb8 at witness_checkorder+0xa98 #1 0xffff000000434140 at lockmgr_lock_flags+0x1ec #2 0xffff00000056cdf0 at _vn_lock+0x54 #3 0xffff000000557170 at vflush+0x12c #4 0xffff0000003964d0 at tmpfs_unmount+0x60 #5 0xffff00000054c318 at dounmount+0x714 #6 0xffff00000054bb94 at kern_unmount+0x298 #7 0xffff0000007fe6ac at do_el0_sync+0x520 #8 0xffff0000007da110 at handle_el0_sync+0x44 It happens to be on aarch64, in case that matters for some odd reason. =3D=3D=3D Mark Millard marklmi at yahoo.com From nobody Fri Sep 15 00:00:24 2023 X-Original-To: freebsd-hackers@mlmmj.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mlmmj.nyi.freebsd.org (Postfix) with ESMTP id 4RmvTN2Q8Zz4t6xJ; Fri, 15 Sep 2023 00:00:24 +0000 (UTC) (envelope-from salvadore@freebsd.org) Received: from freefall.freebsd.org (freefall.freebsd.org [96.47.72.132]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "freefall.freebsd.org", Issuer "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4RmvTN17grz3dCS; Fri, 15 Sep 2023 00:00:24 +0000 (UTC) (envelope-from salvadore@freebsd.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1694736024; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc; bh=uxm8M3vDBP5+TYcFpoGJwp4tMFUO7XjSZkedYQJCFpg=; b=MKDkhCCFKpPfCVv12x/YbjT/KdHrCGN7GnpBF3MzJA5lCm9axS/fvZy5UI+EbTOKEvwAdu /4gGZVn9kgkCk/FMGxv05vmSDFuUgAdrfCaxlWopkmk7YW31g/KDVrQ7RK8cs2JpIa34AD LzStcBD+N0dM62e2wmpaMRVg2ZEjJDy9X6LhLbT8fuItbunAfOatCTE8j1QYt25jSxbjtD U7WqFyVRruongsbf2QUlFoyyMIa8jFTB1R0PZttOQoMugr4+lSmmjGQQmLfbGzPT+0MdCL 5dIkyRuoXC1Md9i4O9u30ozPi0C5OAGHsgg3yAF7rEGegefG2BV+i+Z5JIRrcA== ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1694736024; a=rsa-sha256; cv=none; b=Ny3gv9ZLge4Mkjc9y4u0Liu0MfnYgANXOm52VSgeLNAg3gRbI97LpNguinCM9co2PoP0c0 wP57XC1svKkx0+0Ed6HS3uGWnz9YcEA77LEUMmqTMJUyji5jRwAWBbN3sm4dLeGxw6LQy0 ODVNJ2jWycp4dt+1P//5CLCWx/ZEuJs/+IAAvZ3SwpQxyQFdA9uBBQPM8TaDy7ldGkoLfR uj8AKKwDwbV1MOTRgDTg1LWW9cU+OEbsxtNfX06DRqwJDabAh1fMyuj33Ceb3SlEDW9u2/ DEdtlaRG3ah+YuJZa5n7i6NYSaH8+B0KozSVFVWE3k1TFjNUdrQIZlkf9OHbCg== ARC-Authentication-Results: i=1; mx1.freebsd.org; none ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1694736024; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc; bh=uxm8M3vDBP5+TYcFpoGJwp4tMFUO7XjSZkedYQJCFpg=; b=XZCD9h8vCXNJHQ67m96uBcNBV87qlgZlXwAa2EhjDbRiXaNcQYxOluRYjD+C2YS8b8Ynnd RbcB7mstgxpwPWmAB+oRXlACBEE+rUMgCObqP2ygG5JvMY+Nf44sVK4chnPVeJLxlHD/B4 DaXJ8MoJzmiMMA0DUFW+sFa1EhDaToHrQk+g7KrKVhpGvQxd6GS4fcJg/DippIax6oyzcD wfZx5hL9l4jq5vourT13H3N88r9rYR2BH0TgGbJ/+pkpU9uANOWWrhLOuKXraarfA6tL4v J8FghED0ihwCc0Ad2XPovfVh+cPPQptlvUJrQPwzqKqZh+8PKOj/ENG+ywLgRw== Received: by freefall.freebsd.org (Postfix, from userid 1472) id 18201DF7B; Fri, 15 Sep 2023 00:00:24 +0000 (UTC) To: freebsd-status-calls@FreeBSD.org Subject: [2 WEEKS LEFT REMINDER] Call for 2023Q3 status reports Cc: freebsd-current@FreeBSD.org,freebsd-hackers@FreeBSD.org,devsummit@FreeBSD.org,soc-students@FreeBSD.org,soc-mentors@FreeBSD.org Message-Id: <20230915000024.18201DF7B@freefall.freebsd.org> Date: Fri, 15 Sep 2023 00:00:24 +0000 (UTC) From: Lorenzo Salvadore List-Id: Technical discussions relating to FreeBSD List-Archive: https://lists.freebsd.org/archives/freebsd-hackers List-Help: List-Post: List-Subscribe: List-Unsubscribe: Sender: owner-freebsd-hackers@freebsd.org Dear FreeBSD Community, The deadline for the next FreeBSD Status Report update is September, 30th 2023 for work done since the last round of quarterly reports: July 2023 - September 2023. I would like to remind you that reports are published on a quarterly basis and are usually collected during the last month of each quarter, You are also welcome to submit them even earlier if you want, and the earlier you submit them, the more time we have for reviewing. Status report submissions do not need to be very long. They may be about anything happening in the FreeBSD project and community, and they provide a great way to inform FreeBSD users and developers about work that is underway or has been completed. Report submissions are not limited to committers; anyone doing anything interesting and FreeBSD related can -- and should -- write one! The following methods are available to submit your reports: * submit a review on Phabricator and add the group "status" to the reviewers list. You should put your reports in the directory doc/website/content/en/status/report-2023-07-2023-09/ (create it if it is missing); * submit a pull request at . You should put your reports in the directory doc/website/content/en/status/report-2023-07-2023-09/ (create it if it is missing); * send an email to status-submissions@FreeBSD.org including your report. An AsciiDoc template is available at . We look forward to seeing your 2023Q3 reports! Thanks, Lorenzo Salvadore (on behalf of status@) From nobody Fri Sep 15 09:27:54 2023 X-Original-To: freebsd-hackers@mlmmj.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mlmmj.nyi.freebsd.org (Postfix) with ESMTP id 4Rn85R5BlCz4sVv8 for ; Fri, 15 Sep 2023 09:28:59 +0000 (UTC) (envelope-from Alexander@Leidinger.net) Received: from mailgate.Leidinger.net (bastille.leidinger.net [89.238.82.207]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature ECDSA (P-256) client-digest SHA256) (Client CN "mailgate.leidinger.net", Issuer "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4Rn85R1K8jz4c6Y; Fri, 15 Sep 2023 09:28:59 +0000 (UTC) (envelope-from Alexander@Leidinger.net) Authentication-Results: mx1.freebsd.org; none List-Id: Technical discussions relating to FreeBSD List-Archive: https://lists.freebsd.org/archives/freebsd-hackers List-Help: List-Post: List-Subscribe: List-Unsubscribe: Sender: owner-freebsd-hackers@freebsd.org MIME-Version: 1.0 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=leidinger.net; s=outgoing-alex; t=1694770125; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: in-reply-to:in-reply-to:references:references; bh=rBLU+dIV2eYe7zJe6zRit1X4rVRMEfIkDBpRiVp3ANc=; b=EIgr1CE7ZC5OfWxjZfJwDNLaH3juHZ6lbS5VYd9WH4S/a11DO/VaqU5Lgt6HH0/QdmAVk0 cbHbHUm15AOJb+9KDZGtm9Zmn4WAW5SkQ7GWirknQXPB0e7PJnLW9i4FeKuJV1HRK8Rava Aurojuj10kCYAZHqPVTgq6urYk28krRD++OpB9JUy/lf1uoEZLQGu6MiyvpygKWCPIkTBz 3UmLTSMEK9+uLgL2daNafg3qu3dDS99Cnj2g6DadqLwKQoZEWwPwhbVoHiy7/JPJHNCR9H qEa21rfdbZySm9HuXDeh2QlCmDrQSfIj+i+J9G8wdZp88Oq2KID4A5fv1k86zg== Date: Fri, 15 Sep 2023 11:27:54 +0200 From: Alexander Leidinger To: "Mathew, Cherry G.*" Cc: freebsd-hackers@freebsd.org, adridg@freebsd.org Subject: Re: ARC model specified in spinroot/promela In-Reply-To: <854jjw3jjy.fsf@bow.st> References: <85jzt96qjz.fsf@bow.st> <9c424a574cdd39fc879c9ed9192556c0@Leidinger.net> <858r9o6ee0.fsf@bow.st> <85pm304dzi.fsf@bow.st> <85a5u22oxx.fsf@bow.st> <85y1hjecna.fsf@bow.st> <85o7icapb8.fsf@bow.st> <854jjw3jjy.fsf@bow.st> Message-ID: X-Sender: Alexander@Leidinger.net Organization: No organization, this is a private message. Content-Type: multipart/signed; protocol="application/pgp-signature"; boundary="=_0f4fe8cac9e4b430b5cf98fab1201ebc"; micalg=pgp-sha256 X-Spamd-Bar: ---- X-Rspamd-Pre-Result: action=no action; module=replies; Message is reply to one we originated X-Spamd-Result: default: False [-4.00 / 15.00]; REPLY(-4.00)[]; ASN(0.00)[asn:34240, ipnet:89.238.64.0/18, country:DE] X-Rspamd-Queue-Id: 4Rn85R1K8jz4c6Y This is an OpenPGP/MIME signed message (RFC 4880 and 3156) --=_0f4fe8cac9e4b430b5cf98fab1201ebc Content-Transfer-Encoding: 7bit Content-Type: text/plain; charset=US-ASCII; format=flowed Am 2023-09-14 16:40, schrieb Mathew, Cherry G.*: > A few things remain WIP. Obviously, this is a "toy" model - it has > stack > based "memory" management, and a directory buffer size of 64. So that > needs to be hammered on a bit more. Further, I'm keen to now dip my > toes > into re-entrancy. If you noticed in the earlier patches, there were > model routines for "mutex_enter()/mutex_exit()". I'll re-look these and > play around a little bit with concurrent entry of ARC() (ARC() is now > strictly entered sequentially in a loop - see arc.drv). Once things > settle down, I will look at making an actual block disk driver with an > ARC(9) managed cache using this code. Without having looked at anything in the code, and now with your comment about an "actual block disk driver"... AFAIR your ARC is based upon the paper, and this is not used anywhere in FreeBSD. ZFS is using a modified/adapted version of the ARC. What you are describing sounds a bit like our buffer cache (https://wiki.freebsd.org/BasicVfsConcepts#:~:text=Buffer%20cache%20is%20a%20layer,on%20a%20vnode%2Blbn%20basis.), but our buffer cache is not an ARC, it is AFAIR LRU eviction based. I fully understand that you are far away from doing real modelling of such complex parts as the VFS parts of FreeBSD, but maybe this info gives a hint in terms of looking into some parts and see if you can adopt some parts in terms of design which can be anhanced later on to some real FreeBSD stuff... Bye, Alexander. -- http://www.Leidinger.net Alexander@Leidinger.net: PGP 0x8F31830F9F2772BF http://www.FreeBSD.org netchild@FreeBSD.org : PGP 0x8F31830F9F2772BF --=_0f4fe8cac9e4b430b5cf98fab1201ebc Content-Type: application/pgp-signature; name=signature.asc Content-Disposition: attachment; filename=signature.asc; size=833 Content-Description: OpenPGP digital signature -----BEGIN PGP SIGNATURE----- iQIzBAEBCAAdFiEER9UlYXp1PSd08nWXEg2wmwP42IYFAmUEI6wACgkQEg2wmwP4 2IZeVw//YeFoHw+kZDn3xIRjwpXquO8rxx5OhwcUBNPEH3/KtFKWe7V8sY1f9cK/ EiFgxB8uftybbDhJ9l2Fg8xSLrsTzPlh5k7HpJ21eEL7t4Fa8LUPBixTuP3rwSNW JOpGcI//WoEdwMEPR8Ok4wVgpVdqFt6fh4DXnZcposjkukA+8oS4J9eZ/5LEpGG4 ddjhnQrpAwRGpE3VPeWHhO1RGcQveocUGvsO2PqQ/3xVeqQIr0ubjha0DDVoyqzo jY8QFjCSYERNkcBtQUe/y+mDJqaZaqHGXV1kWG4yXw1HXo3YmriA1NF8BUYIRy/T dxaF2wKhxhLchntkda2UgNY2/4zJYFP+VE2aniENGRVaP9z4FxJWJ4notVhqmsRK DijaKSPJpnPd7asgfPQ16lFB0arjXeyhKAGncOtDA8IcYhM0n/vcrXreL+KhL5Ea NpakUH0hDE55sDpOVAVnfX75BttYw1casGts/bMbzKkAl1P0XrfQR5NZbl2fz3H7 KlGWN0HHQpCvL0Nxuj8MJeUhJnK3NgX2t1HxQOlF5pE5sslPP3eeIF3xeBvAxSYb TCtNXwKDAMGOzXTPoeoNL1oyYShfTPo6lxREYXMeS2M5+3R12qa+pUS8UMux9SVy lqQBVgBMHWruxiqUx0Cs2iQKm5KyM/RnU0OFHliCWN2jL6CHn1A= =gOUU -----END PGP SIGNATURE----- --=_0f4fe8cac9e4b430b5cf98fab1201ebc-- From nobody Fri Sep 15 15:05:34 2023 X-Original-To: freebsd-hackers@mlmmj.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mlmmj.nyi.freebsd.org (Postfix) with ESMTP id 4RnHZy571Gz4slJ0 for ; Fri, 15 Sep 2023 15:06:34 +0000 (UTC) (envelope-from c@bow.st) Received: from comms.drone (in.bow.st [71.19.146.166]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 4RnHZv5crSz4NwW; Fri, 15 Sep 2023 15:06:31 +0000 (UTC) (envelope-from c@bow.st) Authentication-Results: mx1.freebsd.org; dkim=none; spf=pass (mx1.freebsd.org: domain of c@bow.st designates 71.19.146.166 as permitted sender) smtp.mailfrom=c@bow.st; dmarc=none Received: from homebase (unknown [IPv6:fe80::ff1d:976a:a7e4:ee6a]) by comms.drone (Postfix) with ESMTPSA id 5A9D1FCF8; Fri, 15 Sep 2023 15:06:20 +0000 (UTC) From: "Mathew\, Cherry G.*" To: Alexander Leidinger Cc: freebsd-hackers@freebsd.org, adridg@freebsd.org Subject: Re: ARC model specified in spinroot/promela References: <85jzt96qjz.fsf@bow.st> <9c424a574cdd39fc879c9ed9192556c0@Leidinger.net> <858r9o6ee0.fsf@bow.st> <85pm304dzi.fsf@bow.st> <85a5u22oxx.fsf@bow.st> <85y1hjecna.fsf@bow.st> <85o7icapb8.fsf@bow.st> <854jjw3jjy.fsf@bow.st> Date: Fri, 15 Sep 2023 15:05:34 +0000 In-Reply-To: (Alexander Leidinger's message of "Fri, 15 Sep 2023 11:27:54 +0200") Message-ID: <85zg1ntr29.fsf@bow.st> User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/26.3 (berkeley-unix) List-Id: Technical discussions relating to FreeBSD List-Archive: https://lists.freebsd.org/archives/freebsd-hackers List-Help: List-Post: List-Subscribe: List-Unsubscribe: Sender: owner-freebsd-hackers@freebsd.org MIME-Version: 1.0 Content-Type: text/plain X-Spamd-Bar: - X-Spamd-Result: default: False [-1.74 / 15.00]; HFILTER_HELO_IP_A(1.00)[comms.drone]; NEURAL_HAM_MEDIUM(-1.00)[-1.000]; NEURAL_HAM_LONG(-1.00)[-1.000]; NEURAL_HAM_SHORT(-0.84)[-0.838]; HFILTER_HELO_NORES_A_OR_MX(0.30)[comms.drone]; R_SPF_ALLOW(-0.20)[+mx]; MIME_GOOD(-0.10)[text/plain]; ONCE_RECEIVED(0.10)[]; TO_DN_SOME(0.00)[]; R_DKIM_NA(0.00)[]; FROM_EQ_ENVFROM(0.00)[]; MIME_TRACE(0.00)[0:+]; RCVD_TLS_ALL(0.00)[]; ASN(0.00)[asn:47066, ipnet:71.19.146.0/24, country:US]; FROM_HAS_DN(0.00)[]; MLMMJ_DEST(0.00)[freebsd-hackers@freebsd.org]; ARC_NA(0.00)[]; RCPT_COUNT_THREE(0.00)[3]; RCVD_COUNT_ONE(0.00)[1]; DMARC_NA(0.00)[bow.st]; TO_MATCH_ENVRCPT_SOME(0.00)[]; MID_RHS_MATCH_FROM(0.00)[]; RCVD_VIA_SMTP_AUTH(0.00)[] X-Rspamd-Queue-Id: 4RnHZv5crSz4NwW >>>>> Alexander Leidinger writes: > Am 2023-09-14 16:40, schrieb Mathew, Cherry G.*: >> A few things remain WIP. Obviously, this is a "toy" model - it >> has stack based "memory" management, and a directory buffer size >> of 64. So that needs to be hammered on a bit more. Further, I'm >> keen to now dip my toes into re-entrancy. If you noticed in the >> earlier patches, there were model routines for >> "mutex_enter()/mutex_exit()". I'll re-look these and play around >> a little bit with concurrent entry of ARC() (ARC() is now >> strictly entered sequentially in a loop - see arc.drv). Once >> things settle down, I will look at making an actual block disk >> driver with an ARC(9) managed cache using this code. > Without having looked at anything in the code, and now with your > comment about an "actual block disk driver"... AFAIR your ARC is > based upon the paper, and this is not used anywhere in > FreeBSD. ZFS is using a modified/adapted version of the ARC. What > you are describing sounds a bit like our buffer cache > (https://wiki.freebsd.org/BasicVfsConcepts#:~:text=Buffer%20cache%20is%20a%20layer,on%20a%20vnode%2Blbn%20basis.), > but our buffer cache is not an ARC, it is AFAIR LRU eviction > based. Hi Alexander - thank you for the comments! Regarding the buffer cache, that is an excellent suggestion, and there are a few things that need to fall in place before it can be meaningfully verified. I'd say that the first step is to put in place "Equivalence verification" code for all the backing infrastructure that most kernel code uses - for example things that mediate or enable concurrency, such as cv(9), mutex(9), spl(9) (Not sure if that exists in FreeBSD), etc. Once those are in place, it will be much easier to write model+invariance code with some measure of confidence, along with extraction. I already have very very rudimentary code for this that I wrote for a QNX job interview (which, very puzzlingly, for a project that claims to support critical systems, they found uninteresting to the point of having zero questions about!) - the point is - it's actually not that hard to put it together (I did it over about 20hours of focussed work) and the benefits are enormous, from what I can tell. Regarding the "block driver" I'm thinking of - at the moment, in my head, it's really not that ambitious at all - it's just a self contained read-cache that could potentially front any existing block driver - for eg: a super slow spindisk based driver could get potential block level speed up. I don't know if the buffer cache works in this way, or it only caches data along specific code paths such as read(2) - this is not an area of the OS I'm familiar with. But there is no reason why the buffer cache itself can't be modelled and verified, if it has been written reasonably carefully enough, modularity wise. > I fully understand that you are far away from doing real modelling > of such complex parts as the VFS parts of FreeBSD, but maybe this > info gives a hint in terms of looking into some parts and see if > you can adopt some parts in terms of design which can be anhanced > later on to some real FreeBSD stuff... Definitely noted, and thank you for the signpost! I'm pasting below some early work I did in February, just to give a sense of what it might look like, if an existing part of the (in this case NetBSD) kernel were to be attempted to be verified. Note that the work below is incomplete, but it did show PoC, which prompted me to investigate this line of reasoning further. I'm looking forward to working more in this area, and hope that the FreeBSD community will have some interest in supporting this work, especially once the equivalence code is in place, by verifying existing bits of code piecemeal until we can have the entire OS under at least a very basic verification harness! Looking forward. -- ~cherry diff -urN Makefile ./Makefile --- Makefile 1970-01-01 05:30:00.000000000 +0530 +++ ./Makefile 2023-02-22 00:51:21.589143403 +0530 @@ -0,0 +1,89 @@ +# This set of spinroot related files were written by cherry +# in the Gregorian Calendar year AD.2023, in the month +# of February that year. +# +# We have two specification files and a properties file +# +# The properties file contains "constraint" sections +# such as ltl or never claims (either or, not both). +# The specification is divided into two files: +# the file with suffix '.drv' is a "driver" which +# instantiates processes that will ultimately "drive" the +# models under test. +# The file with the suffix '.pml' contains the process +# model code, which, is intended to be the formal specification +# for the code we are interested in writing in C. +# +# We process these files in slightly different ways during +# the dev cycle, but broadly speaking, the idea is to create +# a file called 'spinmodel.pml' which contains the final +# model file that is fed to spin. +# +# Note that when we use the model extractor tool "modex" to +# extract the 'specification' from C code written to implement +# the model defined above. We use a 'harness' file (see file with +# suffix '.prx' below. +# +# Once the harness has been run, spinmodel.pml should be +# synthesised and processed as usual. +# +# The broad idea is that software dev starts by writing the spec +# first, validating the model, and then implementing the model in +# C, after which we come back to extract the model from the C file +# and cross check our implementation using spin. +# +# If things go well, the constraints specified in the '.ltl' file +# should hold exactly for both the handwritten model, and the +# extracted one. + +spin-gen: md.strategy.pml md.strategy.drv md.strategy.prop + cp md.strategy.pml model #mimic modex + cat md.strategy.drv > spinmodel.pml;cat model >> spinmodel.pml;cat md.strategy.prop >> spinmodel.pml; + spin -a spinmodel.pml + +spin-build: pan.* + cc -o pan pan.c + +spin-run: spin-build #XXX depend on pan + ./pan -a #Generate md.strategy.pml.trail on error + +# You run the trace only if the spin run above failed and created a trail +spin-trace: spinmodel.pml.trail + spin -t spinmodel.pml -p -g # -p (statements) -g (globals) -l (locals) -s (send) -r (recv) + ./pan -r spinmodel.pml.trail -g + +# Modex Extracts from md.c to 'model' - see md.strategy.prx +# Unfortunately there doesn't seem to be a way to specify a filename +# to generate +SRC = $HOME/work/NetBSD-src + +modex-gen: md.strategy.prx md.c + #modex -v -w -D_KERNEL -I$obj/home/antix/work/NetBSD-src/destdir.amd64/usr/include -I$$HOME/work/NetBSD-src/obj/home/antix/work/NetBSD-src/sys/arch/amd64/compile/GENERIC/ -I$$HOME/work/NetBSD-src/sys md.strategy.prx + #cat model > spinmodel.pml + touch ioconf.h # Pretend we have an Kern conf + modex -v -w md.strategy.prx + cat md.strategy.drv > spinmodel.pml;cat model >> spinmodel.pml;cat md.strategy.prop >> spinmodel.pml; + spin -a spinmodel.pml #Sanity check + +modex-gen-clean: + rm -f ioconf.h # Temp - see above. + rm -f spinmodel.pml # Our consolidated model file + rm -f _spin_nvr.tmp # Never claim file + rm -f model # modex generated intermediate "model" file + rm -f pan.* # Spin generated source files + rm -f _modex* # modex generated script files + rm -f *.I *.M +spin-gen-clean: + rm -f spinmodel.pml # Our consolidated model file + rm -f _spin_nvr.tmp # Never claim file + rm -f model # Intermediate "model" file + rm -f pan.* # Spin generated source files + +spin-build-clean: + rm -f pan + +spin-run-clean: + rm -f spinmodel.pml.trail + +clean: modex-gen-clean spin-gen-clean spin-build-clean spin-run-clean +# rm -f *~ diff -urN md.strategy.drv ./md.strategy.drv --- md.strategy.drv 1970-01-01 05:30:00.000000000 +0530 +++ ./md.strategy.drv 2023-02-22 00:26:27.428777059 +0530 @@ -0,0 +1,211 @@ +/* $NetBSD$ */ + +/* Spin model driver for NetBSD md(4) md.c written by cherry */ + +//#define MEMORY_DISK_SERVER + +/* XXX: Bitfields are messed up, because promella doesn't do hex */ + +#define B_WRITE 0 /* Write buffer (pseudo flag). */ +#define B_READ 1 /* Read buffer. */ + +/* Data types modelled on sys/buf.h */ + +/* Modelled on sys/buf.h:struct buf {}; */ +typedef buf_t { + bool b_iodone_flag; /* Internal - flags biodone() */ + int b_error; /* b: errno value. */ + int b_blkno; /* b: physical block number (volume relative) */ + int b_resid; /* b: remaining I/O. */ + int b_flags; /* b: B_* flags */ + int b_bcount; /* b: valid bytes in buffer */ + int b_data; /* b: fs private data */ +}; + +/* XXX: auto sync/extract with md.h ? */ +#define MD_UNCONFIGURED 0 +#define MD_KMEM_FIXED 1 +#define MD_KMEM_ALLOCATED 2 +#define MD_UMEM_SERVER 3 + +/* Device state. + * See: init() below; + * XXX: dynamic instantiation ? + */ +bit sc_lock; +int sc_size; +int sc_addr; +byte sc_type; +bool sc_dkbusy; + +/* + * XXX: These VAs are arbitrary - the vague intention is some form of + * range based validation. TBD. + */ +#define KERNVA 1024; + +#ifdef MEMORY_DISK_SERVER + +#define USERVA 1024; + +#define UMEM_QSIZE 5 /* Entries (arbitrary) - use judiciously - adds to statespace */ +chan sc_buflist = [UMEM_QSIZE] of { buf_t }; + +#define bufq_put(_buflist, _bp) _buflist!_bp +#define bufq_get(_buflist, _bp) _buflist?_bp + +#define copyin(_usrc, _kdst, _len) \ + memcpy(_kdst, _usrc, _len) + +#define copyout(_ksrc, _udst, _len) \ + memcpy(_udst, _ksrc, _len) + +#endif /* MEMORY_DISK_SERVER */ + +/* We model the disk as a channel with read/write "instructions" */ +chan sc_dkdev = [2] of { int/*dst*/, int/*src*/, int/*len*/ }; + +#define memcpy(_dst, _src, _len) { \ + assert(_dst != _src); \ + assert(_len != 0); \ + sc_dkdev!_dst, _src, _len; \ + sc_dkdev?_src, _dst, _len; \ +} + +/* Useful stubs */ +#define biodone(_buf) { \ + assert(_buf.b_iodone_flag != true); \ + _buf.b_iodone_flag = true; \ +} + +#define disk_busy() { sc_dkbusy = true } +#define disk_unbusy() { sc_dkbusy = false } + +/* XXX: Move these into a set of library includes ? */ +/* Note: CAS implemented in an atomic {} block */ +#define mutex_enter(_mutex) \ + atomic { \ + (_mutex == 0) -> _mutex = 1; \ + } + +#define mutex_exit(_mutex) \ + atomic { \ + assert(_mutex == 1); \ + (_mutex == 1) -> _mutex = 0; \ + } + +/* From sys/param.h */ +#define DEV_BSHIFT 9 /* log2(DEV_BSIZE) */ + +/* From sys/errno.h */ +#define EIO 5 /* Input/output error */ + +/* Other global state */ +int bytesread; +int byteswritten; + +#define NPROCS 5 /* + * Should be less than MDDISKSIZE/1024, see bcount, + * blkno etc. calculations below. + * pid is limited to max 255, including driver code in init() + * thus 254 available pids + */ +#define MDDISKSIZE 1024 * 1024 /* 1MB */ + +/* Drive the procs */ +init { + buf_t buffer; + + /* XXX: Use system init routines. */ + /* Initialise Device params */ + sc_type = MD_KMEM_FIXED; + sc_size = MDDISKSIZE; /* In bytes */ + sc_addr = KERNVA; /* Random non-zero "Kernel" address - we do not + do data path validation */ + + + pid proc; + + /* Test kernel vmem backed implementation first */ + atomic { + proc = 0; + do + :: proc < NPROCS -> + /* Use all code-paths */ + /* Even procs read, odd ones write */ + buffer.b_flags = (buffer.b_flags |((proc%2) -> B_READ : B_WRITE)); + + /* Create some variation in buffer sizes + * + * Note: The objective here is not to + * unit test - rather it is to exercise + * code paths in various process instantiations, + * and to verify their mutual interaction. + */ + buffer.b_bcount = (MDDISKSIZE * (proc + 1)) / (NPROCS); + + /* + * Block number offset within device + */ + buffer.b_blkno = ((buffer.b_bcount) >> DEV_BSHIFT); + + run p_mdstrategy(buffer); + proc++ + :: proc >= NPROCS -> + break + od + } + +#ifdef MEMORY_DISK_SERVER + + /* To reset or not, that is the non-question! */ + bytesread = 0; + byteswritten = 0; + + + /* + * Next we test the user memory server backed implementation. + * Here, we have to fire up a single backing server process + * (we assume just a single instance of the driver) which + * will serve the requested memory block ops on behalf of the + * requester processes. + */ + + sc_type = MD_UMEM_SERVER; + sc_addr = USERVA; /* Random non-zero "User" address - we do not + do data path validation */ + + + run p_md_server_loop(); + + atomic { + proc = 0; + do + :: proc < NPROCS -> + /* Use all code-paths */ + /* Even procs read, odd ones write */ + buffer.b_flags = (buffer.b_flags |((proc%2) -> B_READ : B_WRITE)); + + /* Create some variation in buffer sizes + * + * Note: The objective here is not to + * unit test - rather it is to exercise + * code paths in various process instantiations, + * and to verify their mutual interaction. + */ + buffer.b_bcount = (MDDISKSIZE * (proc + 1)) / (NPROCS); + + /* + * Block number offset within device + */ + buffer.b_blkno = ((buffer.b_bcount) >> DEV_BSHIFT); + + run p_mdstrategy(buffer); + proc++ + :: proc >= NPROCS -> + break + od + } +#endif /* MEMORY_DISK_SERVER */ +} + diff -urN md.strategy.pml ./md.strategy.pml --- md.strategy.pml 1970-01-01 05:30:00.000000000 +0530 +++ ./md.strategy.pml 2023-02-22 00:25:08.956729720 +0530 @@ -0,0 +1,179 @@ +/* $NetBSD$ */ + +/* Spin process models for NetBSD md(4) md.c written by cherry */ + +proctype p_mdstrategy(buf_t bp) +{ + bit is_read; + int off, xfer, addr; + + + mutex_enter(sc_lock); + + if +#ifdef MEMORY_DISK_SERVER + :: (sc_type == MD_UMEM_SERVER) + -> + bufq_put(sc_buflist, bp); /* Assume non-blocking */ + /* + * We add the assert below to match cv_signal(9) semantics + * used in the implementation - ie; bufq_put() never blocks. + */ + assert(nfull(sc_buflist)); + mutex_exit(sc_lock); + goto done; +#endif /* MEMORY_DISK_SERVER */ + + :: ( (sc_type == MD_KMEM_FIXED) || + (sc_type == MD_KMEM_ALLOCATED) + ) -> + + is_read = ((bp.b_flags & B_READ) && 1); + + bp.b_resid = bp.b_bcount; + + off = (bp.b_blkno << DEV_BSHIFT); + + if + :: ( off >= sc_size ) -> + if + :: is_read -> goto EOF; + :: else -> goto set_eio; + fi + :: else -> + skip; + fi; + + xfer = bp.b_resid; + + if + :: (xfer > (sc_size - off)) -> + xfer = (sc_size - off); + :: else -> + skip; + fi + + addr = sc_addr + off; + + disk_busy(); + + /* + * We count the read/write totals as state for + * possible later property checks. + * + * But we otherwise fully exclude the data itself from + * the state of the control-plane, as data transfer + * function validation should perhaps be the domain of + * unit testing. + * + */ + + if + :: (is_read) -> memcpy(bp.b_data, addr, xfer); + bytesread = bytesread + xfer; + :: else -> memcpy(addr, bp.b_data, xfer); + byteswritten = byteswritten + xfer; + fi + + + disk_unbusy(); + + bp.b_resid = bp.b_resid - xfer; + + :: else -> /* Fallback - don't block */ + bp.b_resid = bp.b_bcount; +set_eio: + bp.b_error = EIO; + fi + +EOF: + + mutex_exit(sc_lock); + + biodone(bp); + +done: +} + +#ifdef MEMORY_DISK_SERVER +proctype p_md_server_loop() +{ + + bit is_read; + int off, xfer, addr, error; + + buf_t bp; + + do + :: true -> + /* + * Note: no messing around with sc_lock here unlike the + * implementation, which uses sc_lock + cv(9) + mutex(9) + * dance to simulate LWP awake + lock held semantics. + * + * XXX: Build a library of promela models for these kernel APIs. + */ + bufq_get(sc_buflist, bp); + + + is_read = ((bp.b_flags & B_READ) && 1); + + bp.b_resid = bp.b_bcount; + + off = (bp.b_blkno << DEV_BSHIFT); + + if + :: ( off >= sc_size ) -> + if + :: is_read -> + goto done; + :: else -> + error = EIO; + goto done; + fi + :: else -> + skip; + fi; + + xfer = bp.b_resid; + + if + :: (xfer > (sc_size - off)) -> + xfer = (sc_size - off); + :: else -> + skip; + fi + + addr = sc_addr + off; + + disk_busy(); + + if + :: (is_read) -> + copyin(addr, bp.b_data, xfer); + bytesread = bytesread + xfer; + :: else -> + copyout(bp.b_data, addr, xfer); + byteswritten = byteswritten + xfer; + fi + + disk_unbusy(); + + if + :: (!error) -> + bp.b_resid = bp.b_resid - xfer; + :: else -> + skip; + fi + +done: + if + :: (error) -> + bp.b_resid = error; + :: else -> + skip; + fi + biodone(bp); + od +} +#endif /* MEMORY_DISK_SERVER */ diff -urN md.strategy.prop ./md.strategy.prop --- md.strategy.prop 1970-01-01 05:30:00.000000000 +0530 +++ ./md.strategy.prop 2023-02-19 21:43:45.633184892 +0530 @@ -0,0 +1,13 @@ +/* $NetBSD$ */ + +ltl +{ + /* We only access the disk if sc_lock is held */ + always ((sc_dkbusy == true) implies (sc_lock == 1)) && + /* memcpy() is synchronous! */ + always (len(sc_dkdev) <= 1) && + /* Eventually all disk activity should die down */ + eventually always (len(sc_dkdev) == 0) && + /* Liveness - all thread finally end */ + eventually always (_nr_pr == 1) +} diff -urN md.strategy.prx ./md.strategy.prx --- md.strategy.prx 1970-01-01 05:30:00.000000000 +0530 +++ ./md.strategy.prx 2023-02-22 00:54:27.913876007 +0530 @@ -0,0 +1,142 @@ +// Spin model extractor harness written by cherry +// +%F md.c +%X -n mdstrategy +%H +// Disable effects of all included files and try to implement a subset of the APIs they provide. +#define _SYS_CDEFS_H_ +#define __KERNEL_RCSID(_ign, ign) +#define _SYS_PARAM_H_ +#define _SYS_KERNEL_H_ +#define _SYS_KMEM_H_ +#define _SYS_SYSTM_H_ +#define _SYS_BUF_H_ +#define _SYS_DEVICE_H_ +#define _SYS_DISK_H_ +#define _SYS_STAT_H_ +#define _SYS_PROC_H_ +#define _SYS_CONF_H_ +#define _UVM_UVM_EXTERN_H_ + + +// dev/md.h +#define MD_UNCONFIGURED 0 +#define MD_KMEM_FIXED 1 +#define MD_KMEM_ALLOCATED 2 + +// sys/buf.h +#define B_READ 0x00100000 /* Read buffer. */ +#define B_WRITE 0x00000000 /* Write buffer (pseudo flag). */ + +// sys/param.h +#define DEV_BSHIFT 9 + +// sys/errno.h +#define EIO 5 /* Input/output error */ +#define ENXIO 6 /* Device not configured */ + +// sys/null.h +#define NULL 0 + +#define true 1 +#define false 0 + +struct buf { + int b_error; + int b_blkno; + int b_resid; + int b_flags; + int b_bcount; + int b_data; + int b_iodone_flag; +}; + +struct md_conf { + int md_type; + int md_size; + int md_addr; +} + +#define MEMORY_DISK_SERVER 1 +typedef int size_t; +typedef int bool; + +struct md_softc md_sc; +#define device_lookup_private(_ign1, _ign2) (&md_sc) + +// The following are unused (yet) for modelling. +#define kcondvar_t int +#define kmutex_t int +#define device_t int +#define size_t int + + +void md_bdevsw; +void md_cdevsw; + +struct dkdriver { + void *dummy; /* Placeholder */ +}; +struct disk { + void *dummy; +}; + +struct dkdriver mddkdriver; /* Redundant placeholder */ + +/* Some stubs are referred to in function prototypes */ +typedef void dev_t; +typedef unsigned long u_long; +typedef void cfdata_t; +typedef void vaddr_t; +typedef void vsize_t; + +#define CFATTACH_DECL3_NEW(_ign1, _ign2, _ign3, _ign4, _ign5, _ign6, _ign7, _ign8, _ign9) + +//XXX: MEMORY_DISK_SERVER +#define bufq_put(_ign1, _ign2) +#define cv_signal(_ign1) + +%% +%C // c_code {} +%% +//%D // c_cdecl {} +//%% +%L +// Modelled functions. +// mutex(9) +mutex_enter(... mutex_enter(sc_lock) +mutex_exit(... mutex_exit(sc_lock) + +// memcpy(9) +memcpy(addr... memcpy(addr, bufferp.b_data, xfer) +memcpy(bp... memcpy(bufferp.b_data, addr, xfer) + +// disk(9) +disk_busy(... disk_busy() +disk_unbusy(... disk_unbusy() + +// bufferio(9) +biodone(bp) biodone(bufferp) + +//Declare hidden sc mdstrategy +Declare int addr mdstrategy +Declare int off mdstrategy +Declare int xfer mdstrategy +Declare bit is_read mdstrategy +%% + +%P +proctype p_mdstrategy(buf_t bufferp) +{ + c_code { struct buf buf1; + buf1.b_flags |= (Pp_mdstrategy->bufferp.b_flags& B_READ) ? B_READ : B_WRITE; + buf1.b_bcount = Pp_mdstrategy->bufferp.b_bcount; + buf1.b_blkno = Pp_mdstrategy->bufferp.b_blkno; + Pp_mdstrategy->bp = &buf1; + } + + +#include "_modex_mdstrategy.pml" + +} +%% \ No newline at end of file From nobody Sat Sep 16 07:46:38 2023 X-Original-To: hackers@mlmmj.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mlmmj.nyi.freebsd.org (Postfix) with ESMTP id 4Rnjn51psgz4tftl for ; Sat, 16 Sep 2023 07:46:49 +0000 (UTC) (envelope-from sebastian.huber@embedded-brains.de) Received: from dedi548.your-server.de (dedi548.your-server.de [85.10.215.148]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 4Rnjn42Kkgz4H8s for ; Sat, 16 Sep 2023 07:46:48 +0000 (UTC) (envelope-from sebastian.huber@embedded-brains.de) Authentication-Results: mx1.freebsd.org; dkim=none; spf=pass (mx1.freebsd.org: domain of sebastian.huber@embedded-brains.de designates 85.10.215.148 as permitted sender) smtp.mailfrom=sebastian.huber@embedded-brains.de; dmarc=none Received: from sslproxy05.your-server.de ([78.46.172.2]) by dedi548.your-server.de with esmtpsa (TLS1.3) tls TLS_AES_256_GCM_SHA384 (Exim 4.94.2) (envelope-from ) id 1qhQ0l-000E7J-Nv for hackers@freebsd.org; Sat, 16 Sep 2023 09:46:40 +0200 Received: from [82.100.198.138] (helo=mail.embedded-brains.de) by sslproxy05.your-server.de with esmtpsa (TLSv1.3:TLS_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1qhQ0l-000EFr-KF for hackers@freebsd.org; Sat, 16 Sep 2023 09:46:39 +0200 Received: from localhost (localhost [127.0.0.1]) by mail.embedded-brains.de (Postfix) with ESMTP id 4EEFC480155 for ; Sat, 16 Sep 2023 09:46:39 +0200 (CEST) Received: from mail.embedded-brains.de ([127.0.0.1]) by localhost (zimbra.eb.localhost [127.0.0.1]) (amavis, port 10032) with ESMTP id ftlM0O81MwQK for ; Sat, 16 Sep 2023 09:46:39 +0200 (CEST) Received: from localhost (localhost [127.0.0.1]) by mail.embedded-brains.de (Postfix) with ESMTP id EE2CA4801D8 for ; Sat, 16 Sep 2023 09:46:38 +0200 (CEST) X-Virus-Scanned: amavis at zimbra.eb.localhost Received: from mail.embedded-brains.de ([127.0.0.1]) by localhost (zimbra.eb.localhost [127.0.0.1]) (amavis, port 10026) with ESMTP id AnUlMxQPqJYy for ; Sat, 16 Sep 2023 09:46:38 +0200 (CEST) Received: from [10.10.171.34] (unknown [10.10.171.34]) by mail.embedded-brains.de (Postfix) with ESMTPSA id C7860480155 for ; Sat, 16 Sep 2023 09:46:38 +0200 (CEST) Message-ID: Date: Sat, 16 Sep 2023 09:46:38 +0200 List-Id: Technical discussions relating to FreeBSD List-Archive: https://lists.freebsd.org/archives/freebsd-hackers List-Help: List-Post: List-Subscribe: List-Unsubscribe: Sender: owner-freebsd-hackers@freebsd.org MIME-Version: 1.0 User-Agent: Mozilla Thunderbird To: hackers@freebsd.org Content-Language: en-US From: Sebastian Huber Subject: Remove timecounter tc_counter_mask member? Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: quoted-printable X-Authenticated-Sender: smtp-embedded@poldi-networks.de X-Virus-Scanned: Clear (ClamAV 0.103.10/27032/Fri Sep 15 09:38:51 2023) X-Spamd-Bar: + X-Spamd-Result: default: False [1.41 / 15.00]; SUBJECT_ENDS_QUESTION(1.00)[]; NEURAL_HAM_MEDIUM(-1.00)[-0.999]; NEURAL_SPAM_LONG(0.98)[0.978]; NEURAL_SPAM_SHORT(0.73)[0.725]; R_SPF_ALLOW(-0.20)[+ip4:85.10.215.148]; MIME_GOOD(-0.10)[text/plain]; XM_UA_NO_VERSION(0.01)[]; DMARC_NA(0.00)[embedded-brains.de]; ARC_NA(0.00)[]; MLMMJ_DEST(0.00)[hackers@freebsd.org]; ASN(0.00)[asn:24940, ipnet:85.10.192.0/18, country:DE]; R_DKIM_NA(0.00)[]; FROM_EQ_ENVFROM(0.00)[]; MIME_TRACE(0.00)[0:+]; RCVD_COUNT_SEVEN(0.00)[7]; TO_MATCH_ENVRCPT_ALL(0.00)[]; FROM_HAS_DN(0.00)[]; RCVD_VIA_SMTP_AUTH(0.00)[]; RCVD_TLS_LAST(0.00)[]; MID_RHS_MATCH_FROM(0.00)[]; TO_DN_NONE(0.00)[]; PREVIOUSLY_DELIVERED(0.00)[hackers@freebsd.org]; RCPT_COUNT_ONE(0.00)[1]; HAS_X_AS(0.00)[] X-Rspamd-Queue-Id: 4Rnjn42Kkgz4H8s Hello, the timecounter structure contains a tc_counter_mask which enables=20 support for time counters implementing less than 32-bits: struct timecounter { timecounter_get_t *tc_get_timecount; #ifndef __rtems__ /* * This function reads the counter. It is not required to * mask any unimplemented bits out, as long as they are * constant. */ uint32_t tc_counter_mask; /* This mask should mask off any unimplemented bits. */ [...] }; In the FreeBSD main branch sys/x86/x86/tsc.c: .tc_counter_mask =3D ~0u, sys/x86/x86/pvclock.c: pvc->tc.tc_counter_mask =3D ~0U; sys/x86/isa/clock.c: sc->tc.tc_counter_mask =3D 0xffff; sys/arm/ti/am335x/am335x_dmtimer.c: sc->func.tc.tc_counter_mask =3D= ~0u; sys/arm/ti/am335x/am335x_dmtpps.c: sc->tc.tc_counter_mask =3D ~0u; sys/arm/allwinner/a10_timer.c: .tc_counter_mask =3D ~0u, sys/arm/allwinner/a10_timer.c: .tc_counter_mask =3D ~0u, sys/arm/arm/generic_timer.c: .tc_counter_mask =3D ~0u, sys/arm/arm/sp804.c: sc->tc.tc_counter_mask =3D ~0u; sys/arm/arm/mpcore_timer.c: .tc_counter_mask =3D ~0u, sys/arm/broadcom/bcm2835/bcm2835_systimer.c: .tc_counter_mask =3D ~0= u, sys/arm/mv/timer.c: .tc_counter_mask =3D ~0u, sys/arm/freescale/imx/imx_gpt.c: .tc_counter_mask =3D ~0u, sys/arm/freescale/imx/imx_epit.c: sc->tc.tc_counter_mask =3D=20 0xffffffff; sys/powerpc/powerpc/clock.c: .tc_counter_mask =3D ~0u, sys/dev/acpica/acpi_hpet.c: sc->tc.tc_counter_mask =3D ~0u, sys/dev/acpica/acpi_timer.c: acpi_timer_timecounter.tc_counter_mask =3D= =20 0xffffffff; sys/dev/acpica/acpi_timer.c: acpi_timer_timecounter.tc_counter_mask =3D= =20 0x00ffffff; sys/dev/xen/timer/xen_timer.c: sc->tc.tc_counter_mask =3D ~0u; sys/dev/hyperv/vmbus/amd64/hyperv_machdep.c: .tc_counter_mask=20 =3D 0xffffffff, sys/dev/hyperv/vmbus/x86/hyperv_x86.c: .tc_counter_mask =3D 0xffffffff, sys/riscv/riscv/timer.c: .tc_counter_mask =3D ~0u, only two timecounters use a mask other than 0xffffffff. These are sys/x86/isa/clock.c: sc->tc.tc_counter_mask =3D 0xffff; and sys/dev/acpica/acpi_timer.c- if (AcpiGbl_FADT.Flags &=20 ACPI_FADT_32BIT_TIMER) sys/dev/acpica/acpi_timer.c: acpi_timer_timecounter.tc_counter_mask =3D= =20 0xffffffff; sys/dev/acpica/acpi_timer.c- else sys/dev/acpica/acpi_timer.c: acpi_timer_timecounter.tc_counter_mask =3D= =20 0x00ffffff; Is the sys/x86/isa/clock.c still used? Are there chips on the market=20 with 24-bit ACPI timers? Instead of using the mask, we could instead left shift the frequency and=20 the returned count by 16 (sys/x86/isa/clock.c) or 8=20 (sys/dev/acpica/acpi_timer.c). Then we could remove the tc_counter_mask=20 member to simplify some calculations such as: /* * Return the difference between the timehands' counter value now and wh= at * was when we copied it to the timehands' offset_count. */ static __inline uint32_t tc_delta(struct timehands *th) { struct timecounter *tc; tc =3D th->th_counter; return ((tc->tc_get_timecount(tc) - th->th_offset_count) & tc->tc_counter_mask); } Would such a change be acceptable for FreeBSD? Kind regards, Sebastian --=20 embedded brains GmbH Herr Sebastian HUBER Dornierstr. 4 82178 Puchheim Germany email: sebastian.huber@embedded-brains.de phone: +49-89-18 94 741 - 16 fax: +49-89-18 94 741 - 08 Registergericht: Amtsgericht M=C3=BCnchen Registernummer: HRB 157899 Vertretungsberechtigte Gesch=C3=A4ftsf=C3=BChrer: Peter Rasmussen, Thomas= D=C3=B6rfler Unsere Datenschutzerkl=C3=A4rung finden Sie hier: https://embedded-brains.de/datenschutzerklaerung/