Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

ARM: failed to determine memory area for node: open /sys/devices/system/memory/block_size_bytes: no such file or directory #336

Closed
wanyaoqi opened this issue Apr 21, 2023 · 7 comments
Assignees
Labels
bug linux/arm ARM architecture

Comments

@wanyaoqi
Copy link

wanyaoqi commented Apr 21, 2023

topology.New() will report:
WARNING: failed to determine memory area for node: open /sys/devices/system/memory/block_size_bytes: no such file or directory

ARM no /sys/devices/system/memory directory.
As the this comment: kata-containers/runtime#796 (comment)
ARM not support memory hotplug,and i can't get physical memory from sysfs.

Is there any way around this problem

@jaypipes jaypipes added question linux/arm ARM architecture labels Apr 21, 2023
@jaypipes
Copy link
Owner

Hi @wanyaoqi thanks for submitting this issue. You can turn off these warnings. For ARM, topology memory information may not be available due to platform limitations.

@wanyaoqi
Copy link
Author

wanyaoqi commented Apr 21, 2023

Hi @jaypipes , thanks for your reply. The problem is get numa node physical memory size, others topo info is works.
And i don't need numa node physical memory size actually, so i just paste usable size to physical size to workaround this problem. wanyaoqi#1
Can we check /sys/devices/system/memory/block_size_bytes file exists, if not exist return a inaccuracy value( usable size) or return -1 rather than return a error, because other numa topo infomation is work.

@jaypipes
Copy link
Owner

Hi @jaypipes , thanks for your reply. The problem is get numa node physical memory size, others topo info is works. And i don't need numa node physical memory size actually, so i just paste usable size to physical size to workaround this problem. wanyaoqi#1 Can we check /sys/devices/system/memory/block_size_bytes file exists, if not exist return a inaccuracy value( usable size) or return -1 rather than return a error, because other numa topo infomation is work.

@wanyaoqi we already do that :)

// detect physical memory from /sys/devices/system/memory
dir := paths.SysDevicesSystemMemory
blockSizeBytes, err := memoryBlockSizeBytes(dir)
if err != nil {
total = -1
return total
}

@wanyaoqi
Copy link
Author

Hi @jaypipes , thanks for your reply. The problem is get numa node physical memory size, others topo info is works. And i don't need numa node physical memory size actually, so i just paste usable size to physical size to workaround this problem. wanyaoqi#1 Can we check /sys/devices/system/memory/block_size_bytes file exists, if not exist return a inaccuracy value( usable size) or return -1 rather than return a error, because other numa topo infomation is work.

@wanyaoqi we already do that :)

// detect physical memory from /sys/devices/system/memory
dir := paths.SysDevicesSystemMemory
blockSizeBytes, err := memoryBlockSizeBytes(dir)
if err != nil {
total = -1
return total
}

@jaypipes Okay, but function AreaForNode seems like not fixed ?

func AreaForNode(ctx *context.Context, nodeID int) (*Area, error) {
paths := linuxpath.New(ctx)
path := filepath.Join(
paths.SysDevicesSystemNode,
fmt.Sprintf("node%d", nodeID),
)
blockSizeBytes, err := memoryBlockSizeBytes(paths.SysDevicesSystemMemory)
if err != nil {
return nil, err
}

@wanyaoqi
Copy link
Author

wanyaoqi commented Apr 21, 2023

AreaForNode should call memTotalPhysicalBytes like this:

func AreaForNode(ctx *context.Context, nodeID int) (*Area, error) {
	paths := linuxpath.New(ctx)
	path := filepath.Join(
		paths.SysDevicesSystemNode,
		fmt.Sprintf("node%d", nodeID),
	)

	totPhys := memTotalPhysicalBytes(paths)
	totUsable, err := memoryTotalUsableBytesFromPath(filepath.Join(path, "meminfo"))
	if err != nil {
		return nil, err
	}

	supportedHP, err := memorySupportedPageSizes(filepath.Join(path, "hugepages"))
	if err != nil {
		return nil, err
	}

	return &Area{
		TotalPhysicalBytes: totPhys,
		TotalUsableBytes:   totUsable,
		SupportedPageSizes: supportedHP,
	}, nil
}

@jaypipes
Copy link
Owner

@wanyaoqi gotcha. I will push a fix shortly. :) thank you!

jaypipes added a commit that referenced this issue Apr 21, 2023
`/sys/devices/system/memory` does not exist on linux/arm systems that do
not support memory hotplug. This means that the
`/sys/devices/system/memory/block_size_bytes` file also does not exist
and that is the file that we use to determine the physical RAM
associated with a RAM module affined to a NUMA node.

This commit updates the logic in `pkg/memory.AreaForNode` on linux
platforms to tolerate the error returned by `memoryBlockSizeBytes()`
when `/sys/devices/system/memory/block_size_bytes` does not exist and
set a memory `Area`'s `TotalPhysicalBytes` value to the value of
`TotalUsableBytes`.

Issue #336

Signed-off-by: Jay Pipes <jaypipes@gmail.com>
@jaypipes jaypipes self-assigned this Apr 21, 2023
@jaypipes jaypipes added bug and removed question labels Apr 21, 2023
jaypipes added a commit that referenced this issue Apr 24, 2023
`/sys/devices/system/memory` does not exist on linux/arm systems that do
not support memory hotplug. This means that the
`/sys/devices/system/memory/block_size_bytes` file also does not exist
and that is the file that we use to determine the physical RAM
associated with a RAM module affined to a NUMA node.

This commit updates the logic in `pkg/memory.AreaForNode` on linux
platforms to tolerate the error returned by `memoryBlockSizeBytes()`
when `/sys/devices/system/memory/block_size_bytes` does not exist and
set a memory `Area`'s `TotalPhysicalBytes` value to the value of
either the syslog-determined physical memory total or `TotalUsableBytes`.

Issue #336

Signed-off-by: Jay Pipes <jaypipes@gmail.com>
@mogren
Copy link

mogren commented Oct 12, 2023

I guess this issue can be closed? 😄

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug linux/arm ARM architecture
Projects
None yet
Development

No branches or pull requests

3 participants