LinuxQuestions.org
Latest LQ Deal: Latest LQ Deals
Home Forums Tutorials Articles Register
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Software > Linux - Kernel
User Name
Password
Linux - Kernel This forum is for all discussion relating to the Linux kernel.

Notices


Reply
  Search this Thread
Old 11-18-2020, 04:15 AM   #1
/dev/dog
Member
 
Registered: Nov 2014
Location: US
Distribution: Debian
Posts: 39

Rep: Reputation: 0
Post Boot Parameter: maxcpus


LinuxWeeklyNews Article: A realtime developer's checklist

The article summarizes some things that concern realtime developers that non-realtime devs may not be aware of. At one point, the article mentions that a boot parameter maxcpus can be used to limit which cpus the kernel is aware of. It gave an example that a possible use case is bare metal applications running on them.

My question is: How does that affect memory usage and other system resources? I thought the kernel is meant to manage applications sharing system resources. How does a bare-metal application use any system resources without cooperating with the kernel?

A possibility that comes to mind is that certain resources are also inaccessible to the kernel, and the kernel treats the connection between those resources and the bare-metal app as a peripheral. I am not sure, hopefully someone can explain some other use cases and how a system manages resource sharing and communication.

Below is a relevant snippet from the article, since the article is still in subscriber-only mode.

Quote:
CPU affinity is another important element in a realtime system. It might be critical to isolate code onto some CPUs. Ogness gave an example of an eight-CPU system divided into six CPUs for non-realtime applications and two for realtime. In Linux, CPU affinity is defined for each task and takes the form of a bitmask with one bit set for each allowed CPU. In addition to user-space tasks, interrupts and kernel threads can also have their affinity set. This is important, as they may interfere with realtime code. Ogness noted that the internal architecture of a processor will influence the realtime configuration. If two CPUs are sharing L2 caches, then they should be both realtime, as cache sharing between realtime and non-realtime applications may have an effect on realtime latency.

The tool to set and query affinities is taskset, which can either start a task or modify an existing one. taskset also applies to threads. If run without a new mask, it will show what the current mask is. As with priorities, an associated system call exists: sched_setaffinity(). Ogness noted that it requires that _GNU_SOURCE be defined, since the sched_setaffinity() wrapper is a GNU C library (glibc) extension and not part of the POSIX API.

It is also possible to influence CPU affinity in a deeper way using the maxcpus and isolcpus boot parameters. maxcpus limits the number of CPUs the kernel can see. If set to four in an eight-CPU system, it means that the kernel will see only four processors and the other four CPUs can be used differently, such as by a bare-metal realtime application. On the other hand, isolcpus indicates to the kernel that it should not put kernel threads on the indicated processors. When using isolcpus, Linux is aware of all of the CPUs and can use the isolated CPUs when threads are explicitly set to run on them.

Last edited by /dev/dog; 11-18-2020 at 04:20 AM. Reason: inline code font
 
Old 11-18-2020, 04:35 AM   #2
syg00
LQ Veteran
 
Registered: Aug 2003
Location: Australia
Distribution: Lots ...
Posts: 21,147

Rep: Reputation: 4124Reputation: 4124Reputation: 4124Reputation: 4124Reputation: 4124Reputation: 4124Reputation: 4124Reputation: 4124Reputation: 4124Reputation: 4124Reputation: 4124
The only "bare-metal realtime application" I can think of off the top of my head are things like bootloaders, memtest and hypervisors. How any of them would know to avoid processors that Linux considered it owned is beyond my ken.

I know nought of the realtime and/or embedded dev community.
 
1 members found this post helpful.
  


Reply

Tags
boot parameters, cpuaffinity, realtime



Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
shell getopts: opt w/ optional parameter is taking next opt as its parameter! GrapefruiTgirl Programming 22 10-27-2010 06:00 AM
linux bash - how to use a dynamic parameter in shell parameter expansion expression nickleus Linux - General 2 08-21-2006 04:54 AM
Boot parameter - ether= Ironica Linux - Networking 0 06-02-2004 02:25 AM
HDD boot parameter file.. Whats its name? AutOPSY Linux - General 2 03-26-2004 12:40 PM
bad dmesg output when using ide-scsi boot parameter for IDE CD/DVD-ROM Locura Slackware 7 09-29-2003 02:36 AM

LinuxQuestions.org > Forums > Linux Forums > Linux - Software > Linux - Kernel

All times are GMT -5. The time now is 10:55 AM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Open Source Consulting | Domain Registration