X-Recipient: archive-cygwin@delorie.com
DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org AFBE5385842B
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=cygwin.com;
	s=default; t=1673874523;
	bh=vmdbQnHXZXP01JzFYxmhN1nsaRJeqOaO7kLiYyPxB/Y=;
	h=Date:To:Subject:References:In-Reply-To:List-Id:List-Unsubscribe:
	 List-Archive:List-Post:List-Help:List-Subscribe:From:Reply-To:Cc:
	 From;
	b=w7SAgDYY/GjEToRd1L1rFJKnaKVm9F1JCjtER8T5EXBxVRBrErTvuXDP+V+kM52tQ
	 vujlwbnWlV0w61Z4DwQwrAYgi72IY7jZRUHNPOnNlC0BxuyBEPkHrNxTQotiencKAE
	 YlSPrOge8xlt+8PM7c7YX7Xc8VhXa2CVlGFggVUQ=
X-Original-To: cygwin@cygwin.com
Delivered-To: cygwin@cygwin.com
Date: Mon, 16 Jan 2023 14:08:21 +0100
To: cygwin@cygwin.com
Subject: Re: vmstat yields error 'Unable to create system stat structure' on
 W11x64
Message-ID: <Y8VMRejAHv8BgwDB@calimero.vinschen.de>
Mail-Followup-To: cygwin@cygwin.com, Achim Gratz <Stromeko@nexgo.de>
References: <38D69F25-39D2-4A62-B2BD-94055EB2994B@prs.de>
 <Y8UksJ4O2q1+SZn5@calimero.vinschen.de>
MIME-Version: 1.0
Content-Disposition: inline
In-Reply-To: <Y8UksJ4O2q1+SZn5@calimero.vinschen.de>
X-Provags-ID: V03:K1:iQEWQ66NLVH3wDldVHbwY1YsbkVhulZT0NqgsACkG2zGuXjS1sl
 AxnP6ZMGjPOwa7BI2kvFyHe2xZULVGpV5dND2c+5+VRH3XivSxv/RqMQ/CZOjXM/jxfYAKt
 2e9rElXEvI0yAYy9odj1eWnge/o6WhHppugMsKd0bcHtjsStuA/gRKjN0h9oyxKFbSyHbM+
 yV8pkCZdgRCsoiNh4pXhA==
UI-OutboundReport: notjunk:1;M01:P0:sRqn3pSHdPI=;dGpz7inSwGd400gYm8Qm/XKQz0V
 ayVaVSRQEQojbIkcxQNj3x8ClfsT6ap6tUe1YD1Y6nXSNeeN88fE+4fCMuUxBIcCswPtqanG5
 EIUMOk4juQ7uJsosJJsrG8rGrIhlCO7qWorbSQ3js+QOFGXGjgYdwW5dij2kQMf0j79aM1jyN
 ZJoD0FzfaECgNKnHdPImVImJ2dnEM0LboTjRI0dlffZIOro5Ez/CfvpqaaNagoCU2MbRAr9k/
 Bi6WjjtF9O3ChTunRavkEs3G4hBKNIRYlfKtaoQg6DxUBiU26Uo36gzI6A1dS5oXDbLldJ6q4
 UBc6Nid2S5nIc2Cme38Y8zBBxGz4qR5eagbc5V1JnxeXHAVOfQ8O87CyOEcBTuQsOp4o9LOKY
 hLZWhcR5he4VLU1OGQiF+YOY4aD+XnbJkWY+Ps+KYzcd1FyUWlsVKG8WaWigZ73518RvDTG7X
 mbY5uJ3PxjWroPJp+voWLHjMu+iiZ4hSHyFFvTgUxMsQBKOs2EySIUpZYyBzGmNLN4P85Bko6
 3tDvuM8U73NYFlwv4a3DZ5Bm2nGj4pRHKqWLM48cmh8iv0jkOuuWCYdi0/VKRYN9dbplE8vDn
 oHtr/StaY1vfEUtOYEqMBXup7TzskNcJ0dC7Vq+CSR5euxjw9VpVMDM6VW70l5EP6I6ilPRVZ
 /wPiPDWtxpTSQXtzHFIZz9PAiJzVzA7CtiZcWpzC4A==
X-Spam-Status: No, score=-96.6 required=5.0 tests=BAYES_00,
 GOOD_FROM_CORINNA_CYGWIN, KAM_DMARC_STATUS, KAM_NUMSUBJECT, RCVD_IN_DNSWL_NONE,
 RCVD_IN_MSPIKE_H2, SPF_FAIL, SPF_HELO_NONE,
 TXREP autolearn=ham autolearn_force=no version=3.4.6
X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on
 server2.sourceware.org
X-BeenThere: cygwin@cygwin.com
X-Mailman-Version: 2.1.29
Precedence: list
List-Id: General Cygwin discussions and problem reports <cygwin.cygwin.com>
List-Unsubscribe: <https://cygwin.com/mailman/options/cygwin>,
 <mailto:cygwin-request@cygwin.com?subject=unsubscribe>
List-Archive: <https://cygwin.com/pipermail/cygwin/>
List-Post: <mailto:cygwin@cygwin.com>
List-Help: <mailto:cygwin-request@cygwin.com?subject=help>
List-Subscribe: <https://cygwin.com/mailman/listinfo/cygwin>,
 <mailto:cygwin-request@cygwin.com?subject=subscribe>
From: Corinna Vinschen via Cygwin <cygwin@cygwin.com>
Reply-To: cygwin@cygwin.com
Cc: Corinna Vinschen <corinna-cygwin@cygwin.com>,
        Achim Gratz <Stromeko@nexgo.de>
Content-Type: text/plain; charset="utf-8"
Errors-To: cygwin-bounces+archive-cygwin=delorie.com@cygwin.com
Sender: "Cygwin" <cygwin-bounces+archive-cygwin=delorie.com@cygwin.com>
Content-Transfer-Encoding: 8bit
X-MIME-Autoconverted: from base64 to 8bit by delorie.com id 30GD99uN010630

On Jan 16 11:19, Corinna Vinschen via Cygwin wrote:
> On Jan 15 22:04, System Administrator via Cygwin wrote:
> > Hello,
> > 
> > I am trying to migrate my framework to Windows 11 running Cygwin.
> > When executing vmstat it returns the following error:
> > 
> > "Unable to create system stat structure”
> > [...]
> I don't think this has anything to do with Windows10 or 11, but with the
> version of procps-ng you're running.
> 
> I tried vmstat from procps-ng-4.0.2-1 on both, W10 and W11, and I got
> the above error in both cases.
> 
> I switched back to procps-ng-3.3.17-1 and vmstat worked fine on both,
> W10 and W11.
> 
> I ran vmstat from procps-ng-4.0.2-1 under GDB and found that this
> vmstat tries to dynamically load libnuma.so or libnuma.1.so, both
> of which are naturally not available on Cygwin.  So I guess vmstat
> from procps-ng-4.x still needs another patch.

While that's obviously wrong, it's not the problem.  It turns out that
vmstat from procps-ng 4.0.2 stumbles over the fact, that /proc/cpuinfo
only prints the following fields if the CPU is a multi core CPU:

  "physical id"
  "siblings",
  "core id"
  "cpu cores"
  "apicid"
  "initial apicid"

On Linux the output of those fields only depends on the configuration
of the kernel.  If it has been built with CONFIG_SMP, these fields are
part of the /proc/cpuinfo output.

On Cygwin, the output of these fields actually depends on the fact if
the HTT CPU flag is set or not.  If not, it's not a multi core CPU and
the aforementioned fields are omitted.

I could reproduce this issue by changing the CPU topology in my QEMU/KVM
Windows 10 machine.  The default topology was 4 CPUs with 1 core and 1
thread each.  I changed that to 2 CPUs with 2 cores and 1 thread each.
After restarting the W10 machine, vmstat from procps-ng 4.0.2 started
working as desired.

So we can fix this issue by tweaking Cygwin instead.  I guess this will
be fodder for the upcoming 3.4.4 release.

I'll also provide a test release in a bit, stay tuned.

Achim, I still wonder if vmstat shouldn't also work on Linux if the
kernel hasn't been built with CONFIG_SMP.  Does the vmstat code fail
to take that into account?


Corinna

-- 
Problem reports:      https://cygwin.com/problems.html
FAQ:                  https://cygwin.com/faq/
Documentation:        https://cygwin.com/docs.html
Unsubscribe info:     https://cygwin.com/ml/#unsubscribe-simple

