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

Invalid argument #15

Open
izekr opened this issue Aug 2, 2021 · 2 comments
Open

Invalid argument #15

izekr opened this issue Aug 2, 2021 · 2 comments

Comments

@izekr
Copy link

izekr commented Aug 2, 2021

Hi,

We are facing new error using pcimem that we didn't see before:
[BSC:root@15DZX23-A pcimem]$ ./pcimem /sys/devices/pci0000\:0a/0000\:0a\:00.0/resource0 0x0 b 0x44 /sys/devices/pci0000:0a/0000:0a:00.0/resource0 opened. Target offset is 0x0, page size is 4096 mmap(0, 4096, 0x3, 0x1, 3, 0x0) Error at line 111, file pcimem.c (22) [Invalid argument]

Any idea what can be the root cause for that?

@billfarrow
Copy link
Owner

Your mmap() call failed for some reason. I'm not sure why.

mmap(void *addr, size_t length, int prot, int flags, int fd, off_t offset) // from the man page
mmap(0, map_size, PROT_READ | PROT_WRITE, MAP_SHARED, fd, target_base) // from pcimem code line 110
mmap(0, 4096, 0x3, 0x1, 3, 0x0). // the parameters used in your example

  1. addr is allowed to be zero.
  2. length is set to the page size
  3. prot is set to both PROT_READ and PROT_WRITE
  4. flags uses MAP_SHARED
  5. fd looks ok, and the previous open() would have returned an error if it couldn't open the file
  6. target_base ?

mmap() man page lists the following for error code 22 (EINVAL), but I only think the first one applies:

EINVAL We don't like addr, length, or offset (e.g., they are too large, or not aligned on a page boundary).
EINVAL (since Linux 2.6.12) length was 0.
EINVAL flags contained neither MAP_PRIVATE or MAP_SHARED, or contained both of these values.

If it was a permissions issue, I would have expected mmap() to set errno to EPERM.

@dharmeshpitroda
Copy link

updated grub with "iomem=relaxed" and issue disappeared for me.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants