Function report

Linux Kernel

v5.5.9

Brick Technologies Co., Ltd

Source Code:arch\x86\kernel\cpu\mce\amd.c Create Date:2022-07-28 08:03:41
Last Modify:2020-03-12 14:18:49 Copyright©Brick
home page Tree
Annotation kernel can get tool activityDownload SCCTChinese

Name:allocate_threshold_blocks

Proto:static int allocate_threshold_blocks(unsigned int cpu, struct threshold_bank *tb, unsigned int bank, unsigned int block, unsigned int address)

Type:int

Parameter:

TypeParameterName
unsigned intcpu
struct threshold_bank *tb
unsigned intbank
unsigned intblock
unsigned intaddress
1206  struct threshold_block * b = NULL
1210  If bank >= per_cpu(mce_num_banks, cpu) || block >= NR_BLOCKS Then Return 0
1213  If rdmsr_safe_on_cpu(cpu, address, & low, & high) Then Return 0
1216  If Not (high & MASK_VALID_HI) Then
1217  If block Then Go to recurse
1219  Else Return 0
1223  If Not (high & MASK_CNTP_HI) || high & MASK_LOCKED_HI Then Go to recurse
1227  b = kzalloc - allocate memory. The memory is set to zero.*@size: how many bytes of memory are required.*@flags: the type of memory to allocate (see kmalloc).
1228  If Not b Then Return -ENOMEM
1231  Number within bank = block
1232  MCA bank the block belongs to = bank
1233  CPU which controls MCA bank = cpu
1234  MSR address for the block = address
1235  Enable/Disable APIC interrupt = 0
1236  Bank can generate an interrupt. = MSR4_MISC0
1237  * Value upon which threshold * interrupt is generated. = THRESHOLD_MAX
1239  If Bank can generate an interrupt. Then
1240  use default_groups instead [2] = attr
1241  Enable/Disable APIC interrupt = 1
1242  Else
1243  use default_groups instead [2] = NULL
1246  Initialization list head
1248  If blocks Then list_add - add a new entry*@new: new entry to be added*@head: list head to add it after* Insert a new entry after the specified head.* This is good for implementing stacks.
1250  Else blocks = b
1253  err = kobject_init_and_add() - Initialize a kobject structure and add it to* the kobject hierarchy.*@kobj: pointer to the kobject to initialize*@ktype: pointer to the ktype for this kobject.*@parent: pointer to the parent of this kobject.
1254  If err Then Go to out_free
1256  recurse :
1257  address = get_block_address(address, low, high, bank, ++block, cpu)
1258  If Not address Then Return 0
1261  err = allocate_threshold_blocks(cpu, tb, bank, block, address)
1262  If err Then Go to out_free
1265  If b Then kobject_uevent - notify userspace by sending an uevent*@kobj: struct kobject that the action is happening to*@action: action that is happening* Returns 0 if kobject_uevent() is completed with success or the* corresponding error when it fails.
1268  Return err
1270  out_free :
1271  If b Then
1272  kobject_put() - Decrement refcount for object.*@kobj: object.* Decrement the refcount, and if 0, call kobject_cleanup().
1273  deletes entry from list
1274  free previously allocated memory
1276  Return err
Caller
NameDescribe
allocate_threshold_blocks
threshold_create_bank