I work on Linux Debian with 64bit kernel version 4.19.0 and default SWIOTLB size 64M.
For the needs of a kernel driver that I develop I would like to use more than 64M SWIOTLB.
Is there any way to change the SWIOTLB size permanently.
I keep searching but it is not clear to me.
Thank you!
Giving swiotlb=65536 to kernel command line (e.g. /etc/default/grub) gives 128MB of swiotlb. To make this permanent, we can use update-grub command. If the hardware has hardware IOMMU, iommu=force intel_iommu=on usually removes the need for swiotlb.
Related
I'm playing with Wine on Raspbian Jessie. I just installed from source but executing wine returns:
Warning: memory above 0x80000000 doesn't seem to be accessible.
Wine requires a 3G/1G user/kernel memory split to work properly.
wine: failed to map the shared user data: c0000018
From here, it seems recompiling the kernel with 3G/1G memory might help.
Since I've never did kernel compilation I would like some more motivation in order to go that way. May someone confirm the kernel compilation approach works well? Or perhaps suggest another approach?
Exagear is shipped with a special build of wine that supports 2g/2g memory split. You should use only this build of wine, not the one from apt-get.
Is there a way to lock L2 cache on Pandaboard ES with running Ubuntu there?
TRM says that it is possible, but I don't know it feasible on Pandaboard.
I've tried to compile kernel object and set there bits in Auxiliary Control Register using cp15, but it's RO I suppose, because I cannot write there.
CPSR says I am in a Privilige mode, but i guess that's a non-secure Privilige mode?
How to use that PL310 cache controller to do that?
Do I need to use TrustZone somehow?
When compile SMC #1 instruction using asm volatile(...) when compiling natively on Panda, when trying to taskset this Panda is not responding.
Try OmapConf application to change the register you need.
I haven't tried it in Ubuntu, but I do have used it on Android.
I have a device driver that is freezing the OS. The mouse wont even move. I am trying to debug this issue and I believe one good approach is to use gdb with qemu, two things I have never used before. Is there a better approach?
So first I need to compile the kernel with debug symbols which I have done already.
Now, there is a new file that is generated called vmlinux that is located in that same folder as the source. It seems that I also need a bzImage file according to this so I can run the newly compiled kernel using:
qemu-system-i386 -kernel bzImage
or in debug mode
qemu-system-i386 -s -S -kernel bzImage
I cannot locate the bzImage file. Where do I find it or what is missing here? Is the bzImage referring to the OS Image I created using qemu-img create?
Also, what I do not understand is that now the kernel is compiled (vmlinux) how does I run it with qemu? So my question is when I run it with qemu or the debugger is the kernel running as an app in my main OS?
also how can I install my device driver? My understanding the kernel is not Ubuntu so there is no UI?
Also, I installed qemu and when I type qemu I get command not found. I am guessing I have to pick a specific processor emulator as in qemu-system-i386, qemu-system-x86_64, or qemu-x86_64?
How is qemu different or similar to the kvm command?
Thanks.
So, if I understand the problem correctly, you have a kernel module that needs no specific hardware. When you are working with the module, the system freezes but the kernel log contains nothing special.
The following may be helpful.
Getting the log
The symptoms you described may still be a result of a kernel oops or panic. The logging facilities sometimes die before they can output the information about the error to the log file. You may try to output the log via a serial port, this should be more reliable.
As your kernel module does not need any specific hardware, the easiest way is probably to install the same Linux distro as you use to a virtual machine and connect the virtual serial port (COM) of that machine to a pipe on your host system.
This is usually quite easy to do. For example, this blog post contains the detailed instructions in case the host OS and the guest OS are Ubuntu 11.10.
VirtualBox is used there to manage the virtual machines. If you prefer QEMU, this should be possible as well. I suppose it is a bit easier to go with VirtualBox though but it is a matter of personal preference.
Basically, you need to perform the following steps.
Create a virtual machine and install the Linux distro you need as a guest OS there.
Enable a serial port (COM1, ...) in the configuration of the virtual machine and configure it to connect to a special file on the host ("host pipe"), say /tmp/vbox_serial.
Start the guest OS and adjust its boot options: at least, add console=ttyS0,115200 or something like that to the kernel options in the boot loader menu.
On the host, start minicom, socat or whatever else to read from /tmp/vbox_serial.
That is it. Now you should get the kernel log of the guest OS pouring to your host system via /tmp/vbox_serial. If the guest system crashes then, you will get the log even if it is not saved into a file on the guest itself.
To make things easier, you may use socat on your host system rather than minicom that the author of that blog post suggests. The power of minicom is probably not needed here.
This way, you can use socat and tee to save the log to guest.log file while still outputting it to the console:
socat /tmp/vbox_serial - | tee guest.log
If there was a kernel oops or panic, the backtrace in the log usually helps to find out what
has gone wrong.
Detecting Deadlocks
If you have obtained the full log via a serial connection or some other means and still there is nothing suspicious there and you suspect there has been a deadlock in the kernel,
lockdep tool may help. It is included into the kernel (but you may need to rebuild the kernel with CONFIG_LOCKDEP_SUPPORT=y).
Lockdep detects the potential deadlocks and outputs the results to the kernel log. This presentation may help you analyse its output.
Tracing Facilities
If you need tracing of some events in the kernel to debug your system, there are some tools that could be handy.
Kprobes - a kind of breakpoints you can set in almost arbitrary place in the kernel. Can be used to trace function calls among other things, with a moderate performance impact.
SystemTap - a powerful system to analyze what is going on in the kernel. Part of it is based on Kprobes.
Ftrace - a tracing system included into the kernel, incurs less overhead than Kprobes if that matters.
when using the LARGEADDRESSAWARE flag, can my 32bit program access 4GB of address space, or only 3GB of address space?
why?
A 32 bit process with LARGEADDRESSAWARE set can address 4GB on 64 bit Windows. It can do so because that's how the wonderful engineers at Microsoft implemented it.
It's documented here.
maybe the anwser is there
A 32 bit process will access 2GB RAM, with the LARGEADDRESSAWARE flag, it reaches the 4GB
http://blogs.msdn.com/b/hiltonl/archive/2007/04/13/the-3gb-not-4gb-ram-problem.aspx
http://www.oldunreal.com/cgi-bin/yabb2/YaBB.pl?num=1200330824
In most OSes your 32-bit space is broken up into parts that you're program(user-code) can allocate and use, and sections that the kernel owns. Unless you're writing your own OS/kernel let the system APIs(such as malloc/free, new/delete in C/C++) or the the underlying management in python, java manage the memory allocation for you.
However, if you're getting 'out of memory' errors start to consider
Do I have a leak somewhere? You're not free'ing every pointer you're malloc'ing
Wonderous tools such as valgrind can help find those.
Do I need to redesign my program to use less memory? Are you doing things like saving every line of data you read out of a huge file in an array in python or java. Look for stuff you can throw away
If a Windows application has the IMAGE_FILE_LARGE_ADDRESS_AWARE set in the image header (via the /LARGEADDRESSAWARE compiler flag), this is typically to allow a 32-bit application to use more than 2GB of memory (only makes sense if the 32-bit Operating System has set the 3GB switch in boot.ini). See MSDN article /3GB for more info.
My questions is, what happens if you run this application on a system that does NOT have the 3GB switch set. Is it simply ignored? Or will the app try and use a 3GB heap and get out-of-memory errors because the userspace only has 2GB available?
I keep hearing anecdotally that the LARGEADDRESSAWARE switch is ignored for 2GB userspace systems but cannot find any official Microsoft documentation on this.
Thanks in advance.
Basically the IMAGE_FILE_LARGE_ADDRESS_AWARE tells the system, "I know that addresses with the high bit set are not negative, and can handle them".
If the system is prepared to provide user mode addresses above 2GB, then it will. If the system is not prepared to give those addresses (ie., a 32-bit Windows OS without the /3GB setting), the process can't get those addresses anyway - but no harm done.
Also note that if an image has the IMAGE_FILE_LARGE_ADDRESS_AWARE bit set it will get access to address space above 2GB on Win64 systems, which do not support (or need) the /3GB switch. A 32-bit application will get an address space of something close to 4GB and a 64-bit application will get a huge address space - 7TB to 8TB depending on the platform (64-bit builds set the bit by default).
http://msdn.microsoft.com/en-us/library/aa366778.aspx#memory_limits
The switch is ignored, if you can call it that. For once, Microsoft actually managed to come up with a descriptive name.
The flag means exactly what it says. This image file is aware that large addresses exist.
That is, it won't crash, if it is given a pointer above the 2GB boundary.
And that's all. The OS doesn't have to treat the process special in any way. It simply indicates that if the OS is able to provide more than 2GB memory, this process can handle it without crashing.
You can make a simple hello world application which never uses more than 1.5MB, and still has this flag set. It doesn't mean "I want to use 3GB of memory", it means "When I request memory, I don't care if it's above or below the 2GB boundary".
So since the flag doesn't require the OS to do anything special, the OS simply won't do anything special if there is nothing special it can do.