* Re: [Qemu-arm] [Qemu-devel] [RFC PATCH 4/6] hw/arm/virt-acpi-build: distinguish possible and present cpus
From: Igor Mammedov @ 2018-07-23 13:28 UTC (permalink / raw)
To: Andrew Jones; +Cc: peter.maydell, qemu-arm, qemu-devel, eric.auger
In-Reply-To: <20180704124923.32483-5-drjones@redhat.com>
On Wed, 4 Jul 2018 14:49:21 +0200
Andrew Jones <drjones@redhat.com> wrote:
> When building ACPI tables regarding CPUs we should always build
> them for the number of possible CPUs, not the number of present
> CPUs. We then ensure only the present CPUs are enabled.
>
> Signed-off-by: Andrew Jones <drjones@redhat.com>
> ---
> hw/arm/virt-acpi-build.c | 20 +++++++++++++++-----
> 1 file changed, 15 insertions(+), 5 deletions(-)
>
> diff --git a/hw/arm/virt-acpi-build.c b/hw/arm/virt-acpi-build.c
> index 6ea47e258832..1d1fc824da6f 100644
> --- a/hw/arm/virt-acpi-build.c
> +++ b/hw/arm/virt-acpi-build.c
> @@ -49,14 +49,22 @@
> #define ARM_SPI_BASE 32
> #define ACPI_POWER_BUTTON_DEVICE "PWRB"
>
> -static void acpi_dsdt_add_cpus(Aml *scope, int smp_cpus)
> +static int possible_cpus(VirtMachineState *vms)
> +{
> + return MACHINE_GET_CLASS(vms)->possible_cpu_arch_ids(MACHINE(vms))->len;
> +}
> +
> +static void acpi_dsdt_add_cpus(Aml *scope, int possible, int present)
> {
> uint16_t i;
>
> - for (i = 0; i < smp_cpus; i++) {
> + for (i = 0; i < possible; i++) {
> Aml *dev = aml_device("C%.03X", i);
> aml_append(dev, aml_name_decl("_HID", aml_string("ACPI0007")));
> aml_append(dev, aml_name_decl("_UID", aml_int(i)));
> + if (i >= present) {
acpi_dsdt_add_cpus(Aml *scope, const CPUArchIdList *possible_cpus = mc->possible_cpu_arch_ids(machine)) {
for (i = 0; i < possible_cpus->len; i++) {
...
if (possible_cpus->cpus[i].cpu == NULL)
aml_append(dev, aml_name_decl("_STA", aml_int(0)));
}
}
would be better to be consistent with x86 variant (well I prefer using a single source for CPU enumeration whenever possible) and drop helper above.
> + aml_append(dev, aml_name_decl("_STA", aml_int(0)));
> + }
> aml_append(scope, dev);
> }
> }
> @@ -650,7 +658,7 @@ build_madt(GArray *table_data, BIOSLinker *linker, VirtMachineState *vms)
> gicd->base_address = cpu_to_le64(memmap[VIRT_GIC_DIST].base);
> gicd->version = vms->gic_version;
>
> - for (i = 0; i < vms->smp_cpus; i++) {
> + for (i = 0; i < possible_cpus(vms); i++) {
ditto
> AcpiMadtGenericCpuInterface *gicc = acpi_data_push(table_data,
> sizeof(*gicc));
> ARMCPU *armcpu = ARM_CPU(qemu_get_cpu(i));
> @@ -663,7 +671,9 @@ build_madt(GArray *table_data, BIOSLinker *linker, VirtMachineState *vms)
> gicc->cpu_interface_number = cpu_to_le32(i);
> gicc->arm_mpidr = cpu_to_le64(armcpu->mp_affinity);
> gicc->uid = cpu_to_le32(i);
> - gicc->flags = cpu_to_le32(ACPI_MADT_GICC_ENABLED);
> + if (i < vms->smp_cpus) {
> + gicc->flags = cpu_to_le32(ACPI_MADT_GICC_ENABLED);
> + }
>
> if (arm_feature(&armcpu->env, ARM_FEATURE_PMU)) {
> gicc->performance_interrupt = cpu_to_le32(PPI(VIRTUAL_PMU_IRQ));
> @@ -763,7 +773,7 @@ build_dsdt(GArray *table_data, BIOSLinker *linker, VirtMachineState *vms)
> * the RTC ACPI device at all when using UEFI.
> */
> scope = aml_scope("\\_SB");
> - acpi_dsdt_add_cpus(scope, vms->smp_cpus);
> + acpi_dsdt_add_cpus(scope, possible_cpus(vms), vms->smp_cpus);
> acpi_dsdt_add_uart(scope, &memmap[VIRT_UART],
> (irqmap[VIRT_UART] + ARM_SPI_BASE));
> acpi_dsdt_add_flash(scope, &memmap[VIRT_FLASH]);
^ permalink raw reply
* Re: [f2fs-dev] [PATCH v2] f2fs: fix to do sanity check with inline flags
From: Chao Yu @ 2018-07-23 13:28 UTC (permalink / raw)
To: Jaegeuk Kim; +Cc: linux-kernel, linux-f2fs-devel
In-Reply-To: <20180723132728.GB23437@jaegeuk-macbookpro.roam.corp.google.com>
On 2018/7/23 21:27, Jaegeuk Kim wrote:
> On 07/23, Chao Yu wrote:
>> On 2018/7/23 21:17, Jaegeuk Kim wrote:
>>> On 07/15, Chao Yu wrote:
>>>> Hi Jaegeuk,
>>>>
>>>> Could you try this v2 to see whether it can solve the error injection problem?
>>>
>>> That doesn't work still.
>>
>> Any dmesg there?
>
> Just hit the below inline_data case and failed to mount the disk.
Is the stack printed in orphan recovery flow?
Thanks,
>
>>
>> Thanks,
>>
>>>
>>> Thanks,
>>>
>>>>
>>>> Thanks,
>>>>
>>>> On 2018/6/29 0:19, Chao Yu wrote:
>>>>> From: Chao Yu <yuchao0@huawei.com>
>>>>>
>>>>> https://bugzilla.kernel.org/show_bug.cgi?id=200221
>>>>>
>>>>> - Overview
>>>>> BUG() in clear_inode() when mounting and un-mounting a corrupted f2fs image
>>>>>
>>>>> - Reproduce
>>>>>
>>>>> - Kernel message
>>>>> [ 538.601448] F2FS-fs (loop0): Invalid segment/section count (31, 24 x 1376257)
>>>>> [ 538.601458] F2FS-fs (loop0): Can't find valid F2FS filesystem in 2th superblock
>>>>> [ 538.724091] F2FS-fs (loop0): Try to recover 2th superblock, ret: 0
>>>>> [ 538.724102] F2FS-fs (loop0): Mounted with checkpoint version = 2
>>>>> [ 540.970834] ------------[ cut here ]------------
>>>>> [ 540.970838] kernel BUG at fs/inode.c:512!
>>>>> [ 540.971750] invalid opcode: 0000 [#1] SMP KASAN PTI
>>>>> [ 540.972755] CPU: 1 PID: 1305 Comm: umount Not tainted 4.18.0-rc1+ #4
>>>>> [ 540.974034] Hardware name: QEMU Standard PC (i440FX + PIIX, 1996), BIOS Ubuntu-1.8.2-1ubuntu1 04/01/2014
>>>>> [ 540.982913] RIP: 0010:clear_inode+0xc0/0xd0
>>>>> [ 540.983774] Code: 8d a3 30 01 00 00 4c 89 e7 e8 1c ec f8 ff 48 8b 83 30 01 00 00 49 39 c4 75 1a 48 c7 83 a0 00 00 00 60 00 00 00 5b 41 5c 5d c3 <0f> 0b 0f 0b 0f 0b 0f 0b 0f 0b 0f 0b 0f 1f 40 00 66 66 66 66 90 55
>>>>> [ 540.987570] RSP: 0018:ffff8801e34a7b70 EFLAGS: 00010002
>>>>> [ 540.988636] RAX: 0000000000000000 RBX: ffff8801e9b744e8 RCX: ffffffffb840eb3a
>>>>> [ 540.990063] RDX: dffffc0000000000 RSI: 0000000000000004 RDI: ffff8801e9b746b8
>>>>> [ 540.991499] RBP: ffff8801e34a7b80 R08: ffffed003d36e8ce R09: ffffed003d36e8ce
>>>>> [ 540.992923] R10: 0000000000000001 R11: ffffed003d36e8cd R12: ffff8801e9b74668
>>>>> [ 540.994360] R13: ffff8801e9b74760 R14: ffff8801e9b74528 R15: ffff8801e9b74530
>>>>> [ 540.995786] FS: 00007f4662bdf840(0000) GS:ffff8801f6f00000(0000) knlGS:0000000000000000
>>>>> [ 540.997403] CS: 0010 DS: 0000 ES: 0000 CR0: 0000000080050033
>>>>> [ 540.998571] CR2: 000000000175c568 CR3: 00000001dcfe6000 CR4: 00000000000006e0
>>>>> [ 541.000015] Call Trace:
>>>>> [ 541.000554] f2fs_evict_inode+0x253/0x630
>>>>> [ 541.001381] evict+0x16f/0x290
>>>>> [ 541.002015] iput+0x280/0x300
>>>>> [ 541.002654] dentry_unlink_inode+0x165/0x1e0
>>>>> [ 541.003528] __dentry_kill+0x16a/0x260
>>>>> [ 541.004300] dentry_kill+0x70/0x250
>>>>> [ 541.005018] dput+0x154/0x1d0
>>>>> [ 541.005635] do_one_tree+0x34/0x40
>>>>> [ 541.006354] shrink_dcache_for_umount+0x3f/0xa0
>>>>> [ 541.007285] generic_shutdown_super+0x43/0x1c0
>>>>> [ 541.008192] kill_block_super+0x52/0x80
>>>>> [ 541.008978] kill_f2fs_super+0x62/0x70
>>>>> [ 541.009750] deactivate_locked_super+0x6f/0xa0
>>>>> [ 541.010664] deactivate_super+0x5e/0x80
>>>>> [ 541.011450] cleanup_mnt+0x61/0xa0
>>>>> [ 541.012151] __cleanup_mnt+0x12/0x20
>>>>> [ 541.012893] task_work_run+0xc8/0xf0
>>>>> [ 541.013635] exit_to_usermode_loop+0x125/0x130
>>>>> [ 541.014555] do_syscall_64+0x138/0x170
>>>>> [ 541.015340] entry_SYSCALL_64_after_hwframe+0x44/0xa9
>>>>> [ 541.016375] RIP: 0033:0x7f46624bf487
>>>>> [ 541.017104] Code: 83 c8 ff c3 66 2e 0f 1f 84 00 00 00 00 00 0f 1f 44 00 00 31 f6 e9 09 00 00 00 66 0f 1f 84 00 00 00 00 00 b8 a6 00 00 00 0f 05 <48> 3d 01 f0 ff ff 73 01 c3 48 8b 0d e1 c9 2b 00 f7 d8 64 89 01 48
>>>>> [ 541.020923] RSP: 002b:00007fff5e12e9a8 EFLAGS: 00000246 ORIG_RAX: 00000000000000a6
>>>>> [ 541.022452] RAX: 0000000000000000 RBX: 0000000001753030 RCX: 00007f46624bf487
>>>>> [ 541.023885] RDX: 0000000000000001 RSI: 0000000000000000 RDI: 000000000175a1e0
>>>>> [ 541.025318] RBP: 000000000175a1e0 R08: 0000000000000000 R09: 0000000000000014
>>>>> [ 541.026755] R10: 00000000000006b2 R11: 0000000000000246 R12: 00007f46629c883c
>>>>> [ 541.028186] R13: 0000000000000000 R14: 0000000001753210 R15: 00007fff5e12ec30
>>>>> [ 541.029626] Modules linked in: snd_hda_codec_generic snd_hda_intel snd_hda_codec snd_hwdep snd_hda_core snd_pcm snd_timer snd mac_hid i2c_piix4 soundcore ib_iser rdma_cm iw_cm ib_cm ib_core iscsi_tcp libiscsi_tcp libiscsi scsi_transport_iscsi raid10 raid456 async_raid6_recov async_memcpy async_pq async_xor async_tx raid1 raid0 multipath linear 8139too crct10dif_pclmul crc32_pclmul qxl drm_kms_helper syscopyarea aesni_intel sysfillrect sysimgblt fb_sys_fops ttm drm aes_x86_64 crypto_simd cryptd 8139cp glue_helper mii pata_acpi floppy
>>>>> [ 541.039445] ---[ end trace 4ce02f25ff7d3df5 ]---
>>>>> [ 541.040392] RIP: 0010:clear_inode+0xc0/0xd0
>>>>> [ 541.041240] Code: 8d a3 30 01 00 00 4c 89 e7 e8 1c ec f8 ff 48 8b 83 30 01 00 00 49 39 c4 75 1a 48 c7 83 a0 00 00 00 60 00 00 00 5b 41 5c 5d c3 <0f> 0b 0f 0b 0f 0b 0f 0b 0f 0b 0f 0b 0f 1f 40 00 66 66 66 66 90 55
>>>>> [ 541.045042] RSP: 0018:ffff8801e34a7b70 EFLAGS: 00010002
>>>>> [ 541.046099] RAX: 0000000000000000 RBX: ffff8801e9b744e8 RCX: ffffffffb840eb3a
>>>>> [ 541.047537] RDX: dffffc0000000000 RSI: 0000000000000004 RDI: ffff8801e9b746b8
>>>>> [ 541.048965] RBP: ffff8801e34a7b80 R08: ffffed003d36e8ce R09: ffffed003d36e8ce
>>>>> [ 541.050402] R10: 0000000000000001 R11: ffffed003d36e8cd R12: ffff8801e9b74668
>>>>> [ 541.051832] R13: ffff8801e9b74760 R14: ffff8801e9b74528 R15: ffff8801e9b74530
>>>>> [ 541.053263] FS: 00007f4662bdf840(0000) GS:ffff8801f6f00000(0000) knlGS:0000000000000000
>>>>> [ 541.054891] CS: 0010 DS: 0000 ES: 0000 CR0: 0000000080050033
>>>>> [ 541.056039] CR2: 000000000175c568 CR3: 00000001dcfe6000 CR4: 00000000000006e0
>>>>> [ 541.058506] ==================================================================
>>>>> [ 541.059991] BUG: KASAN: stack-out-of-bounds in update_stack_state+0x38c/0x3e0
>>>>> [ 541.061513] Read of size 8 at addr ffff8801e34a7970 by task umount/1305
>>>>>
>>>>> [ 541.063302] CPU: 1 PID: 1305 Comm: umount Tainted: G D 4.18.0-rc1+ #4
>>>>> [ 541.064838] Hardware name: QEMU Standard PC (i440FX + PIIX, 1996), BIOS Ubuntu-1.8.2-1ubuntu1 04/01/2014
>>>>> [ 541.066778] Call Trace:
>>>>> [ 541.067294] dump_stack+0x7b/0xb5
>>>>> [ 541.067986] print_address_description+0x70/0x290
>>>>> [ 541.068941] kasan_report+0x291/0x390
>>>>> [ 541.069692] ? update_stack_state+0x38c/0x3e0
>>>>> [ 541.070598] __asan_load8+0x54/0x90
>>>>> [ 541.071315] update_stack_state+0x38c/0x3e0
>>>>> [ 541.072172] ? __read_once_size_nocheck.constprop.7+0x20/0x20
>>>>> [ 541.073340] ? vprintk_func+0x27/0x60
>>>>> [ 541.074096] ? printk+0xa3/0xd3
>>>>> [ 541.074762] ? __save_stack_trace+0x5e/0x100
>>>>> [ 541.075634] unwind_next_frame.part.5+0x18e/0x490
>>>>> [ 541.076594] ? unwind_dump+0x290/0x290
>>>>> [ 541.077368] ? __show_regs+0x2c4/0x330
>>>>> [ 541.078142] __unwind_start+0x106/0x190
>>>>> [ 541.085422] __save_stack_trace+0x5e/0x100
>>>>> [ 541.086268] ? __save_stack_trace+0x5e/0x100
>>>>> [ 541.087161] ? unlink_anon_vmas+0xba/0x2c0
>>>>> [ 541.087997] save_stack_trace+0x1f/0x30
>>>>> [ 541.088782] save_stack+0x46/0xd0
>>>>> [ 541.089475] ? __alloc_pages_slowpath+0x1420/0x1420
>>>>> [ 541.090477] ? flush_tlb_mm_range+0x15e/0x220
>>>>> [ 541.091364] ? __dec_node_state+0x24/0xb0
>>>>> [ 541.092180] ? lock_page_memcg+0x85/0xf0
>>>>> [ 541.092979] ? unlock_page_memcg+0x16/0x80
>>>>> [ 541.093812] ? page_remove_rmap+0x198/0x520
>>>>> [ 541.094674] ? mark_page_accessed+0x133/0x200
>>>>> [ 541.095559] ? _cond_resched+0x1a/0x50
>>>>> [ 541.096326] ? unmap_page_range+0xcd4/0xe50
>>>>> [ 541.097179] ? rb_next+0x58/0x80
>>>>> [ 541.097845] ? rb_next+0x58/0x80
>>>>> [ 541.098518] __kasan_slab_free+0x13c/0x1a0
>>>>> [ 541.099352] ? unlink_anon_vmas+0xba/0x2c0
>>>>> [ 541.100184] kasan_slab_free+0xe/0x10
>>>>> [ 541.100934] kmem_cache_free+0x89/0x1e0
>>>>> [ 541.101724] unlink_anon_vmas+0xba/0x2c0
>>>>> [ 541.102534] free_pgtables+0x101/0x1b0
>>>>> [ 541.103299] exit_mmap+0x146/0x2a0
>>>>> [ 541.103996] ? __ia32_sys_munmap+0x50/0x50
>>>>> [ 541.104829] ? kasan_check_read+0x11/0x20
>>>>> [ 541.105649] ? mm_update_next_owner+0x322/0x380
>>>>> [ 541.106578] mmput+0x8b/0x1d0
>>>>> [ 541.107191] do_exit+0x43a/0x1390
>>>>> [ 541.107876] ? mm_update_next_owner+0x380/0x380
>>>>> [ 541.108791] ? deactivate_super+0x5e/0x80
>>>>> [ 541.109610] ? cleanup_mnt+0x61/0xa0
>>>>> [ 541.110351] ? __cleanup_mnt+0x12/0x20
>>>>> [ 541.111115] ? task_work_run+0xc8/0xf0
>>>>> [ 541.111879] ? exit_to_usermode_loop+0x125/0x130
>>>>> [ 541.112817] rewind_stack_do_exit+0x17/0x20
>>>>> [ 541.113666] RIP: 0033:0x7f46624bf487
>>>>> [ 541.114404] Code: Bad RIP value.
>>>>> [ 541.115094] RSP: 002b:00007fff5e12e9a8 EFLAGS: 00000246 ORIG_RAX: 00000000000000a6
>>>>> [ 541.116605] RAX: 0000000000000000 RBX: 0000000001753030 RCX: 00007f46624bf487
>>>>> [ 541.118034] RDX: 0000000000000001 RSI: 0000000000000000 RDI: 000000000175a1e0
>>>>> [ 541.119472] RBP: 000000000175a1e0 R08: 0000000000000000 R09: 0000000000000014
>>>>> [ 541.120890] R10: 00000000000006b2 R11: 0000000000000246 R12: 00007f46629c883c
>>>>> [ 541.122321] R13: 0000000000000000 R14: 0000000001753210 R15: 00007fff5e12ec30
>>>>>
>>>>> [ 541.124061] The buggy address belongs to the page:
>>>>> [ 541.125042] page:ffffea00078d29c0 count:0 mapcount:0 mapping:0000000000000000 index:0x0
>>>>> [ 541.126651] flags: 0x2ffff0000000000()
>>>>> [ 541.127418] raw: 02ffff0000000000 dead000000000100 dead000000000200 0000000000000000
>>>>> [ 541.128963] raw: 0000000000000000 0000000000000000 00000000ffffffff 0000000000000000
>>>>> [ 541.130516] page dumped because: kasan: bad access detected
>>>>>
>>>>> [ 541.131954] Memory state around the buggy address:
>>>>> [ 541.132924] ffff8801e34a7800: 00 f1 f1 f1 f1 00 f4 f4 f4 f3 f3 f3 f3 00 00 00
>>>>> [ 541.134378] ffff8801e34a7880: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
>>>>> [ 541.135814] >ffff8801e34a7900: 00 00 00 00 00 00 00 00 00 00 00 00 00 f1 f1 f1
>>>>> [ 541.137253] ^
>>>>> [ 541.138637] ffff8801e34a7980: f1 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
>>>>> [ 541.140075] ffff8801e34a7a00: 00 00 00 00 00 00 00 00 f3 00 00 00 00 00 00 00
>>>>> [ 541.141509] ==================================================================
>>>>>
>>>>> - Location
>>>>> https://elixir.bootlin.com/linux/v4.18-rc1/source/fs/inode.c#L512
>>>>> BUG_ON(inode->i_data.nrpages);
>>>>>
>>>>> The root cause is root directory inode is corrupted, it has both
>>>>> inline_data and inline_dentry flag, and its nlink is zero, so in
>>>>> ->evict(), after dropping all page cache, it grabs page #0 for inline
>>>>> data truncation, result in panic in later clear_inode() where we will
>>>>> check inode->i_data.nrpages value.
>>>>>
>>>>> This patch adds inline flags check in sanity_check_inode, in addition,
>>>>> do sanity check with root inode's nlink.
>>>>>
>>>>> Reported-by Wen Xu <wen.xu@gatech.edu>
>>>>> Signed-off-by: Chao Yu <yuchao0@huawei.com>
>>>>> ---
>>>>> v2:
>>>>> - fix wrong condition of inode type.
>>>>> fs/f2fs/inode.c | 20 ++++++++++++++++++++
>>>>> fs/f2fs/super.c | 3 ++-
>>>>> 2 files changed, 22 insertions(+), 1 deletion(-)
>>>>>
>>>>> diff --git a/fs/f2fs/inode.c b/fs/f2fs/inode.c
>>>>> index 24d9c93941d4..cd183c135e3d 100644
>>>>> --- a/fs/f2fs/inode.c
>>>>> +++ b/fs/f2fs/inode.c
>>>>> @@ -229,6 +229,26 @@ static bool sanity_check_inode(struct inode *inode)
>>>>> return false;
>>>>> }
>>>>> }
>>>>> +
>>>>> + if (f2fs_has_inline_data(inode) &&
>>>>> + (!S_ISREG(inode->i_mode) && !S_ISLNK(inode->i_mode))) {
>>>>> + set_sbi_flag(sbi, SBI_NEED_FSCK);
>>>>> + f2fs_msg(sbi->sb, KERN_WARNING,
>>>>> + "%s: inode (ino=%lx, mode=%u) should not have "
>>>>> + "inline_data, run fsck to fix",
>>>>> + __func__, inode->i_ino, inode->i_mode);
>>>>> + return false;
>>>>> + }
>>>>> +
>>>>> + if (f2fs_has_inline_dentry(inode) && !S_ISDIR(inode->i_mode)) {
>>>>> + set_sbi_flag(sbi, SBI_NEED_FSCK);
>>>>> + f2fs_msg(sbi->sb, KERN_WARNING,
>>>>> + "%s: inode (ino=%lx, mode=%u) should not have "
>>>>> + "inline_dentry, run fsck to fix",
>>>>> + __func__, inode->i_ino, inode->i_mode);
>>>>> + return false;
>>>>> + }
>>>>> +
>>>>> return true;
>>>>> }
>>>>>
>>>>> diff --git a/fs/f2fs/super.c b/fs/f2fs/super.c
>>>>> index a64fee9137dc..a61dd0cf6cc5 100644
>>>>> --- a/fs/f2fs/super.c
>>>>> +++ b/fs/f2fs/super.c
>>>>> @@ -2933,7 +2933,8 @@ static int f2fs_fill_super(struct super_block *sb, void *data, int silent)
>>>>> err = PTR_ERR(root);
>>>>> goto free_stats;
>>>>> }
>>>>> - if (!S_ISDIR(root->i_mode) || !root->i_blocks || !root->i_size) {
>>>>> + if (!S_ISDIR(root->i_mode) || !root->i_blocks ||
>>>>> + !root->i_size || !root->i_nlink) {
>>>>> iput(root);
>>>>> err = -EINVAL;
>>>>> goto free_stats;
>>>>>
^ permalink raw reply
* Re: [Qemu-devel] [RFC PATCH 4/6] hw/arm/virt-acpi-build: distinguish possible and present cpus
From: Igor Mammedov @ 2018-07-23 13:28 UTC (permalink / raw)
To: Andrew Jones; +Cc: qemu-devel, qemu-arm, wei, peter.maydell, eric.auger
In-Reply-To: <20180704124923.32483-5-drjones@redhat.com>
On Wed, 4 Jul 2018 14:49:21 +0200
Andrew Jones <drjones@redhat.com> wrote:
> When building ACPI tables regarding CPUs we should always build
> them for the number of possible CPUs, not the number of present
> CPUs. We then ensure only the present CPUs are enabled.
>
> Signed-off-by: Andrew Jones <drjones@redhat.com>
> ---
> hw/arm/virt-acpi-build.c | 20 +++++++++++++++-----
> 1 file changed, 15 insertions(+), 5 deletions(-)
>
> diff --git a/hw/arm/virt-acpi-build.c b/hw/arm/virt-acpi-build.c
> index 6ea47e258832..1d1fc824da6f 100644
> --- a/hw/arm/virt-acpi-build.c
> +++ b/hw/arm/virt-acpi-build.c
> @@ -49,14 +49,22 @@
> #define ARM_SPI_BASE 32
> #define ACPI_POWER_BUTTON_DEVICE "PWRB"
>
> -static void acpi_dsdt_add_cpus(Aml *scope, int smp_cpus)
> +static int possible_cpus(VirtMachineState *vms)
> +{
> + return MACHINE_GET_CLASS(vms)->possible_cpu_arch_ids(MACHINE(vms))->len;
> +}
> +
> +static void acpi_dsdt_add_cpus(Aml *scope, int possible, int present)
> {
> uint16_t i;
>
> - for (i = 0; i < smp_cpus; i++) {
> + for (i = 0; i < possible; i++) {
> Aml *dev = aml_device("C%.03X", i);
> aml_append(dev, aml_name_decl("_HID", aml_string("ACPI0007")));
> aml_append(dev, aml_name_decl("_UID", aml_int(i)));
> + if (i >= present) {
acpi_dsdt_add_cpus(Aml *scope, const CPUArchIdList *possible_cpus = mc->possible_cpu_arch_ids(machine)) {
for (i = 0; i < possible_cpus->len; i++) {
...
if (possible_cpus->cpus[i].cpu == NULL)
aml_append(dev, aml_name_decl("_STA", aml_int(0)));
}
}
would be better to be consistent with x86 variant (well I prefer using a single source for CPU enumeration whenever possible) and drop helper above.
> + aml_append(dev, aml_name_decl("_STA", aml_int(0)));
> + }
> aml_append(scope, dev);
> }
> }
> @@ -650,7 +658,7 @@ build_madt(GArray *table_data, BIOSLinker *linker, VirtMachineState *vms)
> gicd->base_address = cpu_to_le64(memmap[VIRT_GIC_DIST].base);
> gicd->version = vms->gic_version;
>
> - for (i = 0; i < vms->smp_cpus; i++) {
> + for (i = 0; i < possible_cpus(vms); i++) {
ditto
> AcpiMadtGenericCpuInterface *gicc = acpi_data_push(table_data,
> sizeof(*gicc));
> ARMCPU *armcpu = ARM_CPU(qemu_get_cpu(i));
> @@ -663,7 +671,9 @@ build_madt(GArray *table_data, BIOSLinker *linker, VirtMachineState *vms)
> gicc->cpu_interface_number = cpu_to_le32(i);
> gicc->arm_mpidr = cpu_to_le64(armcpu->mp_affinity);
> gicc->uid = cpu_to_le32(i);
> - gicc->flags = cpu_to_le32(ACPI_MADT_GICC_ENABLED);
> + if (i < vms->smp_cpus) {
> + gicc->flags = cpu_to_le32(ACPI_MADT_GICC_ENABLED);
> + }
>
> if (arm_feature(&armcpu->env, ARM_FEATURE_PMU)) {
> gicc->performance_interrupt = cpu_to_le32(PPI(VIRTUAL_PMU_IRQ));
> @@ -763,7 +773,7 @@ build_dsdt(GArray *table_data, BIOSLinker *linker, VirtMachineState *vms)
> * the RTC ACPI device at all when using UEFI.
> */
> scope = aml_scope("\\_SB");
> - acpi_dsdt_add_cpus(scope, vms->smp_cpus);
> + acpi_dsdt_add_cpus(scope, possible_cpus(vms), vms->smp_cpus);
> acpi_dsdt_add_uart(scope, &memmap[VIRT_UART],
> (irqmap[VIRT_UART] + ARM_SPI_BASE));
> acpi_dsdt_add_flash(scope, &memmap[VIRT_FLASH]);
^ permalink raw reply
* Re: [PATCH v2 3/7] iio: tsl2772: add support for reading power settings from device tree
From: Rob Herring @ 2018-07-23 13:28 UTC (permalink / raw)
To: Jonathan Cameron
Cc: Brian Masney, Mark Rutland, Andy Gross, David Brown, linux-iio,
devicetree, linux-kernel@vger.kernel.org, linux-arm-msm,
open list:ARM/QUALCOMM SUPPORT, Jonathan Marek,
Jean-Baptiste Maneyrol, Hartmut Knaack, Lars-Peter Clausen,
Peter Meerwald, Martin Kelly, fischerdouglasc, bshah,
Craig Tatlor, drew.paterson
In-Reply-To: <20180722181748.24bc47d8@archlinux>
On Sun, Jul 22, 2018 at 11:17 AM Jonathan Cameron <jic23@kernel.org> wrote:
>
> On Sun, 22 Jul 2018 12:37:20 +0000
> Brian Masney <masneyb@onstation.org> wrote:
>
> > On Sat, Jul 21, 2018 at 06:37:16PM +0100, Jonathan Cameron wrote:
> > > On Fri, 20 Jul 2018 11:36:35 -0600
> > > Rob Herring <robh@kernel.org> wrote:
> > >
> > > > On Tue, Jul 17, 2018 at 04:41:54AM -0400, Brian Masney wrote:
> > > > > This patch adds support for optionally reading the prox_diode and
> > > > > prox_power settings from device tree. This was tested using a LG
> > > > > Nexus 5 (hammerhead) which requires a different diode than the driver
> > > > > default for the IR LED.
> > > > >
> > > > > Signed-off-by: Brian Masney <masneyb@onstation.org>
> > > > > + - amstaos,prox_diode - must be TSL2772_DIODE0, TSL2772_DIODE1, or
> > > > > + TSL2772_DIODE_BOTH.
> > > >
> > > > s/_/-/
> > > >
> > > > > + - amstaos,prox_power - must be TSL2772_100_mA, TSL2772_50_mA, TSL2772_25_mA,
> > > > > + or TSL2772_13_mA.
> > > >
> > > > I wonder if this should be common. Perhaps we should use the existing
> > > > 'led-max-microamp' as this is setting the current for an IR LED.
> > >
> > > Seems reasonable, then perhaps have two controls to turn on the diodes
> > > above.
> > >
> > > >
> > > > And while called 'power' this setting is current.
> > >
> > > Also can we have real values? I really don't like defines if they
> > > aren't absolutely necessary - particularly when there is a nice real
> > > unit to be used.
> >
> > How about these options then?
> >
> > amstaos,proximity-diode-0-enabled;
> > amstaos,proximity-diode-1-enabled;
> > led-max-microamp = <100000>;
>
> Works for me. Rob?
I think we're bikeshedding, but I'd prefer a single property though
perhaps as a list (0, 1, or <0 1>) or mask. A list would be similar to
the "led-sources" property format.
Rob
^ permalink raw reply
* Re: [PATCH v2 1/2] powerpc/pseries: Avoid blocking rtas polling handling multiple PRRN events
From: Michael Ellerman @ 2018-07-23 13:27 UTC (permalink / raw)
To: John Allen, linuxppc-dev, nfont; +Cc: John Allen
In-Reply-To: <20180717194048.3057-2-jallen@linux.ibm.com>
Hi John,
I'm a bit puzzled by this one.
John Allen <jallen@linux.ibm.com> writes:
> When a PRRN event is being handled and another PRRN event comes in, the
> second event will block rtas polling waiting on the first to complete,
> preventing any further rtas events from being handled. This can be
> especially problematic in case that PRRN events are continuously being
> queued in which case rtas polling gets indefinitely blocked completely.
>
> This patch introduces a mutex that prevents any subsequent PRRN events from
> running while there is a prrn event being handled, allowing rtas polling to
> continue normally.
>
> Signed-off-by: John Allen <jallen@linux.ibm.com>
> ---
> v2:
> -Unlock prrn_lock when PRRN operations are complete, not after handler is
> scheduled.
> -Remove call to flush_work, the previous broken method of serializing
> PRRN events.
> ---
> arch/powerpc/kernel/rtasd.c | 10 +++++++---
> 1 file changed, 7 insertions(+), 3 deletions(-)
>
> diff --git a/arch/powerpc/kernel/rtasd.c b/arch/powerpc/kernel/rtasd.c
> index 44d66c33d59d..845fc5aec178 100644
> --- a/arch/powerpc/kernel/rtasd.c
> +++ b/arch/powerpc/kernel/rtasd.c
> @@ -284,15 +286,17 @@ static void prrn_work_fn(struct work_struct *work)
> */
> pseries_devicetree_update(-prrn_update_scope);
> numa_update_cpu_topology(false);
> + mutex_unlock(&prrn_lock);
> }
>
> static DECLARE_WORK(prrn_work, prrn_work_fn);
>
> static void prrn_schedule_update(u32 scope)
> {
> - flush_work(&prrn_work);
This seems like it's actually the core of the change. Previously we were
basically blocking on the flush before continuing.
> - prrn_update_scope = scope;
I don't really understand the scope. With the old code we always ran the
work function once for call, now we potentially throw away the scope
value (if the try lock fails).
> - schedule_work(&prrn_work);
> + if (mutex_trylock(&prrn_lock)) {
> + prrn_update_scope = scope;
> + schedule_work(&prrn_work);
> + }
Ignoring the scope, the addition of the mutex should not actually make
any difference. If you see the doco for schedule_work() it says:
* This puts a job in the kernel-global workqueue if it was not already
* queued and leaves it in the same position on the kernel-global
* workqueue otherwise.
So the mutex basically implements that existing behaviour. But maybe the
scope is the issue? Like I said I don't really understand the scope
value.
So I guess I'm wondering if we just need to drop the flush_work() and
the rest is not required?
cheers
^ permalink raw reply
* Re: [PATCH] mmc: renesas_sdhi: Add r8a77990 support
From: Niklas Söderlund @ 2018-07-23 12:26 UTC (permalink / raw)
To: Wolfram Sang; +Cc: linux-mmc, linux-renesas-soc, Simon Horman
In-Reply-To: <20180721111449.10103-1-wsa+renesas@sang-engineering.com>
Hi Wolfram,
Thanks for your patch.
On 2018-07-21 13:14:49 +0200, Wolfram Sang wrote:
> This patch adds SDHI support for the R8A77990 SoC (R-Car E3). No driver changes
> needed for anything except HS400 which we will enable separately later.
>
> Signed-off-by: Wolfram Sang <wsa+renesas@sang-engineering.com>
Reviewed-by: Niklas S�derlund <niklas.soderlund+renesas@ragnatech.se>
> ---
>
> Note: we shouldn't enable HS400 in the DTS files yet, since we don't have the 8
> tap support. But I think we can enable basic support.
>
> Documentation/devicetree/bindings/mmc/tmio_mmc.txt | 1 +
> 1 file changed, 1 insertion(+)
>
> diff --git a/Documentation/devicetree/bindings/mmc/tmio_mmc.txt b/Documentation/devicetree/bindings/mmc/tmio_mmc.txt
> index 839f469f4525..c434200d19d5 100644
> --- a/Documentation/devicetree/bindings/mmc/tmio_mmc.txt
> +++ b/Documentation/devicetree/bindings/mmc/tmio_mmc.txt
> @@ -28,6 +28,7 @@ Required properties:
> "renesas,sdhi-r8a7796" - SDHI IP on R8A7796 SoC
> "renesas,sdhi-r8a77965" - SDHI IP on R8A77965 SoC
> "renesas,sdhi-r8a77980" - SDHI IP on R8A77980 SoC
> + "renesas,sdhi-r8a77990" - SDHI IP on R8A77990 SoC
> "renesas,sdhi-r8a77995" - SDHI IP on R8A77995 SoC
> "renesas,sdhi-shmobile" - a generic sh-mobile SDHI controller
> "renesas,rcar-gen1-sdhi" - a generic R-Car Gen1 SDHI controller
> --
> 2.11.0
>
--
Regards,
Niklas S�derlund
^ permalink raw reply
* Re: [f2fs-dev] [PATCH v2] f2fs: fix to do sanity check with inline flags
From: Jaegeuk Kim @ 2018-07-23 13:27 UTC (permalink / raw)
To: Chao Yu; +Cc: linux-kernel, linux-f2fs-devel
In-Reply-To: <0add4210-2250-55fa-7d30-4811fc0b4456@kernel.org>
On 07/23, Chao Yu wrote:
> On 2018/7/23 21:17, Jaegeuk Kim wrote:
> > On 07/15, Chao Yu wrote:
> >> Hi Jaegeuk,
> >>
> >> Could you try this v2 to see whether it can solve the error injection problem?
> >
> > That doesn't work still.
>
> Any dmesg there?
Just hit the below inline_data case and failed to mount the disk.
>
> Thanks,
>
> >
> > Thanks,
> >
> >>
> >> Thanks,
> >>
> >> On 2018/6/29 0:19, Chao Yu wrote:
> >>> From: Chao Yu <yuchao0@huawei.com>
> >>>
> >>> https://bugzilla.kernel.org/show_bug.cgi?id=200221
> >>>
> >>> - Overview
> >>> BUG() in clear_inode() when mounting and un-mounting a corrupted f2fs image
> >>>
> >>> - Reproduce
> >>>
> >>> - Kernel message
> >>> [ 538.601448] F2FS-fs (loop0): Invalid segment/section count (31, 24 x 1376257)
> >>> [ 538.601458] F2FS-fs (loop0): Can't find valid F2FS filesystem in 2th superblock
> >>> [ 538.724091] F2FS-fs (loop0): Try to recover 2th superblock, ret: 0
> >>> [ 538.724102] F2FS-fs (loop0): Mounted with checkpoint version = 2
> >>> [ 540.970834] ------------[ cut here ]------------
> >>> [ 540.970838] kernel BUG at fs/inode.c:512!
> >>> [ 540.971750] invalid opcode: 0000 [#1] SMP KASAN PTI
> >>> [ 540.972755] CPU: 1 PID: 1305 Comm: umount Not tainted 4.18.0-rc1+ #4
> >>> [ 540.974034] Hardware name: QEMU Standard PC (i440FX + PIIX, 1996), BIOS Ubuntu-1.8.2-1ubuntu1 04/01/2014
> >>> [ 540.982913] RIP: 0010:clear_inode+0xc0/0xd0
> >>> [ 540.983774] Code: 8d a3 30 01 00 00 4c 89 e7 e8 1c ec f8 ff 48 8b 83 30 01 00 00 49 39 c4 75 1a 48 c7 83 a0 00 00 00 60 00 00 00 5b 41 5c 5d c3 <0f> 0b 0f 0b 0f 0b 0f 0b 0f 0b 0f 0b 0f 1f 40 00 66 66 66 66 90 55
> >>> [ 540.987570] RSP: 0018:ffff8801e34a7b70 EFLAGS: 00010002
> >>> [ 540.988636] RAX: 0000000000000000 RBX: ffff8801e9b744e8 RCX: ffffffffb840eb3a
> >>> [ 540.990063] RDX: dffffc0000000000 RSI: 0000000000000004 RDI: ffff8801e9b746b8
> >>> [ 540.991499] RBP: ffff8801e34a7b80 R08: ffffed003d36e8ce R09: ffffed003d36e8ce
> >>> [ 540.992923] R10: 0000000000000001 R11: ffffed003d36e8cd R12: ffff8801e9b74668
> >>> [ 540.994360] R13: ffff8801e9b74760 R14: ffff8801e9b74528 R15: ffff8801e9b74530
> >>> [ 540.995786] FS: 00007f4662bdf840(0000) GS:ffff8801f6f00000(0000) knlGS:0000000000000000
> >>> [ 540.997403] CS: 0010 DS: 0000 ES: 0000 CR0: 0000000080050033
> >>> [ 540.998571] CR2: 000000000175c568 CR3: 00000001dcfe6000 CR4: 00000000000006e0
> >>> [ 541.000015] Call Trace:
> >>> [ 541.000554] f2fs_evict_inode+0x253/0x630
> >>> [ 541.001381] evict+0x16f/0x290
> >>> [ 541.002015] iput+0x280/0x300
> >>> [ 541.002654] dentry_unlink_inode+0x165/0x1e0
> >>> [ 541.003528] __dentry_kill+0x16a/0x260
> >>> [ 541.004300] dentry_kill+0x70/0x250
> >>> [ 541.005018] dput+0x154/0x1d0
> >>> [ 541.005635] do_one_tree+0x34/0x40
> >>> [ 541.006354] shrink_dcache_for_umount+0x3f/0xa0
> >>> [ 541.007285] generic_shutdown_super+0x43/0x1c0
> >>> [ 541.008192] kill_block_super+0x52/0x80
> >>> [ 541.008978] kill_f2fs_super+0x62/0x70
> >>> [ 541.009750] deactivate_locked_super+0x6f/0xa0
> >>> [ 541.010664] deactivate_super+0x5e/0x80
> >>> [ 541.011450] cleanup_mnt+0x61/0xa0
> >>> [ 541.012151] __cleanup_mnt+0x12/0x20
> >>> [ 541.012893] task_work_run+0xc8/0xf0
> >>> [ 541.013635] exit_to_usermode_loop+0x125/0x130
> >>> [ 541.014555] do_syscall_64+0x138/0x170
> >>> [ 541.015340] entry_SYSCALL_64_after_hwframe+0x44/0xa9
> >>> [ 541.016375] RIP: 0033:0x7f46624bf487
> >>> [ 541.017104] Code: 83 c8 ff c3 66 2e 0f 1f 84 00 00 00 00 00 0f 1f 44 00 00 31 f6 e9 09 00 00 00 66 0f 1f 84 00 00 00 00 00 b8 a6 00 00 00 0f 05 <48> 3d 01 f0 ff ff 73 01 c3 48 8b 0d e1 c9 2b 00 f7 d8 64 89 01 48
> >>> [ 541.020923] RSP: 002b:00007fff5e12e9a8 EFLAGS: 00000246 ORIG_RAX: 00000000000000a6
> >>> [ 541.022452] RAX: 0000000000000000 RBX: 0000000001753030 RCX: 00007f46624bf487
> >>> [ 541.023885] RDX: 0000000000000001 RSI: 0000000000000000 RDI: 000000000175a1e0
> >>> [ 541.025318] RBP: 000000000175a1e0 R08: 0000000000000000 R09: 0000000000000014
> >>> [ 541.026755] R10: 00000000000006b2 R11: 0000000000000246 R12: 00007f46629c883c
> >>> [ 541.028186] R13: 0000000000000000 R14: 0000000001753210 R15: 00007fff5e12ec30
> >>> [ 541.029626] Modules linked in: snd_hda_codec_generic snd_hda_intel snd_hda_codec snd_hwdep snd_hda_core snd_pcm snd_timer snd mac_hid i2c_piix4 soundcore ib_iser rdma_cm iw_cm ib_cm ib_core iscsi_tcp libiscsi_tcp libiscsi scsi_transport_iscsi raid10 raid456 async_raid6_recov async_memcpy async_pq async_xor async_tx raid1 raid0 multipath linear 8139too crct10dif_pclmul crc32_pclmul qxl drm_kms_helper syscopyarea aesni_intel sysfillrect sysimgblt fb_sys_fops ttm drm aes_x86_64 crypto_simd cryptd 8139cp glue_helper mii pata_acpi floppy
> >>> [ 541.039445] ---[ end trace 4ce02f25ff7d3df5 ]---
> >>> [ 541.040392] RIP: 0010:clear_inode+0xc0/0xd0
> >>> [ 541.041240] Code: 8d a3 30 01 00 00 4c 89 e7 e8 1c ec f8 ff 48 8b 83 30 01 00 00 49 39 c4 75 1a 48 c7 83 a0 00 00 00 60 00 00 00 5b 41 5c 5d c3 <0f> 0b 0f 0b 0f 0b 0f 0b 0f 0b 0f 0b 0f 1f 40 00 66 66 66 66 90 55
> >>> [ 541.045042] RSP: 0018:ffff8801e34a7b70 EFLAGS: 00010002
> >>> [ 541.046099] RAX: 0000000000000000 RBX: ffff8801e9b744e8 RCX: ffffffffb840eb3a
> >>> [ 541.047537] RDX: dffffc0000000000 RSI: 0000000000000004 RDI: ffff8801e9b746b8
> >>> [ 541.048965] RBP: ffff8801e34a7b80 R08: ffffed003d36e8ce R09: ffffed003d36e8ce
> >>> [ 541.050402] R10: 0000000000000001 R11: ffffed003d36e8cd R12: ffff8801e9b74668
> >>> [ 541.051832] R13: ffff8801e9b74760 R14: ffff8801e9b74528 R15: ffff8801e9b74530
> >>> [ 541.053263] FS: 00007f4662bdf840(0000) GS:ffff8801f6f00000(0000) knlGS:0000000000000000
> >>> [ 541.054891] CS: 0010 DS: 0000 ES: 0000 CR0: 0000000080050033
> >>> [ 541.056039] CR2: 000000000175c568 CR3: 00000001dcfe6000 CR4: 00000000000006e0
> >>> [ 541.058506] ==================================================================
> >>> [ 541.059991] BUG: KASAN: stack-out-of-bounds in update_stack_state+0x38c/0x3e0
> >>> [ 541.061513] Read of size 8 at addr ffff8801e34a7970 by task umount/1305
> >>>
> >>> [ 541.063302] CPU: 1 PID: 1305 Comm: umount Tainted: G D 4.18.0-rc1+ #4
> >>> [ 541.064838] Hardware name: QEMU Standard PC (i440FX + PIIX, 1996), BIOS Ubuntu-1.8.2-1ubuntu1 04/01/2014
> >>> [ 541.066778] Call Trace:
> >>> [ 541.067294] dump_stack+0x7b/0xb5
> >>> [ 541.067986] print_address_description+0x70/0x290
> >>> [ 541.068941] kasan_report+0x291/0x390
> >>> [ 541.069692] ? update_stack_state+0x38c/0x3e0
> >>> [ 541.070598] __asan_load8+0x54/0x90
> >>> [ 541.071315] update_stack_state+0x38c/0x3e0
> >>> [ 541.072172] ? __read_once_size_nocheck.constprop.7+0x20/0x20
> >>> [ 541.073340] ? vprintk_func+0x27/0x60
> >>> [ 541.074096] ? printk+0xa3/0xd3
> >>> [ 541.074762] ? __save_stack_trace+0x5e/0x100
> >>> [ 541.075634] unwind_next_frame.part.5+0x18e/0x490
> >>> [ 541.076594] ? unwind_dump+0x290/0x290
> >>> [ 541.077368] ? __show_regs+0x2c4/0x330
> >>> [ 541.078142] __unwind_start+0x106/0x190
> >>> [ 541.085422] __save_stack_trace+0x5e/0x100
> >>> [ 541.086268] ? __save_stack_trace+0x5e/0x100
> >>> [ 541.087161] ? unlink_anon_vmas+0xba/0x2c0
> >>> [ 541.087997] save_stack_trace+0x1f/0x30
> >>> [ 541.088782] save_stack+0x46/0xd0
> >>> [ 541.089475] ? __alloc_pages_slowpath+0x1420/0x1420
> >>> [ 541.090477] ? flush_tlb_mm_range+0x15e/0x220
> >>> [ 541.091364] ? __dec_node_state+0x24/0xb0
> >>> [ 541.092180] ? lock_page_memcg+0x85/0xf0
> >>> [ 541.092979] ? unlock_page_memcg+0x16/0x80
> >>> [ 541.093812] ? page_remove_rmap+0x198/0x520
> >>> [ 541.094674] ? mark_page_accessed+0x133/0x200
> >>> [ 541.095559] ? _cond_resched+0x1a/0x50
> >>> [ 541.096326] ? unmap_page_range+0xcd4/0xe50
> >>> [ 541.097179] ? rb_next+0x58/0x80
> >>> [ 541.097845] ? rb_next+0x58/0x80
> >>> [ 541.098518] __kasan_slab_free+0x13c/0x1a0
> >>> [ 541.099352] ? unlink_anon_vmas+0xba/0x2c0
> >>> [ 541.100184] kasan_slab_free+0xe/0x10
> >>> [ 541.100934] kmem_cache_free+0x89/0x1e0
> >>> [ 541.101724] unlink_anon_vmas+0xba/0x2c0
> >>> [ 541.102534] free_pgtables+0x101/0x1b0
> >>> [ 541.103299] exit_mmap+0x146/0x2a0
> >>> [ 541.103996] ? __ia32_sys_munmap+0x50/0x50
> >>> [ 541.104829] ? kasan_check_read+0x11/0x20
> >>> [ 541.105649] ? mm_update_next_owner+0x322/0x380
> >>> [ 541.106578] mmput+0x8b/0x1d0
> >>> [ 541.107191] do_exit+0x43a/0x1390
> >>> [ 541.107876] ? mm_update_next_owner+0x380/0x380
> >>> [ 541.108791] ? deactivate_super+0x5e/0x80
> >>> [ 541.109610] ? cleanup_mnt+0x61/0xa0
> >>> [ 541.110351] ? __cleanup_mnt+0x12/0x20
> >>> [ 541.111115] ? task_work_run+0xc8/0xf0
> >>> [ 541.111879] ? exit_to_usermode_loop+0x125/0x130
> >>> [ 541.112817] rewind_stack_do_exit+0x17/0x20
> >>> [ 541.113666] RIP: 0033:0x7f46624bf487
> >>> [ 541.114404] Code: Bad RIP value.
> >>> [ 541.115094] RSP: 002b:00007fff5e12e9a8 EFLAGS: 00000246 ORIG_RAX: 00000000000000a6
> >>> [ 541.116605] RAX: 0000000000000000 RBX: 0000000001753030 RCX: 00007f46624bf487
> >>> [ 541.118034] RDX: 0000000000000001 RSI: 0000000000000000 RDI: 000000000175a1e0
> >>> [ 541.119472] RBP: 000000000175a1e0 R08: 0000000000000000 R09: 0000000000000014
> >>> [ 541.120890] R10: 00000000000006b2 R11: 0000000000000246 R12: 00007f46629c883c
> >>> [ 541.122321] R13: 0000000000000000 R14: 0000000001753210 R15: 00007fff5e12ec30
> >>>
> >>> [ 541.124061] The buggy address belongs to the page:
> >>> [ 541.125042] page:ffffea00078d29c0 count:0 mapcount:0 mapping:0000000000000000 index:0x0
> >>> [ 541.126651] flags: 0x2ffff0000000000()
> >>> [ 541.127418] raw: 02ffff0000000000 dead000000000100 dead000000000200 0000000000000000
> >>> [ 541.128963] raw: 0000000000000000 0000000000000000 00000000ffffffff 0000000000000000
> >>> [ 541.130516] page dumped because: kasan: bad access detected
> >>>
> >>> [ 541.131954] Memory state around the buggy address:
> >>> [ 541.132924] ffff8801e34a7800: 00 f1 f1 f1 f1 00 f4 f4 f4 f3 f3 f3 f3 00 00 00
> >>> [ 541.134378] ffff8801e34a7880: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
> >>> [ 541.135814] >ffff8801e34a7900: 00 00 00 00 00 00 00 00 00 00 00 00 00 f1 f1 f1
> >>> [ 541.137253] ^
> >>> [ 541.138637] ffff8801e34a7980: f1 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
> >>> [ 541.140075] ffff8801e34a7a00: 00 00 00 00 00 00 00 00 f3 00 00 00 00 00 00 00
> >>> [ 541.141509] ==================================================================
> >>>
> >>> - Location
> >>> https://elixir.bootlin.com/linux/v4.18-rc1/source/fs/inode.c#L512
> >>> BUG_ON(inode->i_data.nrpages);
> >>>
> >>> The root cause is root directory inode is corrupted, it has both
> >>> inline_data and inline_dentry flag, and its nlink is zero, so in
> >>> ->evict(), after dropping all page cache, it grabs page #0 for inline
> >>> data truncation, result in panic in later clear_inode() where we will
> >>> check inode->i_data.nrpages value.
> >>>
> >>> This patch adds inline flags check in sanity_check_inode, in addition,
> >>> do sanity check with root inode's nlink.
> >>>
> >>> Reported-by Wen Xu <wen.xu@gatech.edu>
> >>> Signed-off-by: Chao Yu <yuchao0@huawei.com>
> >>> ---
> >>> v2:
> >>> - fix wrong condition of inode type.
> >>> fs/f2fs/inode.c | 20 ++++++++++++++++++++
> >>> fs/f2fs/super.c | 3 ++-
> >>> 2 files changed, 22 insertions(+), 1 deletion(-)
> >>>
> >>> diff --git a/fs/f2fs/inode.c b/fs/f2fs/inode.c
> >>> index 24d9c93941d4..cd183c135e3d 100644
> >>> --- a/fs/f2fs/inode.c
> >>> +++ b/fs/f2fs/inode.c
> >>> @@ -229,6 +229,26 @@ static bool sanity_check_inode(struct inode *inode)
> >>> return false;
> >>> }
> >>> }
> >>> +
> >>> + if (f2fs_has_inline_data(inode) &&
> >>> + (!S_ISREG(inode->i_mode) && !S_ISLNK(inode->i_mode))) {
> >>> + set_sbi_flag(sbi, SBI_NEED_FSCK);
> >>> + f2fs_msg(sbi->sb, KERN_WARNING,
> >>> + "%s: inode (ino=%lx, mode=%u) should not have "
> >>> + "inline_data, run fsck to fix",
> >>> + __func__, inode->i_ino, inode->i_mode);
> >>> + return false;
> >>> + }
> >>> +
> >>> + if (f2fs_has_inline_dentry(inode) && !S_ISDIR(inode->i_mode)) {
> >>> + set_sbi_flag(sbi, SBI_NEED_FSCK);
> >>> + f2fs_msg(sbi->sb, KERN_WARNING,
> >>> + "%s: inode (ino=%lx, mode=%u) should not have "
> >>> + "inline_dentry, run fsck to fix",
> >>> + __func__, inode->i_ino, inode->i_mode);
> >>> + return false;
> >>> + }
> >>> +
> >>> return true;
> >>> }
> >>>
> >>> diff --git a/fs/f2fs/super.c b/fs/f2fs/super.c
> >>> index a64fee9137dc..a61dd0cf6cc5 100644
> >>> --- a/fs/f2fs/super.c
> >>> +++ b/fs/f2fs/super.c
> >>> @@ -2933,7 +2933,8 @@ static int f2fs_fill_super(struct super_block *sb, void *data, int silent)
> >>> err = PTR_ERR(root);
> >>> goto free_stats;
> >>> }
> >>> - if (!S_ISDIR(root->i_mode) || !root->i_blocks || !root->i_size) {
> >>> + if (!S_ISDIR(root->i_mode) || !root->i_blocks ||
> >>> + !root->i_size || !root->i_nlink) {
> >>> iput(root);
> >>> err = -EINVAL;
> >>> goto free_stats;
> >>>
^ permalink raw reply
* Re: [f2fs-dev] [PATCH 1/3] f2fs: turn off atomic writes when deteting abnormal behaviors
From: Chao Yu @ 2018-07-23 13:27 UTC (permalink / raw)
To: Jaegeuk Kim, Chao Yu; +Cc: linux-kernel, linux-f2fs-devel
In-Reply-To: <20180723130346.GD19644@jaegeuk-macbookpro.roam.corp.google.com>
On 2018/7/23 21:03, Jaegeuk Kim wrote:
> On 07/16, Chao Yu wrote:
>> On 2018/7/15 9:11, Jaegeuk Kim wrote:
>>> In order to prevent abusing atomic writes by abnormal users, we've added a
>>> threshold, 20% over memory footprint, which disallows further atomic writes.
>>> Previously, however, SQLite doesn't know the files became normal, so that
>>> it could write stale data and commit on revoked normal database file.
>>>
>>> Once f2fs detects such the abnormal behavior, this patch simply disables
>>> all the atomic operations such as:
>>> - write_begin() gives EINVAL to avoid stale data writes, and SQLite will call
>>> F2FS_IOC_ABORT_VOLATILE_WRITE to notify aborting the transaction,
>>> - F2FS_IOC_START_ATOMIC_WRITE gives EINVAL for SQLite to fall back normal
>>> journal_mode,
>>> - F2FS_IOC_COMMIT_ATOMIC_WRITE gives EINVAL, if the file was revoked, so that
>>> Framework retries to submit the transaction given propagated SQLite error.
>>>
>>> Note that, this patch also turns off atomic operations, if foreground GC tries
>>> to move atomic files too frequently.
>>
>> Well, how about just keeping original implementation: shutdown atomic write for
>> those files which are really affect fggc? Since intention of the original
>> behavior is targeting to abnormal atomic write usage, e.g. open atomic_write
>> file for very long time, then fggc will be blocked each time when moving its
>> block. So shutdown it, fggc will recover.
>
> The point here is stopping sqlite to keep going wrong data writes even after
> we already revoked blocks.
Yes, that's correct, what I mean is that if we can do that with smaller
granularity like just revoke blocks for file which is blocking fggc, it will
affect system/sqlite flow much less than forcing closing all atomic_write.
Thanks,
>
> Thanks,
>
>>
>> Thanks,
>>
>>>
>>> Signed-off-by: Jaegeuk Kim <jaegeuk@kernel.org>
>>> ---
>>> fs/f2fs/data.c | 7 ++++---
>>> fs/f2fs/f2fs.h | 4 ++--
>>> fs/f2fs/file.c | 6 +++++-
>>> fs/f2fs/gc.c | 4 +---
>>> fs/f2fs/segment.c | 21 +++++++++++----------
>>> 5 files changed, 23 insertions(+), 19 deletions(-)
>>>
>>> diff --git a/fs/f2fs/data.c b/fs/f2fs/data.c
>>> index 5e53d210e222..c9e75aa61c24 100644
>>> --- a/fs/f2fs/data.c
>>> +++ b/fs/f2fs/data.c
>>> @@ -2247,8 +2247,9 @@ static int f2fs_write_begin(struct file *file, struct address_space *mapping,
>>> trace_f2fs_write_begin(inode, pos, len, flags);
>>>
>>> if (f2fs_is_atomic_file(inode) &&
>>> - !f2fs_available_free_memory(sbi, INMEM_PAGES)) {
>>> - err = -ENOMEM;
>>> + (is_sbi_flag_set(sbi, SBI_DISABLE_ATOMIC_WRITE) ||
>>> + !f2fs_available_free_memory(sbi, INMEM_PAGES))) {
>>> + err = -EINVAL;
>>> drop_atomic = true;
>>> goto fail;
>>> }
>>> @@ -2331,7 +2332,7 @@ static int f2fs_write_begin(struct file *file, struct address_space *mapping,
>>> f2fs_put_page(page, 1);
>>> f2fs_write_failed(mapping, pos + len);
>>> if (drop_atomic)
>>> - f2fs_drop_inmem_pages_all(sbi, false);
>>> + f2fs_disable_atomic_write(sbi);
>>> return err;
>>> }
>>>
>>> diff --git a/fs/f2fs/f2fs.h b/fs/f2fs/f2fs.h
>>> index 4d8b1de83143..1d5c8d543eda 100644
>>> --- a/fs/f2fs/f2fs.h
>>> +++ b/fs/f2fs/f2fs.h
>>> @@ -621,7 +621,6 @@ enum {
>>>
>>> enum {
>>> GC_FAILURE_PIN,
>>> - GC_FAILURE_ATOMIC,
>>> MAX_GC_FAILURE
>>> };
>>>
>>> @@ -1066,6 +1065,7 @@ enum {
>>> SBI_POR_DOING, /* recovery is doing or not */
>>> SBI_NEED_SB_WRITE, /* need to recover superblock */
>>> SBI_NEED_CP, /* need to checkpoint */
>>> + SBI_DISABLE_ATOMIC_WRITE, /* turn off atomic write */
>>> };
>>>
>>> enum {
>>> @@ -2833,7 +2833,7 @@ void f2fs_destroy_node_manager_caches(void);
>>> */
>>> bool f2fs_need_SSR(struct f2fs_sb_info *sbi);
>>> void f2fs_register_inmem_page(struct inode *inode, struct page *page);
>>> -void f2fs_drop_inmem_pages_all(struct f2fs_sb_info *sbi, bool gc_failure);
>>> +void f2fs_disable_atomic_write(struct f2fs_sb_info *sbi);
>>> void f2fs_drop_inmem_pages(struct inode *inode);
>>> void f2fs_drop_inmem_page(struct inode *inode, struct page *page);
>>> int f2fs_commit_inmem_pages(struct inode *inode);
>>> diff --git a/fs/f2fs/file.c b/fs/f2fs/file.c
>>> index 6880c6f78d58..b029a4ed3bb0 100644
>>> --- a/fs/f2fs/file.c
>>> +++ b/fs/f2fs/file.c
>>> @@ -1682,6 +1682,9 @@ static int f2fs_ioc_start_atomic_write(struct file *filp)
>>> if (!S_ISREG(inode->i_mode))
>>> return -EINVAL;
>>>
>>> + if (is_sbi_flag_set(F2FS_I_SB(inode), SBI_DISABLE_ATOMIC_WRITE))
>>> + return -EINVAL;
>>> +
>>> ret = mnt_want_write_file(filp);
>>> if (ret)
>>> return ret;
>>> @@ -1750,7 +1753,6 @@ static int f2fs_ioc_commit_atomic_write(struct file *filp)
>>> ret = f2fs_do_sync_file(filp, 0, LLONG_MAX, 0, true);
>>> if (!ret) {
>>> clear_inode_flag(inode, FI_ATOMIC_FILE);
>>> - F2FS_I(inode)->i_gc_failures[GC_FAILURE_ATOMIC] = 0;
>>> stat_dec_atomic_write(inode);
>>> }
>>> } else {
>>> @@ -1853,6 +1855,8 @@ static int f2fs_ioc_abort_volatile_write(struct file *filp)
>>> ret = f2fs_do_sync_file(filp, 0, LLONG_MAX, 0, true);
>>> }
>>>
>>> + clear_inode_flag(inode, FI_ATOMIC_REVOKE_REQUEST);
>>> +
>>> inode_unlock(inode);
>>>
>>> mnt_drop_write_file(filp);
>>> diff --git a/fs/f2fs/gc.c b/fs/f2fs/gc.c
>>> index 9093be6e7a7d..6d762f3cdfc7 100644
>>> --- a/fs/f2fs/gc.c
>>> +++ b/fs/f2fs/gc.c
>>> @@ -629,7 +629,6 @@ static void move_data_block(struct inode *inode, block_t bidx,
>>> goto out;
>>>
>>> if (f2fs_is_atomic_file(inode)) {
>>> - F2FS_I(inode)->i_gc_failures[GC_FAILURE_ATOMIC]++;
>>> F2FS_I_SB(inode)->skipped_atomic_files[gc_type]++;
>>> goto out;
>>> }
>>> @@ -745,7 +744,6 @@ static void move_data_page(struct inode *inode, block_t bidx, int gc_type,
>>> goto out;
>>>
>>> if (f2fs_is_atomic_file(inode)) {
>>> - F2FS_I(inode)->i_gc_failures[GC_FAILURE_ATOMIC]++;
>>> F2FS_I_SB(inode)->skipped_atomic_files[gc_type]++;
>>> goto out;
>>> }
>>> @@ -1100,7 +1098,7 @@ int f2fs_gc(struct f2fs_sb_info *sbi, bool sync,
>>> if (has_not_enough_free_secs(sbi, sec_freed, 0)) {
>>> if (skipped_round > MAX_SKIP_ATOMIC_COUNT &&
>>> skipped_round * 2 >= round)
>>> - f2fs_drop_inmem_pages_all(sbi, true);
>>> + f2fs_disable_atomic_write(sbi);
>>> segno = NULL_SEGNO;
>>> goto gc_more;
>>> }
>>> diff --git a/fs/f2fs/segment.c b/fs/f2fs/segment.c
>>> index 9efce174c51a..05877a2f1894 100644
>>> --- a/fs/f2fs/segment.c
>>> +++ b/fs/f2fs/segment.c
>>> @@ -274,11 +274,14 @@ static int __revoke_inmem_pages(struct inode *inode,
>>> return err;
>>> }
>>>
>>> -void f2fs_drop_inmem_pages_all(struct f2fs_sb_info *sbi, bool gc_failure)
>>> +void f2fs_disable_atomic_write(struct f2fs_sb_info *sbi)
>>> {
>>> struct list_head *head = &sbi->inode_list[ATOMIC_FILE];
>>> struct inode *inode;
>>> struct f2fs_inode_info *fi;
>>> +
>>> + /* just turn it off */
>>> + set_sbi_flag(sbi, SBI_DISABLE_ATOMIC_WRITE);
>>> next:
>>> spin_lock(&sbi->inode_lock[ATOMIC_FILE]);
>>> if (list_empty(head)) {
>>> @@ -290,17 +293,16 @@ void f2fs_drop_inmem_pages_all(struct f2fs_sb_info *sbi, bool gc_failure)
>>> spin_unlock(&sbi->inode_lock[ATOMIC_FILE]);
>>>
>>> if (inode) {
>>> - if (gc_failure) {
>>> - if (fi->i_gc_failures[GC_FAILURE_ATOMIC])
>>> - goto drop;
>>> - goto skip;
>>> + inode_lock(inode);
>>> + /* need to check whether it was already revoked */
>>> + if (f2fs_is_atomic_file(inode)) {
>>> + f2fs_drop_inmem_pages(inode);
>>> + set_inode_flag(inode, FI_ATOMIC_REVOKE_REQUEST);
>>> }
>>> -drop:
>>> - set_inode_flag(inode, FI_ATOMIC_REVOKE_REQUEST);
>>> - f2fs_drop_inmem_pages(inode);
>>> + inode_unlock(inode);
>>> iput(inode);
>>> }
>>> -skip:
>>> +
>>> congestion_wait(BLK_RW_ASYNC, HZ/50);
>>> cond_resched();
>>> goto next;
>>> @@ -320,7 +322,6 @@ void f2fs_drop_inmem_pages(struct inode *inode)
>>> mutex_unlock(&fi->inmem_lock);
>>>
>>> clear_inode_flag(inode, FI_ATOMIC_FILE);
>>> - fi->i_gc_failures[GC_FAILURE_ATOMIC] = 0;
>>> stat_dec_atomic_write(inode);
>>> }
>>>
>>>
>
> ------------------------------------------------------------------------------
> Check out the vibrant tech community on one of the world's most
> engaging tech sites, Slashdot.org! http://sdm.link/slashdot
> _______________________________________________
> Linux-f2fs-devel mailing list
> Linux-f2fs-devel@lists.sourceforge.net
> https://lists.sourceforge.net/lists/listinfo/linux-f2fs-devel
>
^ permalink raw reply
* Re: [PATCH v2 5/6] 9p: Use a slab for allocating requests
From: Dominique Martinet @ 2018-07-23 12:25 UTC (permalink / raw)
To: Greg Kurz
Cc: Matthew Wilcox, v9fs-developer, Latchesar Ionkov,
Eric Van Hensbergen, Ron Minnich, linux-kernel, linux-fsdevel
In-Reply-To: <20180723135220.08ec45bf@bahia>
Greg Kurz wrote on Mon, Jul 23, 2018:
> The patch is quite big and I'm not sure I can find time to review it
> carefully, but I'll try to help anyway.
No worry, thanks for this already.
> > Sorry for coming back to this patch now, I just noticed something that's
> > actually probably a fairly big hit on performance...
> >
> > While the slab is just as good as the array for the request itself, this
> > makes every single request allocate "fcalls" everytime instead of
> > reusing a cached allocation.
> > The default msize is 8k and these allocs probably are fairly efficient,
> > but some transports like RDMA allow to increase this to up to 1MB... And
>
> It can be even bigger with virtio:
>
> #define VIRTQUEUE_NUM 128
>
> .maxsize = PAGE_SIZE * (VIRTQUEUE_NUM - 3),
>
> On a typical ppc64 server class setup with 64KB pages, this is nearly 8MB.
I don't think I'll be able to test 64KB pages, and it's "just" 500k with
4K pages so I'll go with IB.
I just finished reinstalling my IB-enabled VMs, now to get some iops
test running (dbench maybe) and I'll get some figures to be able to play
with different models and evaluate the impact of these.
> > One thing is that the buffers are all going to be the same size for a
> > given client (.... except virtio zc buffers, I wonder what I'm missing
> > or why that didn't blow up before?)
>
> ZC allocates a 4KB buffer, which is more than enough to hold the 7-byte 9P
> header and the "dqd" part of all messages that may use ZC, ie, 16 bytes.
> So I'm not sure to catch what could blow up.
ZC requests won't blow up, but from what I can see with the current
(old) request cache array, if a ZC request has a not-yet used tag it'll
allocate a new 4k buffer, then if a normal request uses that tag it'll
get the 4k buffer instead of an msize sized one.
On the client size the request would be posted with req->rc->capacity
which would correctly be 4k, but I'm not sure what would happen if qemu
tries to write more than the given size to that request?
> > It's a shame because I really like that patch, I'll try to find time to
> > run some light benchmark with varying msizes eventually but I'm not sure
> > when I'll find time for that... Hopefully before the 4.19 merge window!
> >
>
> Yeah, the open-coded cache we have now really obfuscates things.
>
> Maybe have a per-client kmem_cache object for non-ZC requests with
> size msize [*], and a global kmem_cache object for ZC requests with
> fixed size P9_ZC_HDR_SZ.
>
> [*] the server can require a smaller msize during version negotiation,
> so maybe we should change the kmem_cache object in this case.
Yeah, if we're going to want to accomodate non-power of two buffers, I
think we'll need a separate kmem_cache for them.
The ZC requests could be made into exactly 4k and these could come with
regular kmalloc just fine, it looks like trying to create a cache of
that size would just return the same cache used by kmalloc anyway so
it's probably easier to fall back to kmalloc if requested alloc size
doesn't match what we were hoping for.
I'll try to get figures for various approaches before the merge window
for 4.19 starts, it's getting closer though...
--
Dominique
^ permalink raw reply
* Re: [PATCH v5 0/8] xen: dma-buf support for grant device
From: Oleksandr Andrushchenko @ 2018-07-23 13:26 UTC (permalink / raw)
To: Boris Ostrovsky, Oleksandr Andrushchenko, xen-devel, linux-kernel,
dri-devel, linux-media, jgross, konrad.wilk
Cc: daniel.vetter, matthew.d.roper, dongwon.kim
In-Reply-To: <df3e8c07-c8b4-cb12-32ad-119498be114b@epam.com>
On 07/23/2018 11:38 AM, Oleksandr Andrushchenko wrote:
> On 07/20/2018 05:08 PM, Boris Ostrovsky wrote:
>> On 07/20/2018 05:01 AM, Oleksandr Andrushchenko wrote:
>>> From: Oleksandr Andrushchenko <oleksandr_andrushchenko@epam.com>
>>>
>>> This work is in response to my previous attempt to introduce Xen/DRM
>>> zero-copy driver [1] to enable Linux dma-buf API [2] for Xen based
>>> frontends/backends. There is also an existing hyper_dmabuf approach
>>> available [3] which, if reworked to utilize the proposed solution,
>>> can greatly benefit as well.
>>
>> Lot of warnings on i386 build:
>>
>> In file included from
>> /data/upstream/linux-xen/drivers/gpu/drm/xen/xen_drm_front.c:24:
>> /data/upstream/linux-xen/drivers/gpu/drm/xen/xen_drm_front.h: In
>> function ‘xen_drm_front_fb_to_cookie’:
>> /data/upstream/linux-xen/drivers/gpu/drm/xen/xen_drm_front.h:129:9:
>> warning: cast from pointer to integer of different size
>> [-Wpointer-to-int-cast]
>> return (u64)fb;
>> ^
>> /data/upstream/linux-xen/drivers/gpu/drm/xen/xen_drm_front.h: In
>> function ‘xen_drm_front_dbuf_to_cookie’:
>> /data/upstream/linux-xen/drivers/gpu/drm/xen/xen_drm_front.h:134:9:
>> warning: cast from pointer to integer of different size
>> [-Wpointer-to-int-cast]
>> return (u64)gem_obj;
>> ^
>> CC [M] net/netfilter/ipset/ip_set_hash_ipport.o
>> CC drivers/media/rc/keymaps/rc-tango.o
>> CC [M] drivers/gpu/drm/vmwgfx/vmwgfx_fifo.o
>> AR drivers/misc/built-in.a
>> In file included from
>> /data/upstream/linux-xen/drivers/gpu/drm/xen/xen_drm_front_kms.c:20:
>> /data/upstream/linux-xen/drivers/gpu/drm/xen/xen_drm_front.h: In
>> function ‘xen_drm_front_fb_to_cookie’:
>> CC [M] drivers/gpu/drm/xen/xen_drm_front_conn.o
>> /data/upstream/linux-xen/drivers/gpu/drm/xen/xen_drm_front.h:129:9:
>> warning: cast from pointer to integer of different size
>> [-Wpointer-to-int-cast]
>> return (u64)fb;
>> (and more)
>>
> The above warnings already have a fix [1] which is expected in 4.19
>>
>> and then
>>
>> data/upstream/linux-xen/drivers/xen/gntdev-dmabuf.c: In function
>> ‘gntdev_ioctl_dmabuf_exp_from_refs’:
>> /data/upstream/linux-xen/drivers/xen/gntdev-dmabuf.c:503:6: warning:
>> ‘args.fd’ may be used uninitialized in this function
>> [-Wmaybe-uninitialized]
>> *fd = args.fd;
>> ~~~~^~~~~~~~~
>> /data/upstream/linux-xen/drivers/xen/gntdev-dmabuf.c:467:35: note:
>> ‘args.fd’ was declared here
>> struct gntdev_dmabuf_export_args args;
>> ^~~~
> Strangely, but my i386 build goes smooth.
> Which version of gcc you use and could you please give me your
> .config, so I can test the same?
Now I see this warning which seems to be a false positive.
Boris, could you please apply the following:
diff --git a/drivers/xen/gntdev-dmabuf.c b/drivers/xen/gntdev-dmabuf.c
index e4c9f1f74476..0680dbcba616 100644
--- a/drivers/xen/gntdev-dmabuf.c
+++ b/drivers/xen/gntdev-dmabuf.c
@@ -495,6 +495,7 @@ static int dmabuf_exp_from_refs(struct gntdev_priv
*priv, int flags,
args.dmabuf_priv = priv->dmabuf_priv;
args.count = map->count;
args.pages = map->pages;
+ args.fd = -1;
ret = dmabuf_exp_from_pages(&args);
if (ret < 0)
or please let me know if you want me to resend with this fix?
>>
>> -boris
> Thank you,
> Oleksandr
>
> [1]
> https://cgit.freedesktop.org/drm/drm-misc/commit/?id=9eece5d9c6e0316f17091e37ff3ec87331bdedf3
Thank you,
Oleksandr
_______________________________________________
Xen-devel mailing list
Xen-devel@lists.xenproject.org
https://lists.xenproject.org/mailman/listinfo/xen-devel
^ permalink raw reply related
* Re: [PATCH v5 0/8] xen: dma-buf support for grant device
From: Oleksandr Andrushchenko @ 2018-07-23 13:26 UTC (permalink / raw)
To: Boris Ostrovsky, Oleksandr Andrushchenko, xen-devel, linux-kernel,
dri-devel, linux-media, jgross, konrad.wilk
Cc: daniel.vetter, dongwon.kim, matthew.d.roper
In-Reply-To: <df3e8c07-c8b4-cb12-32ad-119498be114b@epam.com>
On 07/23/2018 11:38 AM, Oleksandr Andrushchenko wrote:
> On 07/20/2018 05:08 PM, Boris Ostrovsky wrote:
>> On 07/20/2018 05:01 AM, Oleksandr Andrushchenko wrote:
>>> From: Oleksandr Andrushchenko <oleksandr_andrushchenko@epam.com>
>>>
>>> This work is in response to my previous attempt to introduce Xen/DRM
>>> zero-copy driver [1] to enable Linux dma-buf API [2] for Xen based
>>> frontends/backends. There is also an existing hyper_dmabuf approach
>>> available [3] which, if reworked to utilize the proposed solution,
>>> can greatly benefit as well.
>>
>> Lot of warnings on i386 build:
>>
>> In file included from
>> /data/upstream/linux-xen/drivers/gpu/drm/xen/xen_drm_front.c:24:
>> /data/upstream/linux-xen/drivers/gpu/drm/xen/xen_drm_front.h: In
>> function ‘xen_drm_front_fb_to_cookie’:
>> /data/upstream/linux-xen/drivers/gpu/drm/xen/xen_drm_front.h:129:9:
>> warning: cast from pointer to integer of different size
>> [-Wpointer-to-int-cast]
>> return (u64)fb;
>> ^
>> /data/upstream/linux-xen/drivers/gpu/drm/xen/xen_drm_front.h: In
>> function ‘xen_drm_front_dbuf_to_cookie’:
>> /data/upstream/linux-xen/drivers/gpu/drm/xen/xen_drm_front.h:134:9:
>> warning: cast from pointer to integer of different size
>> [-Wpointer-to-int-cast]
>> return (u64)gem_obj;
>> ^
>> CC [M] net/netfilter/ipset/ip_set_hash_ipport.o
>> CC drivers/media/rc/keymaps/rc-tango.o
>> CC [M] drivers/gpu/drm/vmwgfx/vmwgfx_fifo.o
>> AR drivers/misc/built-in.a
>> In file included from
>> /data/upstream/linux-xen/drivers/gpu/drm/xen/xen_drm_front_kms.c:20:
>> /data/upstream/linux-xen/drivers/gpu/drm/xen/xen_drm_front.h: In
>> function ‘xen_drm_front_fb_to_cookie’:
>> CC [M] drivers/gpu/drm/xen/xen_drm_front_conn.o
>> /data/upstream/linux-xen/drivers/gpu/drm/xen/xen_drm_front.h:129:9:
>> warning: cast from pointer to integer of different size
>> [-Wpointer-to-int-cast]
>> return (u64)fb;
>> (and more)
>>
> The above warnings already have a fix [1] which is expected in 4.19
>>
>> and then
>>
>> data/upstream/linux-xen/drivers/xen/gntdev-dmabuf.c: In function
>> ‘gntdev_ioctl_dmabuf_exp_from_refs’:
>> /data/upstream/linux-xen/drivers/xen/gntdev-dmabuf.c:503:6: warning:
>> ‘args.fd’ may be used uninitialized in this function
>> [-Wmaybe-uninitialized]
>> *fd = args.fd;
>> ~~~~^~~~~~~~~
>> /data/upstream/linux-xen/drivers/xen/gntdev-dmabuf.c:467:35: note:
>> ‘args.fd’ was declared here
>> struct gntdev_dmabuf_export_args args;
>> ^~~~
> Strangely, but my i386 build goes smooth.
> Which version of gcc you use and could you please give me your
> .config, so I can test the same?
Now I see this warning which seems to be a false positive.
Boris, could you please apply the following:
diff --git a/drivers/xen/gntdev-dmabuf.c b/drivers/xen/gntdev-dmabuf.c
index e4c9f1f74476..0680dbcba616 100644
--- a/drivers/xen/gntdev-dmabuf.c
+++ b/drivers/xen/gntdev-dmabuf.c
@@ -495,6 +495,7 @@ static int dmabuf_exp_from_refs(struct gntdev_priv
*priv, int flags,
args.dmabuf_priv = priv->dmabuf_priv;
args.count = map->count;
args.pages = map->pages;
+ args.fd = -1;
ret = dmabuf_exp_from_pages(&args);
if (ret < 0)
or please let me know if you want me to resend with this fix?
>>
>> -boris
> Thank you,
> Oleksandr
>
> [1]
> https://cgit.freedesktop.org/drm/drm-misc/commit/?id=9eece5d9c6e0316f17091e37ff3ec87331bdedf3
Thank you,
Oleksandr
^ permalink raw reply related
* RE: [EXT] Re: UBIFS file has zeroes at the end after an unclean reboot
From: Bean Huo (beanhuo) @ 2018-07-23 13:25 UTC (permalink / raw)
To: Richard Weinberger; +Cc: linux-mtd@lists.infradead.org
In-Reply-To: <1929018.rLX3MmPisr@blindfold>
Hi,Richard
Thanks.
it is Async mode ubifs mounted. After random powerloss testing, found that there is one file contains huge zeroes data.
But UBIFS didn't crash and no ECC/CRC error.
As for the below patch, doesn’t exist, we will try that.
Thanks again.
>Am Montag, 23. Juli 2018, 13:12:09 CEST schrieb Bean Huo (beanhuo):
>> Hi, Richard
>> Do you have good suggestions about how to prevent this condiciton:
>http://www.linux-mtd.infradead.org/faq/ubifs.html#L_end_hole ?
>
>Well, I'd start with making sure that userspaces does the right thing(tm) and
>to be very sure what kind of problem the user is facing.
>Did you verify whether the affected program is using fsync/fdatasync?
>
>Does your kernel include
>commit 1b7fc2c0069f3864a3dda15430b7aded31c0bfcc
>Author: Rafał Miłecki <rafal@milecki.pl>
>Date: Tue Sep 20 10:36:15 2016 +0200
>
> ubifs: Use dirty_writeback_interval value for wbuf timer
>
> Right now wbuf timer has hardcoded timeouts and there is no place for
> manual adjustments. Some projects / cases many need that though. Few
> file systems allow doing that by respecting dirty_writeback_interval
> that can be set using sysctl (dirty_writeback_centisecs).
>
> Lowering dirty_writeback_interval could be some way of dealing with user
> space apps lacking proper fsyncs. This is definitely *not* a perfect
> solution but we don't have ideal (user space) world. There were already
> advanced discussions on this matter, mostly when ext4 was introduced and
> it wasn't behaving as ext3. Anyway, the final decision was to add some
> hacks to the ext4, as trying to fix whole user space or adding new API
> was pointless.
>
> We can't (and shouldn't?) just follow ext4. We can't e.g. sync on close
> as this would cause too many commits and flash wearing. On the other
> hand we still should allow some trade-off between -o sync and default
> wbuf timeout. Respecting dirty_writeback_interval should allow some sane
> cutomizations if used warily.
>
> Signed-off-by: Rafał Miłecki <rafal@milecki.pl>
> Reviewed-by: Boris Brezillon <boris.brezillon@free-electrons.com>
> Signed-off-by: Richard Weinberger <richard@nod.at> ?
>
>Thanks,
>//richard
^ permalink raw reply
* Re: [PATCH 1/4] sched/topology: SD_ASYM_CPUCAPACITY flag detection
From: Qais Yousef @ 2018-07-23 13:25 UTC (permalink / raw)
To: Morten Rasmussen
Cc: peterz, mingo, vincent.guittot, dietmar.eggemann, linux-kernel,
valentin.schneider, linux-arm-kernel
In-Reply-To: <1532093554-30504-2-git-send-email-morten.rasmussen@arm.com>
Hi Morten
On 20/07/18 14:32, Morten Rasmussen wrote:
> The SD_ASYM_CPUCAPACITY sched_domain flag is supposed to mark the
> sched_domain in the hierarchy where all cpu capacities are visible for
> any cpu's point of view on asymmetric cpu capacity systems. The
> scheduler can then take to take capacity asymmetry into account when
Did you mean "s/take to take/try to take/"?
> balancing at this level. It also serves as an indicator for how wide
> task placement heuristics have to search to consider all available cpu
> capacities as asymmetric systems might often appear symmetric at
> smallest level(s) of the sched_domain hierarchy.
>
> The flag has been around for while but so far only been set by
> out-of-tree code in Android kernels. One solution is to let each
> architecture provide the flag through a custom sched_domain topology
> array and associated mask and flag functions. However,
> SD_ASYM_CPUCAPACITY is special in the sense that it depends on the
> capacity and presence of all cpus in the system, i.e. when hotplugging
> all cpus out except those with one particular cpu capacity the flag
> should disappear even if the sched_domains don't collapse. Similarly,
> the flag is affected by cpusets where load-balancing is turned off.
> Detecting when the flags should be set therefore depends not only on
> topology information but also the cpuset configuration and hotplug
> state. The arch code doesn't have easy access to the cpuset
> configuration.
>
> Instead, this patch implements the flag detection in generic code where
> cpusets and hotplug state is already taken care of. All the arch is
> responsible for is to implement arch_scale_cpu_capacity() and force a
> full rebuild of the sched_domain hierarchy if capacities are updated,
> e.g. later in the boot process when cpufreq has initialized.
>
> cc: Ingo Molnar <mingo@redhat.com>
> cc: Peter Zijlstra <peterz@infradead.org>
>
> Signed-off-by: Morten Rasmussen <morten.rasmussen@arm.com>
> ---
> include/linux/sched/topology.h | 2 +-
> kernel/sched/topology.c | 81 ++++++++++++++++++++++++++++++++++++++----
> 2 files changed, 76 insertions(+), 7 deletions(-)
>
> diff --git a/include/linux/sched/topology.h b/include/linux/sched/topology.h
> index 26347741ba50..4fe2e49ab13b 100644
> --- a/include/linux/sched/topology.h
> +++ b/include/linux/sched/topology.h
> @@ -23,7 +23,7 @@
> #define SD_BALANCE_FORK 0x0008 /* Balance on fork, clone */
> #define SD_BALANCE_WAKE 0x0010 /* Balance on wakeup */
> #define SD_WAKE_AFFINE 0x0020 /* Wake task to waking CPU */
> -#define SD_ASYM_CPUCAPACITY 0x0040 /* Groups have different max cpu capacities */
> +#define SD_ASYM_CPUCAPACITY 0x0040 /* Domain members have different cpu capacities */
> #define SD_SHARE_CPUCAPACITY 0x0080 /* Domain members share cpu capacity */
> #define SD_SHARE_POWERDOMAIN 0x0100 /* Domain members share power domain */
> #define SD_SHARE_PKG_RESOURCES 0x0200 /* Domain members share cpu pkg resources */
> diff --git a/kernel/sched/topology.c b/kernel/sched/topology.c
> index 05a831427bc7..b8f41d557612 100644
> --- a/kernel/sched/topology.c
> +++ b/kernel/sched/topology.c
> @@ -1061,7 +1061,6 @@ static struct cpumask ***sched_domains_numa_masks;
> * SD_SHARE_PKG_RESOURCES - describes shared caches
> * SD_NUMA - describes NUMA topologies
> * SD_SHARE_POWERDOMAIN - describes shared power domain
> - * SD_ASYM_CPUCAPACITY - describes mixed capacity topologies
> *
> * Odd one out, which beside describing the topology has a quirk also
> * prescribes the desired behaviour that goes along with it:
> @@ -1073,13 +1072,12 @@ static struct cpumask ***sched_domains_numa_masks;
> SD_SHARE_PKG_RESOURCES | \
> SD_NUMA | \
> SD_ASYM_PACKING | \
> - SD_ASYM_CPUCAPACITY | \
> SD_SHARE_POWERDOMAIN)
>
> static struct sched_domain *
> sd_init(struct sched_domain_topology_level *tl,
> const struct cpumask *cpu_map,
> - struct sched_domain *child, int cpu)
> + struct sched_domain *child, int dflags, int cpu)
> {
> struct sd_data *sdd = &tl->data;
> struct sched_domain *sd = *per_cpu_ptr(sdd->sd, cpu);
> @@ -1100,6 +1098,9 @@ sd_init(struct sched_domain_topology_level *tl,
> "wrong sd_flags in topology description\n"))
> sd_flags &= ~TOPOLOGY_SD_FLAGS;
>
> + /* Apply detected topology flags */
> + sd_flags |= dflags;
> +
> *sd = (struct sched_domain){
> .min_interval = sd_weight,
> .max_interval = 2*sd_weight,
> @@ -1607,9 +1608,9 @@ static void __sdt_free(const struct cpumask *cpu_map)
>
> static struct sched_domain *build_sched_domain(struct sched_domain_topology_level *tl,
> const struct cpumask *cpu_map, struct sched_domain_attr *attr,
> - struct sched_domain *child, int cpu)
> + struct sched_domain *child, int dflags, int cpu)
> {
> - struct sched_domain *sd = sd_init(tl, cpu_map, child, cpu);
> + struct sched_domain *sd = sd_init(tl, cpu_map, child, dflags, cpu);
>
> if (child) {
> sd->level = child->level + 1;
> @@ -1636,6 +1637,65 @@ static struct sched_domain *build_sched_domain(struct sched_domain_topology_leve
> }
>
> /*
> + * Find the sched_domain_topology_level where all cpu capacities are visible
> + * for all cpus.
> + */
> +static struct sched_domain_topology_level
> +*asym_cpu_capacity_level(const struct cpumask *cpu_map)
> +{
> + int i, j, asym_level = 0;
> + bool asym = false;
> + struct sched_domain_topology_level *tl, *asym_tl = NULL;
> + unsigned long cap;
> +
> + /* Is there any asymmetry? */
> + cap = arch_scale_cpu_capacity(NULL, cpumask_first(cpu_map));
> +
> + for_each_cpu(i, cpu_map) {
> + if (arch_scale_cpu_capacity(NULL, i) != cap) {
> + asym = true;
> + break;
> + }
> + }
> +
> + if (!asym)
> + return NULL;
> +
> + /*
> + * Examine topology from all cpu's point of views to detect the lowest
> + * sched_domain_topology_level where a highest capacity cpu is visible
> + * to everyone.
> + */
> + for_each_cpu(i, cpu_map) {
> + unsigned long max_capacity = arch_scale_cpu_capacity(NULL, i);
> + int tl_id = 0;
> +
> + for_each_sd_topology(tl) {
> + if (tl_id < asym_level)
> + goto next_level;
> +
I think if you increment and then continue here you might save the extra
branch. I didn't look at any disassembly though to verify the generated
code.
I wonder if we can introduce for_each_sd_topology_from(tl,
starting_level) so that you can start searching from a provided level -
which will make this skipping logic unnecessary? So the code will look like
for_each_sd_topology_from(tl, asymc_level) {
...
}
> + for_each_cpu_and(j, tl->mask(i), cpu_map) {
> + unsigned long capacity;
> +
> + capacity = arch_scale_cpu_capacity(NULL, j);
> +
> + if (capacity <= max_capacity)
> + continue;
> +
> + max_capacity = capacity;
> + asym_level = tl_id;
> + asym_tl = tl;
> + }
> +next_level:
> + tl_id++;
> + }
> + }
> +
> + return asym_tl;
> +}
> +
> +
> +/*
> * Build sched domains for a given set of CPUs and attach the sched domains
> * to the individual CPUs
> */
> @@ -1647,18 +1707,27 @@ build_sched_domains(const struct cpumask *cpu_map, struct sched_domain_attr *att
> struct s_data d;
> struct rq *rq = NULL;
> int i, ret = -ENOMEM;
> + struct sched_domain_topology_level *tl_asym;
>
> alloc_state = __visit_domain_allocation_hell(&d, cpu_map);
> if (alloc_state != sa_rootdomain)
> goto error;
>
> + tl_asym = asym_cpu_capacity_level(cpu_map);
> +
Or maybe this is not a hot path and we don't care that much about
optimizing the search since you call it unconditionally here even for
systems that don't care?
> /* Set up domains for CPUs specified by the cpu_map: */
> for_each_cpu(i, cpu_map) {
> struct sched_domain_topology_level *tl;
>
> sd = NULL;
> for_each_sd_topology(tl) {
> - sd = build_sched_domain(tl, cpu_map, attr, sd, i);
> + int dflags = 0;
> +
> + if (tl == tl_asym)
> + dflags |= SD_ASYM_CPUCAPACITY;
> +
> + sd = build_sched_domain(tl, cpu_map, attr, sd, dflags, i);
> +
> if (tl == sched_domain_topology)
> *per_cpu_ptr(d.sd, i) = sd;
> if (tl->flags & SDTL_OVERLAP)
--
Qais Yousef
^ permalink raw reply
* [PATCH 1/4] sched/topology: SD_ASYM_CPUCAPACITY flag detection
From: Qais Yousef @ 2018-07-23 13:25 UTC (permalink / raw)
To: linux-arm-kernel
In-Reply-To: <1532093554-30504-2-git-send-email-morten.rasmussen@arm.com>
Hi Morten
On 20/07/18 14:32, Morten Rasmussen wrote:
> The SD_ASYM_CPUCAPACITY sched_domain flag is supposed to mark the
> sched_domain in the hierarchy where all cpu capacities are visible for
> any cpu's point of view on asymmetric cpu capacity systems. The
> scheduler can then take to take capacity asymmetry into account when
Did you mean "s/take to take/try to take/"?
> balancing at this level. It also serves as an indicator for how wide
> task placement heuristics have to search to consider all available cpu
> capacities as asymmetric systems might often appear symmetric at
> smallest level(s) of the sched_domain hierarchy.
>
> The flag has been around for while but so far only been set by
> out-of-tree code in Android kernels. One solution is to let each
> architecture provide the flag through a custom sched_domain topology
> array and associated mask and flag functions. However,
> SD_ASYM_CPUCAPACITY is special in the sense that it depends on the
> capacity and presence of all cpus in the system, i.e. when hotplugging
> all cpus out except those with one particular cpu capacity the flag
> should disappear even if the sched_domains don't collapse. Similarly,
> the flag is affected by cpusets where load-balancing is turned off.
> Detecting when the flags should be set therefore depends not only on
> topology information but also the cpuset configuration and hotplug
> state. The arch code doesn't have easy access to the cpuset
> configuration.
>
> Instead, this patch implements the flag detection in generic code where
> cpusets and hotplug state is already taken care of. All the arch is
> responsible for is to implement arch_scale_cpu_capacity() and force a
> full rebuild of the sched_domain hierarchy if capacities are updated,
> e.g. later in the boot process when cpufreq has initialized.
>
> cc: Ingo Molnar <mingo@redhat.com>
> cc: Peter Zijlstra <peterz@infradead.org>
>
> Signed-off-by: Morten Rasmussen <morten.rasmussen@arm.com>
> ---
> include/linux/sched/topology.h | 2 +-
> kernel/sched/topology.c | 81 ++++++++++++++++++++++++++++++++++++++----
> 2 files changed, 76 insertions(+), 7 deletions(-)
>
> diff --git a/include/linux/sched/topology.h b/include/linux/sched/topology.h
> index 26347741ba50..4fe2e49ab13b 100644
> --- a/include/linux/sched/topology.h
> +++ b/include/linux/sched/topology.h
> @@ -23,7 +23,7 @@
> #define SD_BALANCE_FORK 0x0008 /* Balance on fork, clone */
> #define SD_BALANCE_WAKE 0x0010 /* Balance on wakeup */
> #define SD_WAKE_AFFINE 0x0020 /* Wake task to waking CPU */
> -#define SD_ASYM_CPUCAPACITY 0x0040 /* Groups have different max cpu capacities */
> +#define SD_ASYM_CPUCAPACITY 0x0040 /* Domain members have different cpu capacities */
> #define SD_SHARE_CPUCAPACITY 0x0080 /* Domain members share cpu capacity */
> #define SD_SHARE_POWERDOMAIN 0x0100 /* Domain members share power domain */
> #define SD_SHARE_PKG_RESOURCES 0x0200 /* Domain members share cpu pkg resources */
> diff --git a/kernel/sched/topology.c b/kernel/sched/topology.c
> index 05a831427bc7..b8f41d557612 100644
> --- a/kernel/sched/topology.c
> +++ b/kernel/sched/topology.c
> @@ -1061,7 +1061,6 @@ static struct cpumask ***sched_domains_numa_masks;
> * SD_SHARE_PKG_RESOURCES - describes shared caches
> * SD_NUMA - describes NUMA topologies
> * SD_SHARE_POWERDOMAIN - describes shared power domain
> - * SD_ASYM_CPUCAPACITY - describes mixed capacity topologies
> *
> * Odd one out, which beside describing the topology has a quirk also
> * prescribes the desired behaviour that goes along with it:
> @@ -1073,13 +1072,12 @@ static struct cpumask ***sched_domains_numa_masks;
> SD_SHARE_PKG_RESOURCES | \
> SD_NUMA | \
> SD_ASYM_PACKING | \
> - SD_ASYM_CPUCAPACITY | \
> SD_SHARE_POWERDOMAIN)
>
> static struct sched_domain *
> sd_init(struct sched_domain_topology_level *tl,
> const struct cpumask *cpu_map,
> - struct sched_domain *child, int cpu)
> + struct sched_domain *child, int dflags, int cpu)
> {
> struct sd_data *sdd = &tl->data;
> struct sched_domain *sd = *per_cpu_ptr(sdd->sd, cpu);
> @@ -1100,6 +1098,9 @@ sd_init(struct sched_domain_topology_level *tl,
> "wrong sd_flags in topology description\n"))
> sd_flags &= ~TOPOLOGY_SD_FLAGS;
>
> + /* Apply detected topology flags */
> + sd_flags |= dflags;
> +
> *sd = (struct sched_domain){
> .min_interval = sd_weight,
> .max_interval = 2*sd_weight,
> @@ -1607,9 +1608,9 @@ static void __sdt_free(const struct cpumask *cpu_map)
>
> static struct sched_domain *build_sched_domain(struct sched_domain_topology_level *tl,
> const struct cpumask *cpu_map, struct sched_domain_attr *attr,
> - struct sched_domain *child, int cpu)
> + struct sched_domain *child, int dflags, int cpu)
> {
> - struct sched_domain *sd = sd_init(tl, cpu_map, child, cpu);
> + struct sched_domain *sd = sd_init(tl, cpu_map, child, dflags, cpu);
>
> if (child) {
> sd->level = child->level + 1;
> @@ -1636,6 +1637,65 @@ static struct sched_domain *build_sched_domain(struct sched_domain_topology_leve
> }
>
> /*
> + * Find the sched_domain_topology_level where all cpu capacities are visible
> + * for all cpus.
> + */
> +static struct sched_domain_topology_level
> +*asym_cpu_capacity_level(const struct cpumask *cpu_map)
> +{
> + int i, j, asym_level = 0;
> + bool asym = false;
> + struct sched_domain_topology_level *tl, *asym_tl = NULL;
> + unsigned long cap;
> +
> + /* Is there any asymmetry? */
> + cap = arch_scale_cpu_capacity(NULL, cpumask_first(cpu_map));
> +
> + for_each_cpu(i, cpu_map) {
> + if (arch_scale_cpu_capacity(NULL, i) != cap) {
> + asym = true;
> + break;
> + }
> + }
> +
> + if (!asym)
> + return NULL;
> +
> + /*
> + * Examine topology from all cpu's point of views to detect the lowest
> + * sched_domain_topology_level where a highest capacity cpu is visible
> + * to everyone.
> + */
> + for_each_cpu(i, cpu_map) {
> + unsigned long max_capacity = arch_scale_cpu_capacity(NULL, i);
> + int tl_id = 0;
> +
> + for_each_sd_topology(tl) {
> + if (tl_id < asym_level)
> + goto next_level;
> +
I think if you increment and then continue here you might save the extra
branch. I didn't look at any disassembly though to verify the generated
code.
I wonder if we can introduce for_each_sd_topology_from(tl,
starting_level) so that you can start searching from a provided level -
which will make this skipping logic unnecessary? So the code will look like
??? ??? ??? for_each_sd_topology_from(tl, asymc_level) {
??? ??? ??? ??? ...
??? ??? ??? }
> + for_each_cpu_and(j, tl->mask(i), cpu_map) {
> + unsigned long capacity;
> +
> + capacity = arch_scale_cpu_capacity(NULL, j);
> +
> + if (capacity <= max_capacity)
> + continue;
> +
> + max_capacity = capacity;
> + asym_level = tl_id;
> + asym_tl = tl;
> + }
> +next_level:
> + tl_id++;
> + }
> + }
> +
> + return asym_tl;
> +}
> +
> +
> +/*
> * Build sched domains for a given set of CPUs and attach the sched domains
> * to the individual CPUs
> */
> @@ -1647,18 +1707,27 @@ build_sched_domains(const struct cpumask *cpu_map, struct sched_domain_attr *att
> struct s_data d;
> struct rq *rq = NULL;
> int i, ret = -ENOMEM;
> + struct sched_domain_topology_level *tl_asym;
>
> alloc_state = __visit_domain_allocation_hell(&d, cpu_map);
> if (alloc_state != sa_rootdomain)
> goto error;
>
> + tl_asym = asym_cpu_capacity_level(cpu_map);
> +
Or maybe this is not a hot path and we don't care that much about
optimizing the search since you call it unconditionally here even for
systems that don't care?
> /* Set up domains for CPUs specified by the cpu_map: */
> for_each_cpu(i, cpu_map) {
> struct sched_domain_topology_level *tl;
>
> sd = NULL;
> for_each_sd_topology(tl) {
> - sd = build_sched_domain(tl, cpu_map, attr, sd, i);
> + int dflags = 0;
> +
> + if (tl == tl_asym)
> + dflags |= SD_ASYM_CPUCAPACITY;
> +
> + sd = build_sched_domain(tl, cpu_map, attr, sd, dflags, i);
> +
> if (tl == sched_domain_topology)
> *per_cpu_ptr(d.sd, i) = sd;
> if (tl->flags & SDTL_OVERLAP)
--
Qais Yousef
^ permalink raw reply
* Re: [PATCH 0/2] travis-ci: fail if Coccinelle found something to transform
From: Derrick Stolee @ 2018-07-23 13:25 UTC (permalink / raw)
To: SZEDER Gábor, Junio C Hamano
Cc: git, Lars Schneider, Nguyễn Thái Ngọc Duy
In-Reply-To: <20180723130230.22491-1-szeder.dev@gmail.com>
On 7/23/2018 9:02 AM, SZEDER Gábor wrote:
> The first patch makes the static analysis build job on Travis CI
> faster by running it with 'make -j2'.
>
> The second patch makes it more more useful by failing the build job if
> Coccinelle finds something to transform, thereby drawing our attention
> to undesired code patterns trying to enter the codebase.
>
>
> With these patches applied, the static analysis build job would fail
> on current 'pu' because of two small issues on two branches:
>
> - js/range-diff: Dscho has sent out v4 of this series over the
> weekend, which already incorporates Coccinelle's suggestion, so
> it's basically done.
>
> - pb/bisect-helper-2: this topic has not seen an update in about 9
> months, so I'll send a followup patch 3/2 to be applied on top or
> squashed in, whichever is deemed better.
>
>
> SZEDER Gábor (2):
> travis-ci: run Coccinelle static analysis with two parallel jobs
> travis-ci: fail if Coccinelle static analysis found something to
> transform
>
> ci/run-static-analysis.sh | 21 ++++++++++++++++++++-
> 1 file changed, 20 insertions(+), 1 deletion(-)
Thanks, Szeder.
I agree that we should use all possible automation as part of CI to
catch things early. I like the direction here.
Reviewed-by: Derrick Stolee <dstolee@microsoft.com>
^ permalink raw reply
* [LTP] [PATCH v2] Rename TEST_ERRNO and TEST_RETURN for new test lib
From: Christian Lanig @ 2018-07-23 13:24 UTC (permalink / raw)
To: ltp
Signed-off-by: Christian Lanig <clanig@suse.com>
---
Hi,
I have changed the variables as requested. In my previous version
I forgot that headers can include headers and made wrong assumptions
for files that don't include "tst_test.h" directly. Sorry for the confusion.
Regards,
Christian
include/tst_test.h | 10 ++---
lib/tst_crypto.c | 10 ++---
lib/tst_test.c | 7 ++-
testcases/cve/cve-2015-3290.c | 4 +-
testcases/kernel/crypto/pcrypt_aead01.c | 6 +--
testcases/kernel/fs/read_all/read_all.c | 6 +--
testcases/kernel/logging/kmsg/kmsg01.c | 50 +++++++++++-----------
testcases/kernel/mem/hugetlb/hugemmap/hugemmap06.c | 4 +-
.../kernel/mem/hugetlb/hugeshmctl/hugeshmctl02.c | 4 +-
.../kernel/mem/hugetlb/hugeshmctl/hugeshmctl03.c | 4 +-
.../kernel/mem/hugetlb/hugeshmget/hugeshmget02.c | 4 +-
.../kernel/mem/hugetlb/hugeshmget/hugeshmget03.c | 4 +-
.../kernel/mem/hugetlb/hugeshmget/hugeshmget05.c | 4 +-
testcases/kernel/mem/ksm/ksm05.c | 2 +-
testcases/kernel/mem/lib/mem.c | 4 +-
testcases/kernel/mem/thp/thp01.c | 4 +-
testcases/kernel/syscalls/access/access01.c | 6 +--
testcases/kernel/syscalls/access/access02.c | 14 +++---
testcases/kernel/syscalls/access/access03.c | 4 +-
testcases/kernel/syscalls/access/access04.c | 4 +-
testcases/kernel/syscalls/add_key/add_key01.c | 2 +-
testcases/kernel/syscalls/add_key/add_key02.c | 8 ++--
testcases/kernel/syscalls/add_key/add_key03.c | 8 ++--
testcases/kernel/syscalls/add_key/add_key04.c | 6 +--
testcases/kernel/syscalls/brk/brk01.c | 2 +-
testcases/kernel/syscalls/chdir/chdir03.c | 4 +-
testcases/kernel/syscalls/chmod/chmod06.c | 4 +-
.../kernel/syscalls/clock_getres/clock_getres01.c | 8 ++--
.../syscalls/clock_nanosleep/clock_nanosleep01.c | 6 +--
.../syscalls/clock_nanosleep/clock_nanosleep02.c | 4 +-
.../clock_nanosleep2/clock_nanosleep2_01.c | 2 +-
testcases/kernel/syscalls/clone/clone08.c | 6 +--
testcases/kernel/syscalls/clone/clone09.c | 6 +--
.../syscalls/copy_file_range/copy_file_range01.c | 4 +-
testcases/kernel/syscalls/creat/creat04.c | 4 +-
testcases/kernel/syscalls/creat/creat05.c | 6 +--
testcases/kernel/syscalls/creat/creat06.c | 4 +-
testcases/kernel/syscalls/creat/creat07.c | 4 +-
testcases/kernel/syscalls/epoll_ctl/epoll_ctl01.c | 2 +-
testcases/kernel/syscalls/epoll_ctl/epoll_ctl02.c | 6 +--
.../kernel/syscalls/epoll_wait/epoll_wait01.c | 18 ++++----
.../kernel/syscalls/epoll_wait/epoll_wait02.c | 4 +-
testcases/kernel/syscalls/fchdir/fchdir03.c | 4 +-
testcases/kernel/syscalls/fchmod/fchmod01.c | 2 +-
testcases/kernel/syscalls/fchmod/fchmod02.c | 2 +-
testcases/kernel/syscalls/fchmod/fchmod06.c | 8 ++--
testcases/kernel/syscalls/fcntl/fcntl02.c | 10 ++---
testcases/kernel/syscalls/fcntl/fcntl03.c | 4 +-
testcases/kernel/syscalls/fcntl/fcntl04.c | 8 ++--
.../kernel/syscalls/flistxattr/flistxattr01.c | 2 +-
.../kernel/syscalls/flistxattr/flistxattr02.c | 6 +--
.../kernel/syscalls/flistxattr/flistxattr03.c | 4 +-
testcases/kernel/syscalls/fsync/fsync01.c | 4 +-
testcases/kernel/syscalls/futex/futex_wait05.c | 6 +--
testcases/kernel/syscalls/getcwd/getcwd01.c | 4 +-
testcases/kernel/syscalls/getcwd/getcwd02.c | 2 +-
testcases/kernel/syscalls/getcwd/getcwd05.c | 2 +-
.../kernel/syscalls/getpriority/getpriority01.c | 8 ++--
.../kernel/syscalls/getpriority/getpriority02.c | 6 +--
testcases/kernel/syscalls/getrandom/getrandom01.c | 4 +-
testcases/kernel/syscalls/getrandom/getrandom02.c | 8 ++--
testcases/kernel/syscalls/getrandom/getrandom03.c | 6 +--
testcases/kernel/syscalls/getrandom/getrandom04.c | 4 +-
testcases/kernel/syscalls/inotify/inotify03.c | 6 +--
.../kernel/syscalls/io_destroy/io_destroy01.c | 6 +--
testcases/kernel/syscalls/io_setup/io_setup01.c | 10 ++---
testcases/kernel/syscalls/ioctl/ioctl04.c | 6 +--
testcases/kernel/syscalls/ipc/msgctl/msgctl01.c | 4 +-
testcases/kernel/syscalls/ipc/msgctl/msgctl02.c | 2 +-
testcases/kernel/syscalls/ipc/msgctl/msgctl03.c | 6 +--
testcases/kernel/syscalls/ipc/msgctl/msgctl04.c | 6 +--
testcases/kernel/syscalls/ipc/msgctl/msgctl12.c | 4 +-
testcases/kernel/syscalls/ipc/msgget/msgget01.c | 4 +-
testcases/kernel/syscalls/ipc/msgget/msgget02.c | 4 +-
testcases/kernel/syscalls/ipc/msgget/msgget03.c | 4 +-
testcases/kernel/syscalls/ipc/msgsnd/msgsnd01.c | 2 +-
testcases/kernel/syscalls/ipc/msgsnd/msgsnd02.c | 4 +-
testcases/kernel/syscalls/ipc/msgsnd/msgsnd05.c | 4 +-
testcases/kernel/syscalls/ipc/msgsnd/msgsnd06.c | 4 +-
testcases/kernel/syscalls/ipc/shmctl/shmctl05.c | 4 +-
testcases/kernel/syscalls/kcmp/kcmp01.c | 8 ++--
testcases/kernel/syscalls/kcmp/kcmp02.c | 4 +-
testcases/kernel/syscalls/kcmp/kcmp03.c | 4 +-
testcases/kernel/syscalls/keyctl/keyctl01.c | 8 ++--
testcases/kernel/syscalls/keyctl/keyctl03.c | 2 +-
testcases/kernel/syscalls/keyctl/keyctl04.c | 10 ++---
testcases/kernel/syscalls/keyctl/keyctl05.c | 26 +++++------
testcases/kernel/syscalls/keyctl/keyctl06.c | 8 ++--
testcases/kernel/syscalls/keyctl/keyctl07.c | 14 +++---
testcases/kernel/syscalls/lgetxattr/lgetxattr01.c | 10 ++---
testcases/kernel/syscalls/lgetxattr/lgetxattr02.c | 4 +-
testcases/kernel/syscalls/link/link08.c | 6 +--
testcases/kernel/syscalls/listxattr/listxattr01.c | 2 +-
testcases/kernel/syscalls/listxattr/listxattr02.c | 6 +--
testcases/kernel/syscalls/listxattr/listxattr03.c | 4 +-
.../kernel/syscalls/llistxattr/llistxattr01.c | 2 +-
.../kernel/syscalls/llistxattr/llistxattr02.c | 6 +--
.../kernel/syscalls/llistxattr/llistxattr03.c | 4 +-
testcases/kernel/syscalls/lseek/lseek01.c | 6 +--
testcases/kernel/syscalls/lseek/lseek02.c | 4 +-
testcases/kernel/syscalls/lseek/lseek07.c | 6 +--
testcases/kernel/syscalls/madvise/madvise01.c | 6 +--
testcases/kernel/syscalls/madvise/madvise02.c | 4 +-
testcases/kernel/syscalls/madvise/madvise05.c | 6 +--
testcases/kernel/syscalls/madvise/madvise06.c | 2 +-
testcases/kernel/syscalls/madvise/madvise10.c | 4 +-
testcases/kernel/syscalls/mbind/mbind01.c | 10 ++---
.../kernel/syscalls/memfd_create/memfd_create02.c | 6 +--
.../syscalls/memfd_create/memfd_create_common.c | 10 ++---
testcases/kernel/syscalls/mkdir/mkdir03.c | 6 +--
testcases/kernel/syscalls/mkdir/mkdir05.c | 2 +-
testcases/kernel/syscalls/mkdirat/mkdirat02.c | 6 +--
.../kernel/syscalls/move_pages/move_pages12.c | 6 +--
testcases/kernel/syscalls/mq_notify/mq_notify01.c | 14 +++---
testcases/kernel/syscalls/mq_open/mq_open01.c | 18 ++++----
.../syscalls/mq_timedreceive/mq_timedreceive01.c | 10 ++---
.../kernel/syscalls/mq_timedsend/mq_timedsend01.c | 16 +++----
testcases/kernel/syscalls/mq_unlink/mq_unlink01.c | 6 +--
testcases/kernel/syscalls/nanosleep/nanosleep01.c | 4 +-
testcases/kernel/syscalls/nice/nice01.c | 8 ++--
testcases/kernel/syscalls/nice/nice02.c | 6 +--
testcases/kernel/syscalls/nice/nice03.c | 4 +-
testcases/kernel/syscalls/nice/nice04.c | 6 +--
testcases/kernel/syscalls/open/open01.c | 2 +-
testcases/kernel/syscalls/open/open02.c | 4 +-
testcases/kernel/syscalls/open/open08.c | 12 +++---
testcases/kernel/syscalls/pause/pause01.c | 4 +-
testcases/kernel/syscalls/pipe/pipe01.c | 2 +-
testcases/kernel/syscalls/pipe/pipe02.c | 2 +-
testcases/kernel/syscalls/pipe/pipe03.c | 6 +--
testcases/kernel/syscalls/poll/poll01.c | 4 +-
testcases/kernel/syscalls/poll/poll02.c | 4 +-
testcases/kernel/syscalls/prctl/prctl01.c | 4 +-
testcases/kernel/syscalls/prctl/prctl02.c | 4 +-
testcases/kernel/syscalls/preadv/preadv01.c | 6 +--
testcases/kernel/syscalls/preadv/preadv02.c | 4 +-
testcases/kernel/syscalls/preadv/preadv03.c | 6 +--
testcases/kernel/syscalls/pselect/pselect01.c | 4 +-
testcases/kernel/syscalls/pselect/pselect03.c | 4 +-
testcases/kernel/syscalls/ptrace/ptrace07.c | 16 +++----
testcases/kernel/syscalls/pwrite/pwrite02.c | 4 +-
testcases/kernel/syscalls/pwrite/pwrite03.c | 2 +-
testcases/kernel/syscalls/pwritev/pwritev01.c | 6 +--
testcases/kernel/syscalls/pwritev/pwritev02.c | 4 +-
testcases/kernel/syscalls/pwritev/pwritev03.c | 6 +--
testcases/kernel/syscalls/quotactl/quotactl01.c | 2 +-
testcases/kernel/syscalls/quotactl/quotactl02.c | 2 +-
testcases/kernel/syscalls/quotactl/quotactl03.c | 8 ++--
testcases/kernel/syscalls/read/read01.c | 4 +-
testcases/kernel/syscalls/read/read02.c | 6 +--
testcases/kernel/syscalls/readlink/readlink01.c | 6 +--
testcases/kernel/syscalls/readlink/readlink03.c | 6 +--
.../kernel/syscalls/request_key/request_key01.c | 4 +-
.../kernel/syscalls/request_key/request_key02.c | 4 +-
.../kernel/syscalls/request_key/request_key03.c | 16 +++----
.../kernel/syscalls/request_key/request_key04.c | 22 +++++-----
testcases/kernel/syscalls/rmdir/rmdir01.c | 2 +-
testcases/kernel/syscalls/rmdir/rmdir02.c | 6 +--
testcases/kernel/syscalls/rmdir/rmdir03.c | 6 +--
.../sched_setscheduler/sched_setscheduler03.c | 2 +-
testcases/kernel/syscalls/select/select04.c | 4 +-
testcases/kernel/syscalls/sendto/sendto02.c | 4 +-
.../kernel/syscalls/setpriority/setpriority01.c | 2 +-
.../kernel/syscalls/setpriority/setpriority02.c | 6 +--
testcases/kernel/syscalls/setrlimit/setrlimit02.c | 4 +-
testcases/kernel/syscalls/setrlimit/setrlimit03.c | 4 +-
testcases/kernel/syscalls/setrlimit/setrlimit05.c | 4 +-
.../kernel/syscalls/setsockopt/setsockopt02.c | 10 ++---
testcases/kernel/syscalls/setuid/setuid01.c | 2 +-
testcases/kernel/syscalls/setuid/setuid03.c | 4 +-
testcases/kernel/syscalls/setuid/setuid04.c | 4 +-
testcases/kernel/syscalls/setxattr/setxattr01.c | 10 ++---
testcases/kernel/syscalls/setxattr/setxattr02.c | 10 ++---
testcases/kernel/syscalls/socket/socket01.c | 8 ++--
.../kernel/syscalls/socketcall/socketcall01.c | 6 +--
.../kernel/syscalls/socketpair/socketpair01.c | 8 ++--
.../kernel/syscalls/socketpair/socketpair02.c | 2 +-
testcases/kernel/syscalls/splice/splice02.c | 4 +-
testcases/kernel/syscalls/splice/splice03.c | 6 +--
testcases/kernel/syscalls/sysctl/sysctl01.c | 2 +-
testcases/kernel/syscalls/sysctl/sysctl03.c | 4 +-
testcases/kernel/syscalls/sysctl/sysctl04.c | 4 +-
testcases/kernel/syscalls/tee/tee02.c | 6 +--
testcases/kernel/syscalls/umask/umask01.c | 8 ++--
testcases/kernel/syscalls/umount/umount01.c | 4 +-
testcases/kernel/syscalls/umount/umount02.c | 4 +-
testcases/kernel/syscalls/umount/umount03.c | 4 +-
testcases/kernel/syscalls/unlink/unlink05.c | 2 +-
testcases/kernel/syscalls/unlink/unlink07.c | 4 +-
testcases/kernel/syscalls/unlink/unlink08.c | 4 +-
testcases/kernel/syscalls/utimes/utimes01.c | 4 +-
testcases/kernel/syscalls/vmsplice/vmsplice02.c | 6 +--
testcases/kernel/syscalls/wait4/wait401.c | 6 +--
testcases/kernel/syscalls/write/write01.c | 6 +--
testcases/kernel/syscalls/write/write02.c | 2 +-
testcases/kernel/syscalls/write/write04.c | 4 +-
testcases/kernel/syscalls/write/write05.c | 4 +-
testcases/kernel/syscalls/writev/writev01.c | 10 ++---
testcases/kernel/syscalls/writev/writev07.c | 18 ++++----
testcases/network/lib6/in6_01.c | 6 +--
testcases/network/lib6/in6_02.c | 22 +++++-----
201 files changed, 603 insertions(+), 600 deletions(-)
diff --git a/include/tst_test.h b/include/tst_test.h
index 7caf2e174..90938bc29 100644
--- a/include/tst_test.h
+++ b/include/tst_test.h
@@ -188,12 +188,12 @@ void tst_reinit(void);
#define TEST(SCALL) \
do { \
errno = 0; \
- TEST_RETURN = SCALL; \
- TEST_ERRNO = errno; \
+ TST_RET = SCALL; \
+ TST_ERR = errno; \
} while (0)
-extern long TEST_RETURN;
-extern int TEST_ERRNO;
+extern long TST_RET;
+extern int TST_ERR;
extern void *TST_RET_PTR;
@@ -201,7 +201,7 @@ extern void *TST_RET_PTR;
do { \
errno = 0; \
TST_RET_PTR = (void*)SCALL; \
- TEST_ERRNO = errno; \
+ TST_ERR = errno; \
} while (0)
/*
diff --git a/lib/tst_crypto.c b/lib/tst_crypto.c
index 8b3d4bdc7..37d5eb731 100644
--- a/lib/tst_crypto.c
+++ b/lib/tst_crypto.c
@@ -27,15 +27,15 @@
void tst_crypto_open(struct tst_crypto_session *ses)
{
TEST(socket(AF_NETLINK, SOCK_DGRAM, NETLINK_CRYPTO));
- if (TEST_RETURN < 0 && TEST_ERRNO == EPROTONOSUPPORT)
+ if (TST_RET < 0 && TST_ERR == EPROTONOSUPPORT)
tst_brk(TCONF | TTERRNO, "NETLINK_CRYPTO is probably disabled");
- if (TEST_RETURN < 0) {
+ if (TST_RET < 0) {
tst_brk(TBROK | TTERRNO,
"socket(AF_NETLINK, SOCK_DGRAM, NETLINK_CRYPTO)");
}
- ses->fd = TEST_RETURN;
+ ses->fd = TST_RET;
ses->seq_num = 0;
}
@@ -109,7 +109,7 @@ int tst_crypto_del_alg(struct tst_crypto_session *ses,
SAFE_NETLINK_SEND(ses->fd, &nh, alg);
TEST(tst_crypto_recv_ack(ses));
- if (TEST_RETURN != -EBUSY || i >= ses->retries)
+ if (TST_RET != -EBUSY || i >= ses->retries)
break;
if (usleep(1) && errno != EINTR)
@@ -118,5 +118,5 @@ int tst_crypto_del_alg(struct tst_crypto_session *ses,
++i;
}
- return TEST_RETURN;
+ return TST_RET;
}
diff --git a/lib/tst_test.c b/lib/tst_test.c
index 80808854e..008bcefe0 100644
--- a/lib/tst_test.c
+++ b/lib/tst_test.c
@@ -70,6 +70,9 @@ const char *tst_ipc_path = ipc_path;
static char shm_path[1024];
+int TST_ERR;
+long TST_RET;
+
static void do_cleanup(void);
static void do_exit(int ret) __attribute__ ((noreturn));
@@ -213,10 +216,10 @@ static void print_result(const char *file, const int lineno, int ttype,
str_errno = tst_strerrno(errno);
if (ttype & TTERRNO)
- str_errno = tst_strerrno(TEST_ERRNO);
+ str_errno = tst_strerrno(TST_ERR);
if (ttype & TRERRNO) {
- ret = TEST_RETURN < 0 ? -(int)TEST_RETURN : (int)TEST_RETURN;
+ ret = TST_RET < 0 ? -(int)TST_RET : (int)TST_RET;
str_errno = tst_strerrno(ret);
}
diff --git a/testcases/cve/cve-2015-3290.c b/testcases/cve/cve-2015-3290.c
index 631702e2e..435ed44ba 100644
--- a/testcases/cve/cve-2015-3290.c
+++ b/testcases/cve/cve-2015-3290.c
@@ -216,10 +216,10 @@ static void set_ldt(void)
};
TEST(tst_syscall(__NR_modify_ldt, 1, &data_desc, sizeof(data_desc)));
- if (TEST_RETURN == -EINVAL) {
+ if (TST_RET == -EINVAL) {
tst_brk(TCONF | TRERRNO,
"modify_ldt: 16-bit data segments are probably disabled");
- } else if (TEST_RETURN != 0) {
+ } else if (TST_RET != 0) {
tst_brk(TBROK | TRERRNO, "modify_ldt");
}
}
diff --git a/testcases/kernel/crypto/pcrypt_aead01.c b/testcases/kernel/crypto/pcrypt_aead01.c
index 1c2aa8e18..92ce3b2d5 100644
--- a/testcases/kernel/crypto/pcrypt_aead01.c
+++ b/testcases/kernel/crypto/pcrypt_aead01.c
@@ -56,15 +56,15 @@ void run(void)
for (i = 0; i < ATTEMPTS; ++i) {
TEST(tst_crypto_add_alg(&ses, &a));
- if (TEST_RETURN && TEST_RETURN == -ENOENT) {
+ if (TST_RET && TST_RET == -ENOENT) {
tst_brk(TCONF | TRERRNO,
"pcrypt, hmac, sha256, cbc or aes not supported");
}
- if (TEST_RETURN && TEST_RETURN != -EEXIST)
+ if (TST_RET && TST_RET != -EEXIST)
tst_brk(TBROK | TRERRNO, "add_alg");
TEST(tst_crypto_del_alg(&ses, &a));
- if (TEST_RETURN)
+ if (TST_RET)
tst_brk(TBROK | TRERRNO, "del_alg");
}
diff --git a/testcases/kernel/fs/read_all/read_all.c b/testcases/kernel/fs/read_all/read_all.c
index 42babae0c..ac463dba9 100644
--- a/testcases/kernel/fs/read_all/read_all.c
+++ b/testcases/kernel/fs/read_all/read_all.c
@@ -260,7 +260,7 @@ static void maybe_drop_privs(void)
return;
TEST(setgroups(0, NULL));
- if (TEST_RETURN < 0 && TEST_ERRNO != EPERM) {
+ if (TST_RET < 0 && TST_ERR != EPERM) {
tst_brk(TBROK | TTERRNO,
"Failed to clear suplementary group set");
}
@@ -268,11 +268,11 @@ static void maybe_drop_privs(void)
nobody = SAFE_GETPWNAM("nobody");
TEST(setgid(nobody->pw_gid));
- if (TEST_RETURN < 0 && TEST_ERRNO != EPERM)
+ if (TST_RET < 0 && TST_ERR != EPERM)
tst_brk(TBROK | TTERRNO, "Failed to use nobody gid");
TEST(setuid(nobody->pw_uid));
- if (TEST_RETURN < 0 && TEST_ERRNO != EPERM)
+ if (TST_RET < 0 && TST_ERR != EPERM)
tst_brk(TBROK | TTERRNO, "Failed to use nobody uid");
}
diff --git a/testcases/kernel/logging/kmsg/kmsg01.c b/testcases/kernel/logging/kmsg/kmsg01.c
index 7f077c9a3..1c0095bb8 100644
--- a/testcases/kernel/logging/kmsg/kmsg01.c
+++ b/testcases/kernel/logging/kmsg/kmsg01.c
@@ -70,8 +70,8 @@ static int inject_msg(const char *msg)
f = SAFE_OPEN("/dev/kmsg", O_WRONLY);
TEST(write(f, msg, strlen(msg)));
SAFE_CLOSE(f);
- errno = TEST_ERRNO;
- return TEST_RETURN;
+ errno = TST_ERR;
+ return TST_RET;
}
/*
@@ -100,18 +100,18 @@ static int find_msg(int fd, const char *text_to_find, char *buf, int bufsize,
while (1) {
TEST(read(f, msg, MAX_MSGSIZE));
- if (TEST_RETURN < 0) {
- if (TEST_ERRNO == EAGAIN)
+ if (TST_RET < 0) {
+ if (TST_ERR == EAGAIN)
/* there are no more messages */
break;
- else if (TEST_ERRNO == EPIPE)
+ else if (TST_ERR == EPIPE)
/* current message was overwritten */
continue;
else
tst_brk(TBROK|TTERRNO, "err reading /dev/kmsg");
- } else if (TEST_RETURN < bufsize) {
+ } else if (TST_RET < bufsize) {
/* lines from kmsg are not NULL terminated */
- msg[TEST_RETURN] = '\0';
+ msg[TST_RET] = '\0';
if (strstr(msg, text_to_find) != NULL) {
strncpy(buf, msg, bufsize);
msg_found = 1;
@@ -210,10 +210,10 @@ static int timed_read_kmsg(int fd, long timeout_usec)
if (write(pipefd[1], "", 1) == -1)
tst_brk(TBROK|TERRNO, "write to pipe");
TEST(read(fd, msg, MAX_MSGSIZE));
- if (TEST_RETURN == 0)
+ if (TST_RET == 0)
break;
- if (TEST_RETURN == -1 && TEST_ERRNO != EPIPE) {
- ret = TEST_ERRNO;
+ if (TST_RET == -1 && TST_ERR != EPIPE) {
+ ret = TST_ERR;
break;
}
}
@@ -226,11 +226,11 @@ static int timed_read_kmsg(int fd, long timeout_usec)
/* parent reads pipe until it reaches eof or until read times out */
do {
TEST(timed_read(pipefd[0], timeout_usec));
- } while (TEST_RETURN > 0);
+ } while (TST_RET > 0);
SAFE_CLOSE(pipefd[0]);
/* child is blocked, kill it */
- if (TEST_RETURN == -2)
+ if (TST_RET == -2)
kill(child, SIGTERM);
SAFE_WAITPID(child, &status, 0);
if (WIFEXITED(status)) {
@@ -252,11 +252,11 @@ static void test_read_nonblock(void)
fd = SAFE_OPEN("/dev/kmsg", O_RDONLY | O_NONBLOCK);
TEST(timed_read_kmsg(fd, 5000000));
- if (TEST_RETURN == -1 && TEST_ERRNO == EAGAIN)
+ if (TST_RET == -1 && TST_ERR == EAGAIN)
tst_res(TPASS, "non-block read returned EAGAIN");
else
tst_res(TFAIL|TTERRNO, "non-block read returned: %ld",
- TEST_RETURN);
+ TST_RET);
SAFE_CLOSE(fd);
}
@@ -268,10 +268,10 @@ static void test_read_block(void)
fd = SAFE_OPEN("/dev/kmsg", O_RDONLY);
TEST(timed_read_kmsg(fd, 500000));
- if (TEST_RETURN == -2)
+ if (TST_RET == -2)
tst_res(TPASS, "read blocked");
else
- tst_res(TFAIL|TTERRNO, "read returned: %ld", TEST_RETURN);
+ tst_res(TFAIL|TTERRNO, "read returned: %ld", TST_RET);
SAFE_CLOSE(fd);
}
@@ -284,10 +284,10 @@ static void test_partial_read(void)
fd = SAFE_OPEN("/dev/kmsg", O_RDONLY | O_NONBLOCK);
TEST(read(fd, msg, 1));
- if (TEST_RETURN < 0)
+ if (TST_RET < 0)
tst_res(TPASS|TTERRNO, "read failed as expected");
else
- tst_res(TFAIL, "read returned: %ld", TEST_RETURN);
+ tst_res(TFAIL, "read returned: %ld", TST_RET);
SAFE_CLOSE(fd);
}
@@ -369,10 +369,10 @@ static void test_read_returns_first_message(void)
TEST(read(fd, msg, sizeof(msg)));
SAFE_CLOSE(fd);
- if (TEST_RETURN != -1)
+ if (TST_RET != -1)
break;
- if (TEST_ERRNO == EPIPE)
+ if (TST_ERR == EPIPE)
tst_res(TINFO, "msg overwritten, retrying");
else
tst_res(TFAIL|TTERRNO, "read failed");
@@ -438,16 +438,16 @@ static void test_messages_overwritten(void)
/* first message is overwritten, so this next read should fail */
TEST(read(fd, msg, sizeof(msg)));
- if (TEST_RETURN == -1 && TEST_ERRNO == EPIPE)
+ if (TST_RET == -1 && TST_ERR == EPIPE)
tst_res(TPASS, "read failed with EPIPE as expected");
else
- tst_res(TFAIL|TTERRNO, "read returned: %ld", TEST_RETURN);
+ tst_res(TFAIL|TTERRNO, "read returned: %ld", TST_RET);
/* seek position is updated to the next available record */
tst_res(TINFO, "TEST: Subsequent reads() will return available "
"records again");
if (find_msg(fd, "", msg, sizeof(msg), 1) != 0)
- tst_res(TFAIL|TTERRNO, "read returned: %ld", TEST_RETURN);
+ tst_res(TFAIL|TTERRNO, "read returned: %ld", TST_RET);
else
tst_res(TPASS, "after EPIPE read returned next record");
@@ -459,10 +459,10 @@ static int read_msg_seqno(int fd, unsigned long *seqno)
char msg[MAX_MSGSIZE];
TEST(read(fd, msg, sizeof(msg)));
- if (TEST_RETURN == -1 && TEST_ERRNO != EPIPE)
+ if (TST_RET == -1 && TST_ERR != EPIPE)
tst_brk(TBROK|TTERRNO, "failed to read /dev/kmsg");
- if (TEST_ERRNO == EPIPE)
+ if (TST_ERR == EPIPE)
return -1;
if (get_msg_fields(msg, NULL, seqno) != 0) {
diff --git a/testcases/kernel/mem/hugetlb/hugemmap/hugemmap06.c b/testcases/kernel/mem/hugetlb/hugemmap/hugemmap06.c
index 550a91e03..a230bb798 100644
--- a/testcases/kernel/mem/hugetlb/hugemmap/hugemmap06.c
+++ b/testcases/kernel/mem/hugetlb/hugemmap/hugemmap06.c
@@ -111,7 +111,7 @@ static void do_mmap(unsigned int j LTP_ATTRIBUTE_UNUSED)
mmap_sz[i].addr = addr;
TEST(pthread_create(&tid[i], NULL, thr, &mmap_sz[i]));
- if (TEST_RETURN)
+ if (TST_RET)
tst_brk(TBROK | TRERRNO,
"pthread_create failed");
@@ -128,7 +128,7 @@ static void do_mmap(unsigned int j LTP_ATTRIBUTE_UNUSED)
for (i = 0; i < ARSZ; ++i) {
TEST(pthread_join(tid[i], NULL));
- if (TEST_RETURN)
+ if (TST_RET)
tst_brk(TBROK | TRERRNO,
"pthread_join failed");
}
diff --git a/testcases/kernel/mem/hugetlb/hugeshmctl/hugeshmctl02.c b/testcases/kernel/mem/hugetlb/hugeshmctl/hugeshmctl02.c
index af2bf4a3a..4009fd804 100644
--- a/testcases/kernel/mem/hugetlb/hugeshmctl/hugeshmctl02.c
+++ b/testcases/kernel/mem/hugetlb/hugeshmctl/hugeshmctl02.c
@@ -72,12 +72,12 @@ static void test_hugeshmctl(void)
for (i = 0; i < ARRAY_SIZE(tcases); i++) {
TEST(shmctl(*(tcases[i].shmid), tcases[i].cmd, tcases[i].sbuf));
- if (TEST_RETURN != -1) {
+ if (TST_RET != -1) {
tst_res(TFAIL, "shmctl succeeded "
"unexpectedly");
continue;
}
- if (TEST_ERRNO == tcases[i].error) {
+ if (TST_ERR == tcases[i].error) {
tst_res(TPASS | TTERRNO, "shmctl failed "
"as expected");
} else {
diff --git a/testcases/kernel/mem/hugetlb/hugeshmctl/hugeshmctl03.c b/testcases/kernel/mem/hugetlb/hugeshmctl/hugeshmctl03.c
index 63dc4ce6d..00872e9d6 100644
--- a/testcases/kernel/mem/hugetlb/hugeshmctl/hugeshmctl03.c
+++ b/testcases/kernel/mem/hugetlb/hugeshmctl/hugeshmctl03.c
@@ -98,12 +98,12 @@ static void do_child(void)
for (i = 0; i < ARRAY_SIZE(tcases); i++) {
TEST(shmctl(*(tcases[i].shmid), tcases[i].cmd, tcases[i].sbuf));
- if (TEST_RETURN != -1) {
+ if (TST_RET != -1) {
tst_res(TFAIL, "shmctl succeeded "
"unexpectedly");
continue;
}
- if (TEST_ERRNO == tcases[i].error)
+ if (TST_ERR == tcases[i].error)
tst_res(TPASS | TTERRNO, "shmctl failed "
"as expected");
else
diff --git a/testcases/kernel/mem/hugetlb/hugeshmget/hugeshmget02.c b/testcases/kernel/mem/hugetlb/hugeshmget/hugeshmget02.c
index 8df943e0e..d1c0e64b8 100644
--- a/testcases/kernel/mem/hugetlb/hugeshmget/hugeshmget02.c
+++ b/testcases/kernel/mem/hugetlb/hugeshmget/hugeshmget02.c
@@ -66,12 +66,12 @@ static void test_hugeshmget(unsigned int i)
TEST(shmget(*(tcases[i].skey), tcases[i].size_coe * shm_size,
tcases[i].flags));
- if (TEST_RETURN != -1) {
+ if (TST_RET != -1) {
tst_res(TFAIL, "shmget succeeded unexpectedly");
return;
}
- if (TEST_ERRNO != tcases[i].error) {
+ if (TST_ERR != tcases[i].error) {
tst_res(TFAIL | TTERRNO,
"shmget failed unexpectedly, expected %s",
tst_strerrno(tcases[i].error));
diff --git a/testcases/kernel/mem/hugetlb/hugeshmget/hugeshmget03.c b/testcases/kernel/mem/hugetlb/hugeshmget/hugeshmget03.c
index 2ea3df94a..733a25cdb 100644
--- a/testcases/kernel/mem/hugetlb/hugeshmget/hugeshmget03.c
+++ b/testcases/kernel/mem/hugetlb/hugeshmget/hugeshmget03.c
@@ -49,11 +49,11 @@ static void test_hugeshmget(void)
{
TEST(shmget(IPC_PRIVATE, shm_size,
SHM_HUGETLB | IPC_CREAT | IPC_EXCL | SHM_RW));
- if (TEST_RETURN != -1) {
+ if (TST_RET != -1) {
tst_res(TFAIL, "shmget succeeded unexpectedly");
return;
}
- if (TEST_ERRNO == ENOSPC)
+ if (TST_ERR == ENOSPC)
tst_res(TPASS | TTERRNO, "shmget failed as expected");
else
tst_res(TFAIL | TTERRNO, "shmget failed unexpectedly "
diff --git a/testcases/kernel/mem/hugetlb/hugeshmget/hugeshmget05.c b/testcases/kernel/mem/hugetlb/hugeshmget/hugeshmget05.c
index ae28bb35d..841f527b7 100644
--- a/testcases/kernel/mem/hugetlb/hugeshmget/hugeshmget05.c
+++ b/testcases/kernel/mem/hugetlb/hugeshmget/hugeshmget05.c
@@ -63,11 +63,11 @@ static void test_hugeshmget(void)
static void do_child(void)
{
TEST(shmget(shmkey, shm_size, SHM_HUGETLB | SHM_RW));
- if (TEST_RETURN != -1) {
+ if (TST_RET != -1) {
tst_res(TFAIL, "shmget succeeded unexpectedly");
return;
}
- if (TEST_ERRNO == EACCES)
+ if (TST_ERR == EACCES)
tst_res(TPASS | TTERRNO, "shmget failed as expected");
else
tst_res(TFAIL | TTERRNO, "shmget failed unexpectedly "
diff --git a/testcases/kernel/mem/ksm/ksm05.c b/testcases/kernel/mem/ksm/ksm05.c
index 2f1ca3559..f715dc5aa 100644
--- a/testcases/kernel/mem/ksm/ksm05.c
+++ b/testcases/kernel/mem/ksm/ksm05.c
@@ -67,7 +67,7 @@ static void test_ksm(void)
sa.sa_handler = sighandler;
sa.sa_flags = 0;
TEST(sigaction(SIGSEGV, &sa, NULL));
- if (TEST_RETURN == -1)
+ if (TST_RET == -1)
tst_brk(TBROK | TRERRNO,
"SIGSEGV signal setup failed");
diff --git a/testcases/kernel/mem/lib/mem.c b/testcases/kernel/mem/lib/mem.c
index f36b33a83..ce21bc7a1 100644
--- a/testcases/kernel/mem/lib/mem.c
+++ b/testcases/kernel/mem/lib/mem.c
@@ -91,13 +91,13 @@ static void child_alloc(int testcase, int lite, int threads)
for (i = 0; i < threads; i++) {
TEST(pthread_create(&th[i], NULL, child_alloc_thread,
(void *)((long)testcase)));
- if (TEST_RETURN) {
+ if (TST_RET) {
tst_res(TINFO | TRERRNO, "pthread_create");
/*
* Keep going if thread other than first fails to
* spawn due to lack of resources.
*/
- if (i == 0 || TEST_RETURN != EAGAIN)
+ if (i == 0 || TST_RET != EAGAIN)
goto out;
}
}
diff --git a/testcases/kernel/mem/thp/thp01.c b/testcases/kernel/mem/thp/thp01.c
index 2f2bb2bdb..b2ad921c5 100644
--- a/testcases/kernel/mem/thp/thp01.c
+++ b/testcases/kernel/mem/thp/thp01.c
@@ -78,7 +78,7 @@ static void thp_test(void)
args[bst->mid] = NULL;
TEST(execvp("true", args));
- if (TEST_ERRNO != E2BIG)
+ if (TST_ERR != E2BIG)
tst_brk(TBROK | TTERRNO, "execvp(\"true\", ...)");
bst->left = prev_left;
bst->right = bst->mid;
@@ -98,7 +98,7 @@ static void thp_test(void)
if (pid == 0) {
args[bst->left] = NULL;
TEST(execvp("true", args));
- if (TEST_ERRNO != E2BIG)
+ if (TST_ERR != E2BIG)
tst_brk(TBROK | TTERRNO, "execvp(\"true\", ...)");
exit(0);
}
diff --git a/testcases/kernel/syscalls/access/access01.c b/testcases/kernel/syscalls/access/access01.c
index b67983210..f36a9d273 100644
--- a/testcases/kernel/syscalls/access/access01.c
+++ b/testcases/kernel/syscalls/access/access01.c
@@ -252,7 +252,7 @@ static struct tcase {
static void verify_success(struct tcase *tc, const char *user)
{
- if (TEST_RETURN == -1) {
+ if (TST_RET == -1) {
tst_res(TFAIL | TTERRNO,
"access(%s, %s) as %s failed unexpectedly",
tc->fname, tc->name, user);
@@ -264,13 +264,13 @@ static void verify_success(struct tcase *tc, const char *user)
static void verify_failure(struct tcase *tc, const char *user)
{
- if (TEST_RETURN != -1) {
+ if (TST_RET != -1) {
tst_res(TFAIL, "access(%s, %s) as %s succeded unexpectedly",
tc->fname, tc->name, user);
return;
}
- if (TEST_ERRNO != tc->exp_errno) {
+ if (TST_ERR != tc->exp_errno) {
tst_res(TFAIL | TTERRNO,
"access(%s, %s) as %s should fail with %s",
tc->fname, tc->name, user,
diff --git a/testcases/kernel/syscalls/access/access02.c b/testcases/kernel/syscalls/access/access02.c
index 78449ca0b..5030288e8 100644
--- a/testcases/kernel/syscalls/access/access02.c
+++ b/testcases/kernel/syscalls/access/access02.c
@@ -75,7 +75,7 @@ static void access_test(struct tcase *tc, const char *user)
TEST(access(tc->pathname, tc->mode));
- if (TEST_RETURN == -1) {
+ if (TST_RET == -1) {
tst_res(TFAIL | TTERRNO, "access(%s, %s) as %s failed",
tc->pathname, tc->name, user);
return;
@@ -90,7 +90,7 @@ static void access_test(struct tcase *tc, const char *user)
*/
TEST(stat(tc->targetname, &stat_buf));
- if (TEST_RETURN == -1) {
+ if (TST_RET == -1) {
tst_res(TFAIL | TTERRNO, "stat(%s) as %s failed",
tc->targetname, user);
return;
@@ -105,14 +105,14 @@ static void access_test(struct tcase *tc, const char *user)
*/
TEST(open(tc->targetname, O_RDONLY));
- if (TEST_RETURN == -1) {
+ if (TST_RET == -1) {
tst_res(TFAIL | TTERRNO,
"open %s with O_RDONLY as %s failed",
tc->targetname, user);
return;
}
- SAFE_CLOSE(TEST_RETURN);
+ SAFE_CLOSE(TST_RET);
break;
case W_OK:
@@ -123,14 +123,14 @@ static void access_test(struct tcase *tc, const char *user)
*/
TEST(open(tc->targetname, O_WRONLY));
- if (TEST_RETURN == -1) {
+ if (TST_RET == -1) {
tst_res(TFAIL | TTERRNO,
"open %s with O_WRONLY as %s failed",
tc->targetname, user);
return;
}
- SAFE_CLOSE(TEST_RETURN);
+ SAFE_CLOSE(TST_RET);
break;
case X_OK:
@@ -143,7 +143,7 @@ static void access_test(struct tcase *tc, const char *user)
TEST(system(command));
- if (TEST_RETURN != 0) {
+ if (TST_RET != 0) {
tst_res(TFAIL | TTERRNO, "execute %s as %s failed",
tc->targetname, user);
return;
diff --git a/testcases/kernel/syscalls/access/access03.c b/testcases/kernel/syscalls/access/access03.c
index bba3068b0..13ee15fd0 100644
--- a/testcases/kernel/syscalls/access/access03.c
+++ b/testcases/kernel/syscalls/access/access03.c
@@ -49,13 +49,13 @@ static void access_test(struct tcase *tc, const char *user)
{
TEST(access(tc->addr, tc->mode));
- if (TEST_RETURN != -1) {
+ if (TST_RET != -1) {
tst_res(TFAIL, "access(%p, %s) as %s succeeded unexpectedly",
tc->addr, tc->name, user);
return;
}
- if (TEST_ERRNO != EFAULT) {
+ if (TST_ERR != EFAULT) {
tst_res(TFAIL | TTERRNO,
"access(%p, %s) as %s should fail with EFAULT",
tc->addr, tc->name, user);
diff --git a/testcases/kernel/syscalls/access/access04.c b/testcases/kernel/syscalls/access/access04.c
index 626e6df2c..401a348a4 100644
--- a/testcases/kernel/syscalls/access/access04.c
+++ b/testcases/kernel/syscalls/access/access04.c
@@ -72,12 +72,12 @@ static void access_test(struct tcase *tc, const char *user)
{
TEST(access(tc->pathname, tc->mode));
- if (TEST_RETURN != -1) {
+ if (TST_RET != -1) {
tst_res(TFAIL, "access as %s succeeded unexpectedly", user);
return;
}
- if (tc->exp_errno != TEST_ERRNO) {
+ if (tc->exp_errno != TST_ERR) {
tst_res(TFAIL | TTERRNO,
"access as %s should fail with %s",
user, tst_strerrno(tc->exp_errno));
diff --git a/testcases/kernel/syscalls/add_key/add_key01.c b/testcases/kernel/syscalls/add_key/add_key01.c
index 6756702b1..e19cfe772 100644
--- a/testcases/kernel/syscalls/add_key/add_key01.c
+++ b/testcases/kernel/syscalls/add_key/add_key01.c
@@ -32,7 +32,7 @@
static void verify_add_key(void)
{
TEST(add_key("keyring", "wjkey", NULL, 0, KEY_SPEC_THREAD_KEYRING));
- if (TEST_RETURN == -1)
+ if (TST_RET == -1)
tst_res(TFAIL | TTERRNO, "add_key call failed");
else
tst_res(TPASS, "add_key call succeeded");
diff --git a/testcases/kernel/syscalls/add_key/add_key02.c b/testcases/kernel/syscalls/add_key/add_key02.c
index 369e828e3..6d19ff2d8 100644
--- a/testcases/kernel/syscalls/add_key/add_key02.c
+++ b/testcases/kernel/syscalls/add_key/add_key02.c
@@ -63,20 +63,20 @@ static void verify_add_key(unsigned int i)
TEST(add_key(tcases[i].type,
"abc:def", NULL, tcases[i].plen, KEY_SPEC_PROCESS_KEYRING));
- if (TEST_RETURN != -1) {
+ if (TST_RET != -1) {
tst_res(TFAIL,
"add_key() with key type '%s' unexpectedly succeeded",
tcases[i].type);
return;
}
- if (TEST_ERRNO == EFAULT) {
+ if (TST_ERR == EFAULT) {
tst_res(TPASS, "received expected EFAULT with key type '%s'",
tcases[i].type);
return;
}
- if (TEST_ERRNO == ENODEV) {
+ if (TST_ERR == ENODEV) {
tst_res(TCONF, "kernel doesn't support key type '%s'",
tcases[i].type);
return;
@@ -87,7 +87,7 @@ static void verify_add_key(unsigned int i)
* no asymmetric key parsers registered. In that case, attempting to
* add a key of type asymmetric will fail with EBADMSG.
*/
- if (TEST_ERRNO == EBADMSG && !strcmp(tcases[i].type, "asymmetric")) {
+ if (TST_ERR == EBADMSG && !strcmp(tcases[i].type, "asymmetric")) {
tst_res(TCONF, "no asymmetric key parsers are registered");
return;
}
diff --git a/testcases/kernel/syscalls/add_key/add_key03.c b/testcases/kernel/syscalls/add_key/add_key03.c
index 27edcb27f..95ac2ee6e 100644
--- a/testcases/kernel/syscalls/add_key/add_key03.c
+++ b/testcases/kernel/syscalls/add_key/add_key03.c
@@ -38,21 +38,21 @@ static key_serial_t create_keyring(const char *description)
{
TEST(add_key("keyring", description, NULL, 0,
KEY_SPEC_PROCESS_KEYRING));
- if (TEST_RETURN < 0) {
+ if (TST_RET < 0) {
tst_brk(TBROK | TTERRNO,
"unable to create keyring '%s'", description);
}
- return TEST_RETURN;
+ return TST_RET;
}
static key_serial_t get_keyring_id(key_serial_t special_id)
{
TEST(keyctl(KEYCTL_GET_KEYRING_ID, special_id, 1));
- if (TEST_RETURN < 0) {
+ if (TST_RET < 0) {
tst_brk(TBROK | TTERRNO,
"unable to get ID of keyring %d", special_id);
}
- return TEST_RETURN;
+ return TST_RET;
}
static void do_test(void)
diff --git a/testcases/kernel/syscalls/add_key/add_key04.c b/testcases/kernel/syscalls/add_key/add_key04.c
index debf34942..1872cd58f 100644
--- a/testcases/kernel/syscalls/add_key/add_key04.c
+++ b/testcases/kernel/syscalls/add_key/add_key04.c
@@ -49,7 +49,7 @@ static void do_test(void)
int status;
TEST(keyctl(KEYCTL_JOIN_SESSION_KEYRING, NULL));
- if (TEST_RETURN < 0)
+ if (TST_RET < 0)
tst_brk(TBROK | TTERRNO, "failed to join new session keyring");
if (SAFE_FORK() == 0) {
@@ -61,7 +61,7 @@ static void do_test(void)
sprintf(description, "keyring%d", i);
TEST(add_key("keyring", description, NULL, 0,
KEY_SPEC_SESSION_KEYRING));
- if (TEST_RETURN < 0) {
+ if (TST_RET < 0) {
tst_brk(TBROK | TTERRNO,
"unable to create keyring %d", i);
}
@@ -69,7 +69,7 @@ static void do_test(void)
TEST(add_key("user", "userkey", payload, sizeof(payload),
KEY_SPEC_SESSION_KEYRING));
- if (TEST_RETURN < 0)
+ if (TST_RET < 0)
tst_brk(TBROK | TTERRNO, "unable to create user key");
exit(0);
diff --git a/testcases/kernel/syscalls/brk/brk01.c b/testcases/kernel/syscalls/brk/brk01.c
index c95fd0d9b..aee340e10 100644
--- a/testcases/kernel/syscalls/brk/brk01.c
+++ b/testcases/kernel/syscalls/brk/brk01.c
@@ -45,7 +45,7 @@ void verify_brk(void)
TEST(brk((void *)new_brk));
- if (TEST_RETURN == -1) {
+ if (TST_RET == -1) {
tst_res(TFAIL | TERRNO, "brk() failed");
return;
}
diff --git a/testcases/kernel/syscalls/chdir/chdir03.c b/testcases/kernel/syscalls/chdir/chdir03.c
index 12924664e..d5f38190e 100644
--- a/testcases/kernel/syscalls/chdir/chdir03.c
+++ b/testcases/kernel/syscalls/chdir/chdir03.c
@@ -47,12 +47,12 @@ void verify_chdir(void)
TEST(chdir(DIRNAME));
- if (TEST_RETURN != -1) {
+ if (TST_RET != -1) {
tst_res(TFAIL, "chdir() succeeded unexpectedly");
return;
}
- if (TEST_ERRNO != EACCES) {
+ if (TST_ERR != EACCES) {
tst_res(TFAIL | TTERRNO,
"chdir() should fail with EACCES");
return;
diff --git a/testcases/kernel/syscalls/chmod/chmod06.c b/testcases/kernel/syscalls/chmod/chmod06.c
index ad0a3615b..e5bb58fc5 100644
--- a/testcases/kernel/syscalls/chmod/chmod06.c
+++ b/testcases/kernel/syscalls/chmod/chmod06.c
@@ -90,12 +90,12 @@ void run(unsigned int i)
if (tc[i].cleanup)
tc[i].cleanup();
- if (TEST_RETURN != -1) {
+ if (TST_RET != -1) {
tst_res(TFAIL, "chmod succeeded unexpectedly");
return;
}
- if (TEST_ERRNO == tc[i].exp_errno) {
+ if (TST_ERR == tc[i].exp_errno) {
tst_res(TPASS | TTERRNO, "chmod failed as expected");
} else {
tst_res(TFAIL | TTERRNO, "chmod failed unexpectedly; "
diff --git a/testcases/kernel/syscalls/clock_getres/clock_getres01.c b/testcases/kernel/syscalls/clock_getres/clock_getres01.c
index 989683ff6..da37b8ae7 100644
--- a/testcases/kernel/syscalls/clock_getres/clock_getres01.c
+++ b/testcases/kernel/syscalls/clock_getres/clock_getres01.c
@@ -59,8 +59,8 @@ static void do_test(unsigned int i)
{
TEST(clock_getres(tcase[i].clk_id, tcase[i].res));
- if (TEST_RETURN != tcase[i].ret) {
- if (TEST_ERRNO == EINVAL) {
+ if (TST_RET != tcase[i].ret) {
+ if (TST_ERR == EINVAL) {
tst_res(TCONF, "clock_getres(%s, ...) NO SUPPORTED", tcase[i].name);
return;
}
@@ -69,10 +69,10 @@ static void do_test(unsigned int i)
return;
}
- if (TEST_ERRNO != tcase[i].err) {
+ if (TST_ERR != tcase[i].err) {
tst_res(TFAIL,
"clock_getres(%s, ...) failed unexpectedly: %s, expected: %s",
- tcase[i].name, tst_strerrno(TEST_ERRNO), tst_strerrno(tcase[i].err));
+ tcase[i].name, tst_strerrno(TST_ERR), tst_strerrno(tcase[i].err));
return;
}
diff --git a/testcases/kernel/syscalls/clock_nanosleep/clock_nanosleep01.c b/testcases/kernel/syscalls/clock_nanosleep/clock_nanosleep01.c
index 9ddc9a7d8..2be211bd6 100644
--- a/testcases/kernel/syscalls/clock_nanosleep/clock_nanosleep01.c
+++ b/testcases/kernel/syscalls/clock_nanosleep/clock_nanosleep01.c
@@ -133,15 +133,15 @@ static void do_test(unsigned int i)
}
}
- if (TEST_RETURN != tc->exp_ret) {
+ if (TST_RET != tc->exp_ret) {
tst_res(TFAIL | TTERRNO, "returned %ld, expected %d,"
- " expected errno: %s (%d)", TEST_RETURN,
+ " expected errno: %s (%d)", TST_RET,
tc->exp_ret, tst_strerrno(tc->exp_err), tc->exp_err);
return;
}
tst_res(TPASS, "returned %s (%ld)",
- tst_strerrno(TEST_RETURN), TEST_RETURN);
+ tst_strerrno(TST_RET), TST_RET);
}
static struct tst_test test = {
diff --git a/testcases/kernel/syscalls/clock_nanosleep/clock_nanosleep02.c b/testcases/kernel/syscalls/clock_nanosleep/clock_nanosleep02.c
index 9b0b24318..a79ef5e90 100644
--- a/testcases/kernel/syscalls/clock_nanosleep/clock_nanosleep02.c
+++ b/testcases/kernel/syscalls/clock_nanosleep/clock_nanosleep02.c
@@ -34,9 +34,9 @@ int sample_fn(int clk_id, long long usec)
tst_timer_stop();
tst_timer_sample();
- if (TEST_RETURN != 0) {
+ if (TST_RET != 0) {
tst_res(TFAIL | TERRNO,
- "nanosleep() returned %li", TEST_RETURN);
+ "nanosleep() returned %li", TST_RET);
return 1;
}
diff --git a/testcases/kernel/syscalls/clock_nanosleep2/clock_nanosleep2_01.c b/testcases/kernel/syscalls/clock_nanosleep2/clock_nanosleep2_01.c
index 3d8288c2a..244508e0c 100644
--- a/testcases/kernel/syscalls/clock_nanosleep2/clock_nanosleep2_01.c
+++ b/testcases/kernel/syscalls/clock_nanosleep2/clock_nanosleep2_01.c
@@ -50,7 +50,7 @@ static void verify_clock_nanosleep2(void)
TEST(clock_nanosleep2(CLOCK_TO_USE, TIMER_ABSTIME, &ts, NULL));
- if (TEST_RETURN)
+ if (TST_RET)
tst_res(TFAIL | TTERRNO, "clock_nanosleep2() failed");
else
tst_res(TPASS, "clock_nanosleep2() passed");
diff --git a/testcases/kernel/syscalls/clone/clone08.c b/testcases/kernel/syscalls/clone/clone08.c
index a228b2f73..a567340d1 100644
--- a/testcases/kernel/syscalls/clone/clone08.c
+++ b/testcases/kernel/syscalls/clone/clone08.c
@@ -97,13 +97,13 @@ static long clone_child(const struct test_case *t)
TEST(ltp_clone7(t->flags, t->do_child, NULL, CHILD_STACK_SIZE,
child_stack, &ptid, NULL, &ctid));
- if (TEST_RETURN == -1 && TTERRNO == ENOSYS)
+ if (TST_RET == -1 && TTERRNO == ENOSYS)
tst_brk(TCONF, "clone does not support 7 args");
- if (TEST_RETURN == -1)
+ if (TST_RET == -1)
tst_brk(TBROK | TTERRNO, "%s clone() failed", t->name);
- return TEST_RETURN;
+ return TST_RET;
}
static void test_clone_parent(int t)
diff --git a/testcases/kernel/syscalls/clone/clone09.c b/testcases/kernel/syscalls/clone/clone09.c
index a6ebdd7a1..b133c668b 100644
--- a/testcases/kernel/syscalls/clone/clone09.c
+++ b/testcases/kernel/syscalls/clone/clone09.c
@@ -56,13 +56,13 @@ static long clone_child(void)
{
TEST(ltp_clone(flags, newnet, NULL, CHILD_STACK_SIZE, child_stack));
- if (TEST_RETURN == -1 && TEST_ERRNO == EINVAL)
+ if (TST_RET == -1 && TST_ERR == EINVAL)
tst_brk(TCONF, "CONFIG_NET_NS was disabled");
- if (TEST_RETURN == -1)
+ if (TST_RET == -1)
tst_brk(TBROK | TTERRNO, "clone(CLONE_NEWNET) failed");
- return TEST_RETURN;
+ return TST_RET;
}
static void do_test(void)
diff --git a/testcases/kernel/syscalls/copy_file_range/copy_file_range01.c b/testcases/kernel/syscalls/copy_file_range/copy_file_range01.c
index 25c701f27..2bca8a403 100644
--- a/testcases/kernel/syscalls/copy_file_range/copy_file_range01.c
+++ b/testcases/kernel/syscalls/copy_file_range/copy_file_range01.c
@@ -176,14 +176,14 @@ static void test_one(size_t len, loff_t *off_in, loff_t *off_out)
do {
TEST(tst_syscall(__NR_copy_file_range, fd_in, off_in, fd_out,
off_out, to_copy, 0));
- if (TEST_RETURN == -1) {
+ if (TST_RET == -1) {
tst_res(TFAIL | TTERRNO, "copy_file_range() failed");
SAFE_CLOSE(fd_in);
SAFE_CLOSE(fd_out);
return;
}
- to_copy -= TEST_RETURN;
+ to_copy -= TST_RET;
} while (to_copy > 0);
ret = check_file_content(TEST_FILE_1, TEST_FILE_2,
diff --git a/testcases/kernel/syscalls/creat/creat04.c b/testcases/kernel/syscalls/creat/creat04.c
index ebcaa17b7..623ede0d9 100644
--- a/testcases/kernel/syscalls/creat/creat04.c
+++ b/testcases/kernel/syscalls/creat/creat04.c
@@ -48,13 +48,13 @@ static void child_fn(unsigned int i)
TEST(creat(tcases[i].fname, 0444));
- if (TEST_RETURN != -1) {
+ if (TST_RET != -1) {
SAFE_UNLINK(tcases[i].fname);
tst_res(TFAIL, "call succeeded unexpectedly");
return;
}
- if (TEST_ERRNO != EACCES) {
+ if (TST_ERR != EACCES) {
tst_res(TFAIL | TTERRNO, "Expected EACCES");
return;
}
diff --git a/testcases/kernel/syscalls/creat/creat05.c b/testcases/kernel/syscalls/creat/creat05.c
index 154f1a259..037a1133d 100644
--- a/testcases/kernel/syscalls/creat/creat05.c
+++ b/testcases/kernel/syscalls/creat/creat05.c
@@ -39,13 +39,13 @@ static void verify_creat(void)
{
TEST(creat("filename", 0666));
- if (TEST_RETURN != -1) {
+ if (TST_RET != -1) {
tst_res(TFAIL, "call succeeded unexpectedly");
- SAFE_CLOSE(TEST_RETURN);
+ SAFE_CLOSE(TST_RET);
return;
}
- if (TEST_ERRNO == EMFILE)
+ if (TST_ERR == EMFILE)
tst_res(TPASS, "creat() failed with EMFILE");
else
tst_res(TFAIL | TTERRNO, "Expected EMFILE");
diff --git a/testcases/kernel/syscalls/creat/creat06.c b/testcases/kernel/syscalls/creat/creat06.c
index 45642f097..146d518ae 100644
--- a/testcases/kernel/syscalls/creat/creat06.c
+++ b/testcases/kernel/syscalls/creat/creat06.c
@@ -109,12 +109,12 @@ static void verify_creat(unsigned int i)
if (tcases[i].cleanup != NULL)
tcases[i].cleanup();
- if (TEST_RETURN != -1) {
+ if (TST_RET != -1) {
tst_res(TFAIL, "call succeeded unexpectedly");
return;
}
- if (TEST_ERRNO == tcases[i].error) {
+ if (TST_ERR == tcases[i].error) {
tst_res(TPASS | TTERRNO, "got expected failure");
return;
}
diff --git a/testcases/kernel/syscalls/creat/creat07.c b/testcases/kernel/syscalls/creat/creat07.c
index a01660402..435e5d54c 100644
--- a/testcases/kernel/syscalls/creat/creat07.c
+++ b/testcases/kernel/syscalls/creat/creat07.c
@@ -46,12 +46,12 @@ static void verify_creat(void)
TEST(creat(TEST_APP, O_WRONLY));
- if (TEST_RETURN != -1) {
+ if (TST_RET != -1) {
tst_res(TFAIL, "creat() succeeded unexpectedly");
return;
}
- if (TEST_ERRNO == ETXTBSY)
+ if (TST_ERR == ETXTBSY)
tst_res(TPASS, "creat() received EXTBSY");
else
tst_res(TFAIL | TTERRNO, "creat() failed unexpectedly");
diff --git a/testcases/kernel/syscalls/epoll_ctl/epoll_ctl01.c b/testcases/kernel/syscalls/epoll_ctl/epoll_ctl01.c
index f3599de50..e837913fb 100644
--- a/testcases/kernel/syscalls/epoll_ctl/epoll_ctl01.c
+++ b/testcases/kernel/syscalls/epoll_ctl/epoll_ctl01.c
@@ -135,7 +135,7 @@ end:
static void opera_epoll_ctl(int opt, int fd, struct epoll_event *epvs)
{
TEST(epoll_ctl(epfd, opt, fd, epvs));
- if (TEST_RETURN == -1)
+ if (TST_RET == -1)
tst_brk(TBROK | TTERRNO, "epoll_ctl() fails with op %i", opt);
}
diff --git a/testcases/kernel/syscalls/epoll_ctl/epoll_ctl02.c b/testcases/kernel/syscalls/epoll_ctl/epoll_ctl02.c
index fcbdcac1a..ce9b55ed9 100644
--- a/testcases/kernel/syscalls/epoll_ctl/epoll_ctl02.c
+++ b/testcases/kernel/syscalls/epoll_ctl/epoll_ctl02.c
@@ -81,7 +81,7 @@ static void setup(void)
events[1].data.fd = fd[1];
TEST(epoll_ctl(epfd, EPOLL_CTL_ADD, fd[0], &events[0]));
- if (TEST_RETURN == -1)
+ if (TST_RET == -1)
tst_brk(TFAIL | TTERRNO, "epoll_ctl() fails to init");
}
@@ -102,12 +102,12 @@ static void verify_epoll_ctl(unsigned int n)
struct testcase *tc = &tcases[n];
TEST(epoll_ctl(*tc->epfds, tc->opt, *tc->fds, tc->ts_event));
- if (TEST_RETURN != -1) {
+ if (TST_RET != -1) {
tst_res(TFAIL, "epoll_ctl() succeeds unexpectedly");
return;
}
- if (tc->exp_err == TEST_ERRNO) {
+ if (tc->exp_err == TST_ERR) {
tst_res(TPASS | TTERRNO, "epoll_ctl() fails as expected");
} else {
tst_res(TFAIL | TTERRNO,
diff --git a/testcases/kernel/syscalls/epoll_wait/epoll_wait01.c b/testcases/kernel/syscalls/epoll_wait/epoll_wait01.c
index 7d28b5fbc..0ded12765 100644
--- a/testcases/kernel/syscalls/epoll_wait/epoll_wait01.c
+++ b/testcases/kernel/syscalls/epoll_wait/epoll_wait01.c
@@ -113,14 +113,14 @@ static void verify_epollout(void)
TEST(epoll_wait(epfd, &ret_evs, 1, -1));
- if (TEST_RETURN == -1) {
+ if (TST_RET == -1) {
tst_res(TFAIL | TTERRNO, "epoll_wait() epollout failed");
return;
}
- if (TEST_RETURN != 1) {
+ if (TST_RET != 1) {
tst_res(TFAIL, "epoll_wait() returned %li, expected 1",
- TEST_RETURN);
+ TST_RET);
return;
}
@@ -151,14 +151,14 @@ static void verify_epollin(void)
TEST(epoll_wait(epfd, &ret_evs, 1, -1));
- if (TEST_RETURN == -1) {
+ if (TST_RET == -1) {
tst_res(TFAIL | TTERRNO, "epoll_wait() epollin failed");
goto end;
}
- if (TEST_RETURN != 1) {
+ if (TST_RET != 1) {
tst_res(TFAIL, "epoll_wait() returned %li, expected 1",
- TEST_RETURN);
+ TST_RET);
goto end;
}
@@ -195,9 +195,9 @@ static void verify_epollio(void)
bzero(ret_evs, sizeof(ret_evs));
TEST(epoll_wait(epfd, ret_evs, 2, -1));
- if (TEST_RETURN <= 0) {
+ if (TST_RET <= 0) {
tst_res(TFAIL | TTERRNO, "epoll_wait() returned %li",
- TEST_RETURN);
+ TST_RET);
goto end;
}
@@ -213,7 +213,7 @@ static void verify_epollio(void)
events &= ~EPOLLOUT;
}
- if (TEST_RETURN != events_matched) {
+ if (TST_RET != events_matched) {
tst_res(TFAIL,
"epoll_wait() returned unexpected events");
dump_epevs(ret_evs, 2);
diff --git a/testcases/kernel/syscalls/epoll_wait/epoll_wait02.c b/testcases/kernel/syscalls/epoll_wait/epoll_wait02.c
index 70cddb9c9..a1eab2697 100644
--- a/testcases/kernel/syscalls/epoll_wait/epoll_wait02.c
+++ b/testcases/kernel/syscalls/epoll_wait/epoll_wait02.c
@@ -41,9 +41,9 @@ int sample_fn(int clk_id, long long usec)
tst_timer_stop();
tst_timer_sample();
- if (TEST_RETURN != 0) {
+ if (TST_RET != 0) {
tst_res(TFAIL | TTERRNO,
- "epoll_wait() returned %li", TEST_RETURN);
+ "epoll_wait() returned %li", TST_RET);
return 1;
}
diff --git a/testcases/kernel/syscalls/fchdir/fchdir03.c b/testcases/kernel/syscalls/fchdir/fchdir03.c
index 59685f814..dd610e5ef 100644
--- a/testcases/kernel/syscalls/fchdir/fchdir03.c
+++ b/testcases/kernel/syscalls/fchdir/fchdir03.c
@@ -42,12 +42,12 @@ void verify_fchdir(void)
{
TEST(fchdir(fd));
- if (TEST_RETURN != -1) {
+ if (TST_RET != -1) {
tst_res(TFAIL, "fchdir() succeeded unexpectedly");
return;
}
- if (TEST_ERRNO != EACCES) {
+ if (TST_ERR != EACCES) {
tst_res(TFAIL | TTERRNO, "fchdir() should fail with EACCES");
return;
}
diff --git a/testcases/kernel/syscalls/fchmod/fchmod01.c b/testcases/kernel/syscalls/fchmod/fchmod01.c
index c342f6011..05b566791 100644
--- a/testcases/kernel/syscalls/fchmod/fchmod01.c
+++ b/testcases/kernel/syscalls/fchmod/fchmod01.c
@@ -26,7 +26,7 @@ static void verify_fchmod(void)
mode = (mode_t)modes[ind];
TEST(fchmod(fd, mode));
- if (TEST_RETURN == -1)
+ if (TST_RET == -1)
tst_res(TFAIL | TTERRNO, "fchmod() failed unexpectly");
SAFE_FSTAT(fd, &stat_buf);
diff --git a/testcases/kernel/syscalls/fchmod/fchmod02.c b/testcases/kernel/syscalls/fchmod/fchmod02.c
index a855f9567..d0b35db12 100644
--- a/testcases/kernel/syscalls/fchmod/fchmod02.c
+++ b/testcases/kernel/syscalls/fchmod/fchmod02.c
@@ -33,7 +33,7 @@ static void verify_fchmod(void)
mode_t file_mode;
TEST(fchmod(fd, PERMS));
- if (TEST_RETURN == -1)
+ if (TST_RET == -1)
tst_res(TFAIL | TTERRNO, "fchmod() failed unexpectly");
SAFE_FSTAT(fd, &stat_buf);
diff --git a/testcases/kernel/syscalls/fchmod/fchmod06.c b/testcases/kernel/syscalls/fchmod/fchmod06.c
index b5240086e..02d5f9035 100644
--- a/testcases/kernel/syscalls/fchmod/fchmod06.c
+++ b/testcases/kernel/syscalls/fchmod/fchmod06.c
@@ -51,20 +51,20 @@ static void verify_fchmod(unsigned int i)
TEST(fchmod(*tc->fd, tc->mode));
- if (TEST_RETURN != -1) {
+ if (TST_RET != -1) {
tst_res(TFAIL, "fchmod() passed unexpectedly (%li)",
- TEST_RETURN);
+ TST_RET);
return;
}
- if (TEST_ERRNO == tcases[i].exp_errno) {
+ if (TST_ERR == tcases[i].exp_errno) {
tst_res(TPASS | TTERRNO, "fchmod() failed expectedly");
return;
}
tst_res(TFAIL | TTERRNO,
"fchmod() failed unexpectedly, expected %i - %s",
- TEST_ERRNO, tst_strerrno(TEST_ERRNO));
+ TST_ERR, tst_strerrno(TST_ERR));
}
static void setup(void)
diff --git a/testcases/kernel/syscalls/fcntl/fcntl02.c b/testcases/kernel/syscalls/fcntl/fcntl02.c
index d7a6c197f..6d0d5a750 100644
--- a/testcases/kernel/syscalls/fcntl/fcntl02.c
+++ b/testcases/kernel/syscalls/fcntl/fcntl02.c
@@ -55,21 +55,21 @@ static void verify_fcntl(unsigned int n)
TEST(fcntl(fd, F_DUPFD, min_fd));
- if (TEST_RETURN == -1) {
+ if (TST_RET == -1) {
tst_res(TFAIL | TTERRNO, "fcntl(%s, F_DUPFD, %i) failed",
fname, min_fd);
return;
}
- if (TEST_RETURN < min_fd) {
+ if (TST_RET < min_fd) {
tst_res(TFAIL, "fcntl(%s, F_DUPFD, %i) returned %ld < %i",
- fname, min_fd, TEST_RETURN, min_fd);
+ fname, min_fd, TST_RET, min_fd);
}
tst_res(TPASS, "fcntl(%s, F_DUPFD, %i) returned %ld",
- fname, min_fd, TEST_RETURN);
+ fname, min_fd, TST_RET);
- SAFE_CLOSE(TEST_RETURN);
+ SAFE_CLOSE(TST_RET);
}
static void setup(void)
diff --git a/testcases/kernel/syscalls/fcntl/fcntl03.c b/testcases/kernel/syscalls/fcntl/fcntl03.c
index fe1d112b2..b2476bf5f 100644
--- a/testcases/kernel/syscalls/fcntl/fcntl03.c
+++ b/testcases/kernel/syscalls/fcntl/fcntl03.c
@@ -51,14 +51,14 @@ static void verify_fcntl(void)
{
TEST(fcntl(fd, F_GETFD, 0));
- if (TEST_RETURN == -1) {
+ if (TST_RET == -1) {
tst_res(TFAIL | TTERRNO, "fcntl(%s, F_GETFD, 0) failed",
fname);
return;
}
tst_res(TPASS, "fcntl(%s, F_GETFD, 0) returned %ld",
- fname, TEST_RETURN);
+ fname, TST_RET);
}
static void setup(void)
diff --git a/testcases/kernel/syscalls/fcntl/fcntl04.c b/testcases/kernel/syscalls/fcntl/fcntl04.c
index c00677c25..1fb978ffc 100644
--- a/testcases/kernel/syscalls/fcntl/fcntl04.c
+++ b/testcases/kernel/syscalls/fcntl/fcntl04.c
@@ -50,21 +50,21 @@ static void verify_fcntl(void)
{
TEST(fcntl(fd, F_GETFL, 0));
- if (TEST_RETURN == -1) {
+ if (TST_RET == -1) {
tst_res(TFAIL | TTERRNO, "fcntl(%s, F_GETFL, 0) failed",
fname);
return;
}
- if ((TEST_RETURN & O_ACCMODE) != O_RDWR) {
+ if ((TST_RET & O_ACCMODE) != O_RDWR) {
tst_res(TFAIL, "fcntl(%s, F_GETFL, 0) returned wrong "
"access mode %li, expected %i", fname,
- TEST_RETURN & O_ACCMODE, O_RDWR);
+ TST_RET & O_ACCMODE, O_RDWR);
return;
}
tst_res(TPASS, "fcntl(%s, F_GETFL, 0) returned %lx",
- fname, TEST_RETURN);
+ fname, TST_RET);
}
static void setup(void)
diff --git a/testcases/kernel/syscalls/flistxattr/flistxattr01.c b/testcases/kernel/syscalls/flistxattr/flistxattr01.c
index b287aabc9..278616e28 100644
--- a/testcases/kernel/syscalls/flistxattr/flistxattr01.c
+++ b/testcases/kernel/syscalls/flistxattr/flistxattr01.c
@@ -62,7 +62,7 @@ static void verify_flistxattr(void)
char buf[64];
TEST(flistxattr(fd, buf, sizeof(buf)));
- if (TEST_RETURN == -1) {
+ if (TST_RET == -1) {
tst_res(TFAIL | TTERRNO, "flistxattr() failed");
return;
}
diff --git a/testcases/kernel/syscalls/flistxattr/flistxattr02.c b/testcases/kernel/syscalls/flistxattr/flistxattr02.c
index 9f85ee5de..0b81b5151 100644
--- a/testcases/kernel/syscalls/flistxattr/flistxattr02.c
+++ b/testcases/kernel/syscalls/flistxattr/flistxattr02.c
@@ -61,14 +61,14 @@ static void verify_flistxattr(unsigned int n)
char buf[t->size];
TEST(flistxattr(*t->fd, buf, t->size));
- if (TEST_RETURN != -1) {
+ if (TST_RET != -1) {
tst_res(TFAIL,
"flistxattr() succeeded unexpectedly (returned %ld)",
- TEST_RETURN);
+ TST_RET);
return;
}
- if (t->exp_err != TEST_ERRNO) {
+ if (t->exp_err != TST_ERR) {
tst_res(TFAIL | TTERRNO, "flistxattr() failed "
"unexpectedlly, expected %s",
tst_strerrno(t->exp_err));
diff --git a/testcases/kernel/syscalls/flistxattr/flistxattr03.c b/testcases/kernel/syscalls/flistxattr/flistxattr03.c
index 14b68d463..b9f75a865 100644
--- a/testcases/kernel/syscalls/flistxattr/flistxattr03.c
+++ b/testcases/kernel/syscalls/flistxattr/flistxattr03.c
@@ -56,12 +56,12 @@ static int check_suitable_buf(const int file, long size)
static void verify_flistxattr(unsigned int n)
{
TEST(flistxattr(fd[n], NULL, 0));
- if (TEST_RETURN == -1) {
+ if (TST_RET == -1) {
tst_res(TFAIL | TTERRNO, "flistxattr() failed");
return;
}
- if (check_suitable_buf(fd[n], TEST_RETURN))
+ if (check_suitable_buf(fd[n], TST_RET))
tst_res(TPASS, "flistxattr() succeed with suitable buffer");
else
tst_res(TFAIL, "flistxattr() failed with small buffer");
diff --git a/testcases/kernel/syscalls/fsync/fsync01.c b/testcases/kernel/syscalls/fsync/fsync01.c
index c93b131f2..f5e14185c 100644
--- a/testcases/kernel/syscalls/fsync/fsync01.c
+++ b/testcases/kernel/syscalls/fsync/fsync01.c
@@ -52,10 +52,10 @@ static void verify_fsync(void)
TEST(fsync(fd));
- if (TEST_RETURN == -1)
+ if (TST_RET == -1)
tst_res(TFAIL | TTERRNO, "fsync failed");
else
- tst_res(TPASS, "fsync() returned %ld", TEST_RETURN);
+ tst_res(TPASS, "fsync() returned %ld", TST_RET);
}
}
diff --git a/testcases/kernel/syscalls/futex/futex_wait05.c b/testcases/kernel/syscalls/futex/futex_wait05.c
index 066944f34..0c5939c53 100644
--- a/testcases/kernel/syscalls/futex/futex_wait05.c
+++ b/testcases/kernel/syscalls/futex/futex_wait05.c
@@ -36,13 +36,13 @@ int sample_fn(int clk_id, long long usec)
tst_timer_stop();
tst_timer_sample();
- if (TEST_RETURN != -1) {
+ if (TST_RET != -1) {
tst_res(TFAIL, "futex_wait() returned %li, expected -1",
- TEST_RETURN);
+ TST_RET);
return 1;
}
- if (TEST_ERRNO != ETIMEDOUT) {
+ if (TST_ERR != ETIMEDOUT) {
tst_res(TFAIL | TTERRNO, "expected errno=%s",
tst_strerrno(ETIMEDOUT));
return 1;
diff --git a/testcases/kernel/syscalls/getcwd/getcwd01.c b/testcases/kernel/syscalls/getcwd/getcwd01.c
index 1199e9f2e..c1d8cb9ef 100644
--- a/testcases/kernel/syscalls/getcwd/getcwd01.c
+++ b/testcases/kernel/syscalls/getcwd/getcwd01.c
@@ -59,13 +59,13 @@ static void verify_getcwd(unsigned int n)
errno = 0;
res = getcwd(tc->buf, tc->size);
- TEST_ERRNO = errno;
+ TST_ERR = errno;
if (res) {
tst_res(TFAIL, "getcwd() succeeded unexpectedly");
return;
}
- if (TEST_ERRNO != tc->exp_err) {
+ if (TST_ERR != tc->exp_err) {
tst_res(TFAIL | TTERRNO, "getcwd() failed unexpectedly, expected %s",
tst_strerrno(tc->exp_err));
return;
diff --git a/testcases/kernel/syscalls/getcwd/getcwd02.c b/testcases/kernel/syscalls/getcwd/getcwd02.c
index 54440bdb8..1a2d30844 100644
--- a/testcases/kernel/syscalls/getcwd/getcwd02.c
+++ b/testcases/kernel/syscalls/getcwd/getcwd02.c
@@ -83,7 +83,7 @@ static void verify_getcwd(unsigned int n)
errno = 0;
res = getcwd(tc->buf, tc->size);
- TEST_ERRNO = errno;
+ TST_ERR = errno;
if (!res) {
tst_res(TFAIL | TTERRNO, "getcwd() failed");
goto end;
diff --git a/testcases/kernel/syscalls/getcwd/getcwd05.c b/testcases/kernel/syscalls/getcwd/getcwd05.c
index 182f6b56f..f39df4b1d 100644
--- a/testcases/kernel/syscalls/getcwd/getcwd05.c
+++ b/testcases/kernel/syscalls/getcwd/getcwd05.c
@@ -32,7 +32,7 @@ static void run(unsigned int i)
TESTPTR(getcwd(NULL, 0));
}
- if (TEST_ERRNO != ENOENT) {
+ if (TST_ERR != ENOENT) {
tst_res(TFAIL | TTERRNO, "returned unexpected errno");
fail = 1;
}
diff --git a/testcases/kernel/syscalls/getpriority/getpriority01.c b/testcases/kernel/syscalls/getpriority/getpriority01.c
index caf85734b..c7cccbc51 100644
--- a/testcases/kernel/syscalls/getpriority/getpriority01.c
+++ b/testcases/kernel/syscalls/getpriority/getpriority01.c
@@ -45,21 +45,21 @@ static void verify_getpriority(unsigned int n)
TEST(getpriority(tc->which, 0));
- if (TEST_ERRNO != 0) {
+ if (TST_ERR != 0) {
tst_res(TFAIL | TTERRNO, "getpriority(%d, 0) failed",
tc->which);
return;
}
- if (TEST_RETURN < tc->min || TEST_RETURN > tc->max) {
+ if (TST_RET < tc->min || TST_RET > tc->max) {
tst_res(TFAIL, "getpriority(%d, 0) returned %ld, "
"expected in the range of [%d, %d]",
- tc->which, TEST_RETURN, tc->min, tc->max);
+ tc->which, TST_RET, tc->min, tc->max);
return;
}
tst_res(TPASS, "getpriority(%d, 0) returned %ld",
- tc->which, TEST_RETURN);
+ tc->which, TST_RET);
}
static struct tst_test test = {
diff --git a/testcases/kernel/syscalls/getpriority/getpriority02.c b/testcases/kernel/syscalls/getpriority/getpriority02.c
index c2d356039..b771780c4 100644
--- a/testcases/kernel/syscalls/getpriority/getpriority02.c
+++ b/testcases/kernel/syscalls/getpriority/getpriority02.c
@@ -53,13 +53,13 @@ static void verify_getpriority(unsigned int n)
TEST(getpriority(tc->which, tc->who));
- if (TEST_RETURN != -1) {
+ if (TST_RET != -1) {
tst_res(TFAIL, "getpriority(%d, %d) succeeds unexpectedly, "
- "returned %li", tc->which, tc->who, TEST_RETURN);
+ "returned %li", tc->which, tc->who, TST_RET);
return;
}
- if (tc->exp_errno != TEST_ERRNO) {
+ if (tc->exp_errno != TST_ERR) {
tst_res(TFAIL | TTERRNO,
"getpriority(%d, %d) should fail with %s",
tc->which, tc->who, tst_strerrno(tc->exp_errno));
diff --git a/testcases/kernel/syscalls/getrandom/getrandom01.c b/testcases/kernel/syscalls/getrandom/getrandom01.c
index 8bc026901..d449fbd81 100644
--- a/testcases/kernel/syscalls/getrandom/getrandom01.c
+++ b/testcases/kernel/syscalls/getrandom/getrandom01.c
@@ -37,9 +37,9 @@ static void verify_getrandom(unsigned int n)
{
TEST(tst_syscall(__NR_getrandom, NULL, 100, modes[n]));
- if (TEST_RETURN == -1) {
+ if (TST_RET == -1) {
tst_res(TPASS | TTERRNO, "getrandom returned %ld",
- TEST_RETURN);
+ TST_RET);
} else {
tst_res(TFAIL | TTERRNO, "getrandom failed");
}
diff --git a/testcases/kernel/syscalls/getrandom/getrandom02.c b/testcases/kernel/syscalls/getrandom/getrandom02.c
index cc7b0b814..e7d03e799 100644
--- a/testcases/kernel/syscalls/getrandom/getrandom02.c
+++ b/testcases/kernel/syscalls/getrandom/getrandom02.c
@@ -63,13 +63,13 @@ static void verify_getrandom(unsigned int n)
do {
TEST(tst_syscall(__NR_getrandom, buf, sizeof(buf), modes[n]));
- } while ((modes[n] & GRND_NONBLOCK) && TEST_RETURN == -1
- && TEST_ERRNO == EAGAIN);
+ } while ((modes[n] & GRND_NONBLOCK) && TST_RET == -1
+ && TST_ERR == EAGAIN);
- if (!check_content(buf, TEST_RETURN))
+ if (!check_content(buf, TST_RET))
tst_res(TFAIL | TTERRNO, "getrandom failed");
else
- tst_res(TPASS, "getrandom returned %ld", TEST_RETURN);
+ tst_res(TPASS, "getrandom returned %ld", TST_RET);
}
static struct tst_test test = {
diff --git a/testcases/kernel/syscalls/getrandom/getrandom03.c b/testcases/kernel/syscalls/getrandom/getrandom03.c
index 55c287257..d7081fed8 100644
--- a/testcases/kernel/syscalls/getrandom/getrandom03.c
+++ b/testcases/kernel/syscalls/getrandom/getrandom03.c
@@ -54,11 +54,11 @@ static void verify_getrandom(unsigned int n)
TEST(tst_syscall(__NR_getrandom, buf, sizes[n], 0));
- if (TEST_RETURN != sizes[n]) {
+ if (TST_RET != sizes[n]) {
tst_res(TFAIL | TTERRNO, "getrandom returned %li, expected %u",
- TEST_RETURN, sizes[n]);
+ TST_RET, sizes[n]);
} else {
- tst_res(TPASS, "getrandom returned %ld", TEST_RETURN);
+ tst_res(TPASS, "getrandom returned %ld", TST_RET);
}
}
diff --git a/testcases/kernel/syscalls/getrandom/getrandom04.c b/testcases/kernel/syscalls/getrandom/getrandom04.c
index 8a3faf94d..26df42348 100644
--- a/testcases/kernel/syscalls/getrandom/getrandom04.c
+++ b/testcases/kernel/syscalls/getrandom/getrandom04.c
@@ -46,10 +46,10 @@ static void verify_getrandom(void)
SAFE_SETRLIMIT(RLIMIT_NOFILE, &lnew);
TEST(tst_syscall(__NR_getrandom, buf, 100, 0));
- if (TEST_RETURN == -1)
+ if (TST_RET == -1)
tst_res(TFAIL | TTERRNO, "getrandom failed");
else
- tst_res(TPASS, "getrandom returned %ld", TEST_RETURN);
+ tst_res(TPASS, "getrandom returned %ld", TST_RET);
SAFE_SETRLIMIT(RLIMIT_NOFILE, &lold);
}
diff --git a/testcases/kernel/syscalls/inotify/inotify03.c b/testcases/kernel/syscalls/inotify/inotify03.c
index 6bc5e7424..ff7419944 100644
--- a/testcases/kernel/syscalls/inotify/inotify03.c
+++ b/testcases/kernel/syscalls/inotify/inotify03.c
@@ -94,10 +94,10 @@ void verify_inotify(void)
tst_res(TINFO, "umount %s", tst_device->dev);
TEST(tst_umount(mntpoint));
- if (TEST_RETURN != 0) {
+ if (TST_RET != 0) {
tst_brk(TBROK, "umount(2) Failed "
"while unmounting errno = %d : %s",
- TEST_ERRNO, strerror(TEST_ERRNO));
+ TST_ERR, strerror(TST_ERR));
}
mount_flag = 0;
@@ -192,7 +192,7 @@ static void cleanup(void)
if (mount_flag) {
TEST(tst_umount(mntpoint));
- if (TEST_RETURN != 0)
+ if (TST_RET != 0)
tst_res(TWARN | TTERRNO, "umount(%s) failed",
mntpoint);
}
diff --git a/testcases/kernel/syscalls/io_destroy/io_destroy01.c b/testcases/kernel/syscalls/io_destroy/io_destroy01.c
index 3611477e4..e5ab18812 100644
--- a/testcases/kernel/syscalls/io_destroy/io_destroy01.c
+++ b/testcases/kernel/syscalls/io_destroy/io_destroy01.c
@@ -40,18 +40,18 @@ static void verify_io_destroy(void)
memset(&ctx, 0xff, sizeof(ctx));
TEST(io_destroy(ctx));
- if (TEST_RETURN == 0) {
+ if (TST_RET == 0) {
tst_res(TFAIL, "io_destroy() succeeded unexpectedly");
return;
}
- if (TEST_RETURN == -EINVAL) {
+ if (TST_RET == -EINVAL) {
tst_res(TPASS,
"io_destroy() failed as expected, returned -EINVAL");
} else {
tst_res(TFAIL, "io_destroy() failed unexpectedly, "
"returned -%s expected -EINVAL",
- tst_strerrno(-TEST_RETURN));
+ tst_strerrno(-TST_RET));
}
}
diff --git a/testcases/kernel/syscalls/io_setup/io_setup01.c b/testcases/kernel/syscalls/io_setup/io_setup01.c
index 243c57905..617689bac 100644
--- a/testcases/kernel/syscalls/io_setup/io_setup01.c
+++ b/testcases/kernel/syscalls/io_setup/io_setup01.c
@@ -45,18 +45,18 @@ static void verify_failure(unsigned int nr, io_context_t *ctx, int init_val, lon
memset(ctx, init_val, sizeof(*ctx));
TEST(io_setup(nr, ctx));
- if (TEST_RETURN == 0) {
+ if (TST_RET == 0) {
tst_res(TFAIL, "io_setup() passed unexpectedly");
io_destroy(*ctx);
return;
}
- if (TEST_RETURN == -exp_err) {
+ if (TST_RET == -exp_err) {
tst_res(TPASS, "io_setup() failed as expected, returned -%s",
tst_strerrno(exp_err));
} else {
tst_res(TFAIL, "io_setup() failed unexpectedly, returned -%s "
- "expected -%s", tst_strerrno(-TEST_RETURN),
+ "expected -%s", tst_strerrno(-TST_RET),
tst_strerrno(exp_err));
}
}
@@ -66,9 +66,9 @@ static void verify_success(unsigned int nr, io_context_t *ctx, int init_val)
memset(ctx, init_val, sizeof(*ctx));
TEST(io_setup(nr, ctx));
- if (TEST_RETURN != 0) {
+ if (TST_RET != 0) {
tst_res(TFAIL, "io_setup() failed unexpectedly with %li (%s)",
- TEST_RETURN, tst_strerrno(-TEST_RETURN));
+ TST_RET, tst_strerrno(-TST_RET));
return;
}
diff --git a/testcases/kernel/syscalls/ioctl/ioctl04.c b/testcases/kernel/syscalls/ioctl/ioctl04.c
index 89e89ec87..2a7005532 100644
--- a/testcases/kernel/syscalls/ioctl/ioctl04.c
+++ b/testcases/kernel/syscalls/ioctl/ioctl04.c
@@ -52,13 +52,13 @@ static void verify_ioctl(void)
TEST(mount(tst_device->dev, "mntpoint", tst_device->fs_type, 0, NULL));
- if (TEST_RETURN != -1) {
+ if (TST_RET != -1) {
tst_res(TFAIL, "Mounting RO device RW succeeded");
tst_umount("mntpoint");
goto next;
}
- if (TEST_ERRNO == EACCES) {
+ if (TST_ERR == EACCES) {
tst_res(TPASS | TERRNO, "Mounting RO device RW failed");
goto next;
}
@@ -69,7 +69,7 @@ static void verify_ioctl(void)
next:
TEST(mount(tst_device->dev, "mntpoint", tst_device->fs_type, MS_RDONLY, NULL));
- if (TEST_RETURN == 0) {
+ if (TST_RET == 0) {
tst_res(TPASS, "Mounting RO device RO works");
tst_umount("mntpoint");
} else {
diff --git a/testcases/kernel/syscalls/ipc/msgctl/msgctl01.c b/testcases/kernel/syscalls/ipc/msgctl/msgctl01.c
index 60ccfb9f7..df14264e5 100644
--- a/testcases/kernel/syscalls/ipc/msgctl/msgctl01.c
+++ b/testcases/kernel/syscalls/ipc/msgctl/msgctl01.c
@@ -42,8 +42,8 @@ static void verify_msgctl(void)
memset(&buf, 'a', sizeof(buf));
TEST(msgctl(msg_id, IPC_STAT, &buf));
- if (TEST_RETURN != 0) {
- tst_res(TFAIL | TTERRNO, "msgctl() returned %li", TEST_RETURN);
+ if (TST_RET != 0) {
+ tst_res(TFAIL | TTERRNO, "msgctl() returned %li", TST_RET);
return;
}
diff --git a/testcases/kernel/syscalls/ipc/msgctl/msgctl02.c b/testcases/kernel/syscalls/ipc/msgctl/msgctl02.c
index 4a821d03b..fca49f3dd 100644
--- a/testcases/kernel/syscalls/ipc/msgctl/msgctl02.c
+++ b/testcases/kernel/syscalls/ipc/msgctl/msgctl02.c
@@ -39,7 +39,7 @@ static void verify_msgctl(void)
TEST(msgctl(msg_id, IPC_SET, &buf));
- if (TEST_RETURN != 0) {
+ if (TST_RET != 0) {
tst_res(TFAIL | TTERRNO, "msgctl(IPC_SET) failed");
return;
}
diff --git a/testcases/kernel/syscalls/ipc/msgctl/msgctl03.c b/testcases/kernel/syscalls/ipc/msgctl/msgctl03.c
index 836d6e76d..707fe2b04 100644
--- a/testcases/kernel/syscalls/ipc/msgctl/msgctl03.c
+++ b/testcases/kernel/syscalls/ipc/msgctl/msgctl03.c
@@ -32,7 +32,7 @@ static void verify_msgctl(void)
msg_q = SAFE_MSGGET(IPC_PRIVATE, MSG_RW);
TEST(msgctl(msg_q, IPC_RMID, NULL));
- if (TEST_RETURN != 0) {
+ if (TST_RET != 0) {
tst_res(TFAIL | TTERRNO, "msgctl(IPC_RMID) failed");
return;
}
@@ -40,11 +40,11 @@ static void verify_msgctl(void)
tst_res(TPASS, "msgctl(IPC_RMID)");
TEST(msgctl(msg_q, IPC_STAT, &buf));
- if (TEST_ERRNO == EINVAL) {
+ if (TST_ERR == EINVAL) {
tst_res(TPASS | TTERRNO, "msgctl(IPC_STAT)");
} else {
tst_res(TFAIL | TTERRNO,
- "msgctl(IPC_STAT) returned %li", TEST_RETURN);
+ "msgctl(IPC_STAT) returned %li", TST_RET);
}
}
diff --git a/testcases/kernel/syscalls/ipc/msgctl/msgctl04.c b/testcases/kernel/syscalls/ipc/msgctl/msgctl04.c
index ca36e94fb..8e4af8386 100644
--- a/testcases/kernel/syscalls/ipc/msgctl/msgctl04.c
+++ b/testcases/kernel/syscalls/ipc/msgctl/msgctl04.c
@@ -62,12 +62,12 @@ static void verify_msgctl(unsigned int i)
{
TEST(msgctl(*(tc[i].msg_id), tc[i].cmd, tc[i].buf));
- if (TEST_RETURN != -1) {
- tst_res(TFAIL, "msgctl() returned %li", TEST_RETURN);
+ if (TST_RET != -1) {
+ tst_res(TFAIL, "msgctl() returned %li", TST_RET);
return;
}
- if (TEST_ERRNO == tc[i].error) {
+ if (TST_ERR == tc[i].error) {
tst_res(TPASS | TTERRNO, "msgctl(%i, %i, %p)",
*tc[i].msg_id, tc[i].cmd, tc[i].buf);
return;
diff --git a/testcases/kernel/syscalls/ipc/msgctl/msgctl12.c b/testcases/kernel/syscalls/ipc/msgctl/msgctl12.c
index 8fb92e921..403a57e89 100644
--- a/testcases/kernel/syscalls/ipc/msgctl/msgctl12.c
+++ b/testcases/kernel/syscalls/ipc/msgctl/msgctl12.c
@@ -45,10 +45,10 @@ static void verify_msgctl(unsigned int i)
{
TEST(msgctl(*tc[i].msg_id, tc[i].cmd, tc[i].buf));
- if (TEST_RETURN == -1) {
+ if (TST_RET == -1) {
tst_res(TFAIL,
"msgctl() test %s failed with errno: "
- "%d", tc[i].name, TEST_ERRNO);
+ "%d", tc[i].name, TST_ERR);
}
tst_res(TPASS, "msgctl() test %s succeeded", tc[i].name);
diff --git a/testcases/kernel/syscalls/ipc/msgget/msgget01.c b/testcases/kernel/syscalls/ipc/msgget/msgget01.c
index 3d1010faf..ae9e0acdf 100644
--- a/testcases/kernel/syscalls/ipc/msgget/msgget01.c
+++ b/testcases/kernel/syscalls/ipc/msgget/msgget01.c
@@ -42,12 +42,12 @@ static struct buf {
static void verify_msgget(void)
{
TEST(msgget(msgkey, IPC_CREAT | MSG_RW));
- if (TEST_RETURN == -1) {
+ if (TST_RET == -1) {
tst_res(TFAIL | TTERRNO, "msgget() failed");
return;
}
- queue_id = TEST_RETURN;
+ queue_id = TST_RET;
SAFE_MSGSND(queue_id, &snd_buf, MSGSIZE, 0);
diff --git a/testcases/kernel/syscalls/ipc/msgget/msgget02.c b/testcases/kernel/syscalls/ipc/msgget/msgget02.c
index acf4b3866..00f7fa802 100644
--- a/testcases/kernel/syscalls/ipc/msgget/msgget02.c
+++ b/testcases/kernel/syscalls/ipc/msgget/msgget02.c
@@ -60,12 +60,12 @@ static void verify_msgget(struct tcase *tc)
{
TEST(msgget(*tc->key, tc->flags));
- if (TEST_RETURN != -1) {
+ if (TST_RET != -1) {
tst_res(TFAIL, "msgget() succeeded unexpectedly");
return;
}
- if (TEST_ERRNO == tc->exp_err) {
+ if (TST_ERR == tc->exp_err) {
tst_res(TPASS | TTERRNO, "msgget() failed as expected");
} else {
tst_res(TFAIL | TTERRNO, "msgget() failed unexpectedly,"
diff --git a/testcases/kernel/syscalls/ipc/msgget/msgget03.c b/testcases/kernel/syscalls/ipc/msgget/msgget03.c
index f7e5ace99..c117710cf 100644
--- a/testcases/kernel/syscalls/ipc/msgget/msgget03.c
+++ b/testcases/kernel/syscalls/ipc/msgget/msgget03.c
@@ -39,10 +39,10 @@ static key_t msgkey;
static void verify_msgget(void)
{
TEST(msgget(msgkey + maxmsgs, IPC_CREAT | IPC_EXCL));
- if (TEST_RETURN != -1)
+ if (TST_RET != -1)
tst_res(TFAIL, "msgget() succeeded unexpectedly");
- if (TEST_ERRNO == ENOSPC) {
+ if (TST_ERR == ENOSPC) {
tst_res(TPASS | TTERRNO, "msgget() failed as expected");
} else {
tst_res(TFAIL | TTERRNO, "msgget() failed unexpectedly,"
diff --git a/testcases/kernel/syscalls/ipc/msgsnd/msgsnd01.c b/testcases/kernel/syscalls/ipc/msgsnd/msgsnd01.c
index 6036c6414..e05df010d 100644
--- a/testcases/kernel/syscalls/ipc/msgsnd/msgsnd01.c
+++ b/testcases/kernel/syscalls/ipc/msgsnd/msgsnd01.c
@@ -41,7 +41,7 @@ static void verify_msgsnd(void)
struct msqid_ds qs_buf;
TEST(msgsnd(queue_id, &snd_buf, MSGSIZE, 0));
- if (TEST_RETURN == -1) {
+ if (TST_RET == -1) {
tst_res(TFAIL | TTERRNO, "msgsnd() failed");
return;
}
diff --git a/testcases/kernel/syscalls/ipc/msgsnd/msgsnd02.c b/testcases/kernel/syscalls/ipc/msgsnd/msgsnd02.c
index 2232b0e4c..1b5f2e346 100644
--- a/testcases/kernel/syscalls/ipc/msgsnd/msgsnd02.c
+++ b/testcases/kernel/syscalls/ipc/msgsnd/msgsnd02.c
@@ -74,12 +74,12 @@ static struct tcase {
static void verify_msgsnd(struct tcase *tc)
{
TEST(msgsnd(*tc->id, tc->buffer, tc->msgsz, 0));
- if (TEST_RETURN != -1) {
+ if (TST_RET != -1) {
tst_res(TFAIL, "smgsnd() succeeded unexpectedly");
return;
}
- if (TEST_ERRNO == tc->exp_err) {
+ if (TST_ERR == tc->exp_err) {
tst_res(TPASS | TTERRNO, "msgsnd() failed as expected");
} else {
tst_res(TFAIL | TTERRNO, "msgsnd() failed unexpectedly,"
diff --git a/testcases/kernel/syscalls/ipc/msgsnd/msgsnd05.c b/testcases/kernel/syscalls/ipc/msgsnd/msgsnd05.c
index d817254df..afadb1e98 100644
--- a/testcases/kernel/syscalls/ipc/msgsnd/msgsnd05.c
+++ b/testcases/kernel/syscalls/ipc/msgsnd/msgsnd05.c
@@ -54,12 +54,12 @@ static struct tcase {
static void verify_msgsnd(struct tcase *tc)
{
TEST(msgsnd(queue_id, &snd_buf, MSGSIZE, tc->flag));
- if (TEST_RETURN != -1) {
+ if (TST_RET != -1) {
tst_res(TFAIL, "msgsnd() succeeded unexpectedly");
return;
}
- if (TEST_ERRNO == tc->exp_err) {
+ if (TST_ERR == tc->exp_err) {
tst_res(TPASS | TTERRNO, "msgsnd() failed as expected");
} else {
tst_res(TFAIL | TTERRNO, "msgsnd() failed unexpectedly,"
diff --git a/testcases/kernel/syscalls/ipc/msgsnd/msgsnd06.c b/testcases/kernel/syscalls/ipc/msgsnd/msgsnd06.c
index 25fce0af0..56f75eb6c 100644
--- a/testcases/kernel/syscalls/ipc/msgsnd/msgsnd06.c
+++ b/testcases/kernel/syscalls/ipc/msgsnd/msgsnd06.c
@@ -41,12 +41,12 @@ static struct buf {
static void verify_msgsnd(void)
{
TEST(msgsnd(queue_id, &snd_buf, MSGSIZE, 0));
- if (TEST_RETURN != -1) {
+ if (TST_RET != -1) {
tst_res(TFAIL, "msgsnd() succeeded unexpectedly");
return;
}
- if (TEST_ERRNO == EIDRM) {
+ if (TST_ERR == EIDRM) {
tst_res(TPASS | TTERRNO, "msgsnd() failed as expected");
} else {
tst_res(TFAIL | TTERRNO,
diff --git a/testcases/kernel/syscalls/ipc/shmctl/shmctl05.c b/testcases/kernel/syscalls/ipc/shmctl/shmctl05.c
index 6fbc6b6c3..a960cc906 100644
--- a/testcases/kernel/syscalls/ipc/shmctl/shmctl05.c
+++ b/testcases/kernel/syscalls/ipc/shmctl/shmctl05.c
@@ -85,9 +85,9 @@ static void do_test(void)
/* This is the system call that crashed */
TEST(syscall(__NR_remap_file_pages, addr, 4096,
0, 0, 0));
- } while (TEST_RETURN == 0);
+ } while (TST_RET == 0);
- if (TEST_ERRNO != EIDRM && TEST_ERRNO != EINVAL) {
+ if (TST_ERR != EIDRM && TST_ERR != EINVAL) {
tst_brk(TBROK | TTERRNO,
"Unexpected remap_file_pages() error");
}
diff --git a/testcases/kernel/syscalls/kcmp/kcmp01.c b/testcases/kernel/syscalls/kcmp/kcmp01.c
index 1143ad63e..f37fff1bd 100644
--- a/testcases/kernel/syscalls/kcmp/kcmp01.c
+++ b/testcases/kernel/syscalls/kcmp/kcmp01.c
@@ -84,15 +84,15 @@ static void do_child(const struct test_case *test)
SAFE_CLOSE(fd2);
SAFE_CLOSE(fd3);
- if (TEST_RETURN == -1) {
+ if (TST_RET == -1) {
tst_res(TFAIL | TTERRNO, "kcmp() failed unexpectedly");
return;
}
- if ((test->exp_different && TEST_RETURN == 0)
- || (test->exp_different == 0 && TEST_RETURN)) {
+ if ((test->exp_different && TST_RET == 0)
+ || (test->exp_different == 0 && TST_RET)) {
tst_res(TFAIL, "kcmp() returned %lu instead of %d",
- TEST_RETURN, test->exp_different);
+ TST_RET, test->exp_different);
return;
}
diff --git a/testcases/kernel/syscalls/kcmp/kcmp02.c b/testcases/kernel/syscalls/kcmp/kcmp02.c
index 33f132f24..189518ff2 100644
--- a/testcases/kernel/syscalls/kcmp/kcmp02.c
+++ b/testcases/kernel/syscalls/kcmp/kcmp02.c
@@ -87,12 +87,12 @@ static void verify_kcmp(unsigned int n)
TEST(kcmp(*(test->pid1), *(test->pid2), test->type,
*(test->fd1), *(test->fd2)));
- if (TEST_RETURN != -1) {
+ if (TST_RET != -1) {
tst_res(TFAIL, "kcmp() succeeded unexpectedly");
return;
}
- if (test->exp_errno == TEST_ERRNO) {
+ if (test->exp_errno == TST_ERR) {
tst_res(TPASS | TTERRNO, "kcmp() returned the expected value");
return;
}
diff --git a/testcases/kernel/syscalls/kcmp/kcmp03.c b/testcases/kernel/syscalls/kcmp/kcmp03.c
index b6ca40cff..a1154894e 100644
--- a/testcases/kernel/syscalls/kcmp/kcmp03.c
+++ b/testcases/kernel/syscalls/kcmp/kcmp03.c
@@ -67,12 +67,12 @@ static int do_child(void *arg)
pid2 = getpid();
TEST(kcmp(pid1, pid2, *(int *)arg, 0, 0));
- if (TEST_RETURN == -1) {
+ if (TST_RET == -1) {
tst_res(TFAIL | TTERRNO, "kcmp() failed unexpectedly");
return 0;
}
- if (TEST_RETURN == 0)
+ if (TST_RET == 0)
tst_res(TPASS, "kcmp() returned the expected value");
else
tst_res(TFAIL, "kcmp() returned the unexpected value");
diff --git a/testcases/kernel/syscalls/keyctl/keyctl01.c b/testcases/kernel/syscalls/keyctl/keyctl01.c
index 5719d5550..d826a8c42 100644
--- a/testcases/kernel/syscalls/keyctl/keyctl01.c
+++ b/testcases/kernel/syscalls/keyctl/keyctl01.c
@@ -35,24 +35,24 @@ static void do_test(void)
key_serial_t key;
TEST(keyctl(KEYCTL_GET_KEYRING_ID, KEY_SPEC_USER_SESSION_KEYRING));
- if (TEST_RETURN != -1)
+ if (TST_RET != -1)
tst_res(TPASS, "KEYCTL_GET_KEYRING_ID succeeded");
else
tst_res(TFAIL | TTERRNO, "KEYCTL_GET_KEYRING_ID failed");
for (key = INT32_MAX; key > INT32_MIN; key--) {
TEST(keyctl(KEYCTL_READ, key));
- if (TEST_RETURN == -1 && TEST_ERRNO == ENOKEY)
+ if (TST_RET == -1 && TST_ERR == ENOKEY)
break;
}
TEST(keyctl(KEYCTL_REVOKE, key));
- if (TEST_RETURN != -1) {
+ if (TST_RET != -1) {
tst_res(TFAIL, "KEYCTL_REVOKE succeeded unexpectedly");
return;
}
- if (TEST_ERRNO != ENOKEY) {
+ if (TST_ERR != ENOKEY) {
tst_res(TFAIL | TTERRNO, "KEYCTL_REVOKE failed unexpectedly");
return;
}
diff --git a/testcases/kernel/syscalls/keyctl/keyctl03.c b/testcases/kernel/syscalls/keyctl/keyctl03.c
index 5c066f704..90e00f8bc 100644
--- a/testcases/kernel/syscalls/keyctl/keyctl03.c
+++ b/testcases/kernel/syscalls/keyctl/keyctl03.c
@@ -45,7 +45,7 @@ static void do_test(void)
request_key("keyring", "foo", "bar", KEY_SPEC_THREAD_KEYRING);
TEST(keyctl(KEYCTL_UNLINK, key, KEY_SPEC_SESSION_KEYRING));
- if (TEST_RETURN)
+ if (TST_RET)
tst_res(TFAIL | TTERRNO, "keyctl unlink failed");
else
tst_res(TPASS, "Bug not reproduced");
diff --git a/testcases/kernel/syscalls/keyctl/keyctl04.c b/testcases/kernel/syscalls/keyctl/keyctl04.c
index be9ceeb54..6e1b4b3e3 100644
--- a/testcases/kernel/syscalls/keyctl/keyctl04.c
+++ b/testcases/kernel/syscalls/keyctl/keyctl04.c
@@ -36,18 +36,18 @@ static void do_test(void)
key_serial_t tid_keyring;
TEST(keyctl(KEYCTL_GET_KEYRING_ID, KEY_SPEC_THREAD_KEYRING, 1));
- if (TEST_RETURN < 0)
+ if (TST_RET < 0)
tst_brk(TBROK | TTERRNO, "failed to create thread keyring");
- tid_keyring = TEST_RETURN;
+ tid_keyring = TST_RET;
TEST(keyctl(KEYCTL_SET_REQKEY_KEYRING, KEY_REQKEY_DEFL_THREAD_KEYRING));
- if (TEST_RETURN < 0)
+ if (TST_RET < 0)
tst_brk(TBROK | TTERRNO, "failed to set reqkey keyring");
TEST(keyctl(KEYCTL_GET_KEYRING_ID, KEY_SPEC_THREAD_KEYRING, 0));
- if (TEST_RETURN < 0)
+ if (TST_RET < 0)
tst_brk(TBROK | TTERRNO, "failed to get thread keyring ID");
- if (TEST_RETURN == tid_keyring)
+ if (TST_RET == tid_keyring)
tst_res(TPASS, "thread keyring was not leaked");
else
tst_res(TFAIL, "thread keyring was leaked!");
diff --git a/testcases/kernel/syscalls/keyctl/keyctl05.c b/testcases/kernel/syscalls/keyctl/keyctl05.c
index c04d1f5b0..2384f7f67 100644
--- a/testcases/kernel/syscalls/keyctl/keyctl05.c
+++ b/testcases/kernel/syscalls/keyctl/keyctl05.c
@@ -86,7 +86,7 @@ static const char x509_cert[] =
static void new_session_keyring(void)
{
TEST(keyctl(KEYCTL_JOIN_SESSION_KEYRING, NULL));
- if (TEST_RETURN < 0)
+ if (TST_RET < 0)
tst_brk(TBROK | TTERRNO, "failed to join new session keyring");
}
@@ -98,18 +98,18 @@ static void test_update_nonupdatable(const char *type,
new_session_keyring();
TEST(add_key(type, "desc", payload, plen, KEY_SPEC_SESSION_KEYRING));
- if (TEST_RETURN < 0) {
- if (TEST_ERRNO == ENODEV) {
+ if (TST_RET < 0) {
+ if (TST_ERR == ENODEV) {
tst_res(TCONF, "kernel doesn't support key type '%s'",
type);
return;
}
- if (TEST_ERRNO == EBADMSG && !strcmp(type, "asymmetric")) {
+ if (TST_ERR == EBADMSG && !strcmp(type, "asymmetric")) {
tst_res(TCONF, "kernel is missing x509 cert parser "
"(CONFIG_X509_CERTIFICATE_PARSER)");
return;
}
- if (TEST_ERRNO == ENOENT && !strcmp(type, "asymmetric")) {
+ if (TST_ERR == ENOENT && !strcmp(type, "asymmetric")) {
tst_res(TCONF, "kernel is missing crypto algorithms "
"needed to parse x509 cert (CONFIG_CRYPTO_RSA "
"and/or CONFIG_CRYPTO_SHA256)");
@@ -119,14 +119,14 @@ static void test_update_nonupdatable(const char *type,
type);
return;
}
- keyid = TEST_RETURN;
+ keyid = TST_RET;
/*
* Non-updatable keys don't start with write permission, so we must
* explicitly grant it.
*/
TEST(keyctl(KEYCTL_SETPERM, keyid, KEY_POS_ALL));
- if (TEST_RETURN != 0) {
+ if (TST_RET != 0) {
tst_res(TBROK | TTERRNO,
"failed to grant write permission to '%s' key", type);
return;
@@ -134,12 +134,12 @@ static void test_update_nonupdatable(const char *type,
tst_res(TINFO, "Try to update the '%s' key...", type);
TEST(keyctl(KEYCTL_UPDATE, keyid, payload, plen));
- if (TEST_RETURN == 0) {
+ if (TST_RET == 0) {
tst_res(TBROK,
"updating '%s' key unexpectedly succeeded", type);
return;
}
- if (TEST_ERRNO != EOPNOTSUPP) {
+ if (TST_ERR != EOPNOTSUPP) {
tst_res(TBROK | TTERRNO,
"updating '%s' key unexpectedly failed", type);
return;
@@ -162,11 +162,11 @@ static void test_update_setperm_race(void)
TEST(add_key("user", "desc", payload, sizeof(payload),
KEY_SPEC_SESSION_KEYRING));
- if (TEST_RETURN < 0) {
+ if (TST_RET < 0) {
tst_res(TBROK | TTERRNO, "failed to add 'user' key");
return;
}
- keyid = TEST_RETURN;
+ keyid = TST_RET;
if (SAFE_FORK() == 0) {
uint32_t perm = KEY_POS_ALL;
@@ -174,7 +174,7 @@ static void test_update_setperm_race(void)
for (i = 0; i < 10000; i++) {
perm ^= KEY_POS_WRITE;
TEST(keyctl(KEYCTL_SETPERM, keyid, perm));
- if (TEST_RETURN != 0)
+ if (TST_RET != 0)
tst_brk(TBROK | TTERRNO, "setperm failed");
}
exit(0);
@@ -183,7 +183,7 @@ static void test_update_setperm_race(void)
tst_res(TINFO, "Try to update the 'user' key...");
for (i = 0; i < 10000; i++) {
TEST(keyctl(KEYCTL_UPDATE, keyid, payload, sizeof(payload)));
- if (TEST_RETURN != 0 && TEST_ERRNO != EACCES) {
+ if (TST_RET != 0 && TST_ERR != EACCES) {
tst_res(TBROK | TTERRNO, "failed to update 'user' key");
return;
}
diff --git a/testcases/kernel/syscalls/keyctl/keyctl06.c b/testcases/kernel/syscalls/keyctl/keyctl06.c
index c62010e0b..bab26ee5c 100644
--- a/testcases/kernel/syscalls/keyctl/keyctl06.c
+++ b/testcases/kernel/syscalls/keyctl/keyctl06.c
@@ -37,7 +37,7 @@ static void add_test_key(const char *description)
{
TEST(add_key("user", description, "payload", 7,
KEY_SPEC_PROCESS_KEYRING));
- if (TEST_RETURN < 0)
+ if (TST_RET < 0)
tst_brk(TBROK | TTERRNO, "Failed to add test key");
}
@@ -51,7 +51,7 @@ static void do_test(void)
memset(key_ids, 0, sizeof(key_ids));
TEST(keyctl(KEYCTL_READ, KEY_SPEC_PROCESS_KEYRING,
(char *)key_ids, sizeof(key_serial_t)));
- if (TEST_RETURN < 0)
+ if (TST_RET < 0)
tst_brk(TBROK | TTERRNO, "KEYCTL_READ failed");
/*
@@ -63,9 +63,9 @@ static void do_test(void)
if (key_ids[1] != 0)
tst_brk(TFAIL, "KEYCTL_READ overran the buffer");
- if (TEST_RETURN != sizeof(key_ids)) {
+ if (TST_RET != sizeof(key_ids)) {
tst_brk(TFAIL, "KEYCTL_READ returned %ld but expected %zu",
- TEST_RETURN, sizeof(key_ids));
+ TST_RET, sizeof(key_ids));
}
tst_res(TPASS,
diff --git a/testcases/kernel/syscalls/keyctl/keyctl07.c b/testcases/kernel/syscalls/keyctl/keyctl07.c
index 08a585b6c..e067ac01d 100644
--- a/testcases/kernel/syscalls/keyctl/keyctl07.c
+++ b/testcases/kernel/syscalls/keyctl/keyctl07.c
@@ -49,10 +49,10 @@ static void try_to_read_negative_key(void)
*/
TEST(request_key("user", "description", "callout_info",
KEY_SPEC_PROCESS_KEYRING));
- if (TEST_RETURN != -1)
+ if (TST_RET != -1)
tst_brk(TBROK, "request_key() unexpectedly succeeded");
- if (TEST_ERRNO != ENOKEY && TEST_ERRNO != ENOENT) {
+ if (TST_ERR != ENOKEY && TST_ERR != ENOENT) {
tst_brk(TBROK | TTERRNO,
"request_key() failed with unexpected error");
}
@@ -60,11 +60,11 @@ static void try_to_read_negative_key(void)
/* Get the ID of the negative key by reading the keyring */
TEST(keyctl(KEYCTL_READ, KEY_SPEC_PROCESS_KEYRING,
&key_id, sizeof(key_id)));
- if (TEST_RETURN < 0)
+ if (TST_RET < 0)
tst_brk(TBROK | TTERRNO, "KEYCTL_READ unexpectedly failed");
- if (TEST_RETURN != sizeof(key_id)) {
+ if (TST_RET != sizeof(key_id)) {
tst_brk(TBROK, "KEYCTL_READ returned %ld but expected %zu",
- TEST_RETURN, sizeof(key_id));
+ TST_RET, sizeof(key_id));
}
/*
@@ -73,11 +73,11 @@ static void try_to_read_negative_key(void)
*/
tst_res(TINFO, "trying to read from the negative key...");
TEST(keyctl(KEYCTL_READ, key_id, buffer, sizeof(buffer)));
- if (TEST_RETURN != -1) {
+ if (TST_RET != -1) {
tst_brk(TFAIL,
"KEYCTL_READ on negative key unexpectedly succeeded");
}
- if (TEST_ERRNO != ENOKEY) {
+ if (TST_ERR != ENOKEY) {
tst_brk(TFAIL | TTERRNO,
"KEYCTL_READ on negative key failed with unexpected error");
}
diff --git a/testcases/kernel/syscalls/lgetxattr/lgetxattr01.c b/testcases/kernel/syscalls/lgetxattr/lgetxattr01.c
index 301d5325b..1165db00b 100644
--- a/testcases/kernel/syscalls/lgetxattr/lgetxattr01.c
+++ b/testcases/kernel/syscalls/lgetxattr/lgetxattr01.c
@@ -73,17 +73,17 @@ static void verify_lgetxattr(void)
char buf[size];
TEST(lgetxattr("symlink", SECURITY_KEY2, buf, size));
- if (TEST_RETURN == -1) {
+ if (TST_RET == -1) {
tst_res(TFAIL | TTERRNO, "lgetxattr() failed");
goto next;
}
- if (TEST_RETURN != strlen(VALUE2)) {
+ if (TST_RET != strlen(VALUE2)) {
tst_res(TFAIL, "lgetxattr() got unexpected value size");
goto next;
}
- if (!strncmp(buf, VALUE2, TEST_RETURN))
+ if (!strncmp(buf, VALUE2, TST_RET))
tst_res(TPASS, "lgetxattr() got expected value");
else
tst_res(TFAIL, "lgetxattr() got unexpected value");
@@ -91,12 +91,12 @@ static void verify_lgetxattr(void)
next:
TEST(lgetxattr("symlink", SECURITY_KEY1, buf, size));
- if (TEST_RETURN != -1) {
+ if (TST_RET != -1) {
tst_res(TFAIL, "lgetxattr() succeeded unexpectedly");
return;
}
- if (TEST_ERRNO == ENODATA) {
+ if (TST_ERR == ENODATA) {
tst_res(TPASS | TTERRNO, "lgetxattr() failed as expected");
} else {
tst_res(TFAIL | TTERRNO, "lgetxattr() failed unexpectedly,"
diff --git a/testcases/kernel/syscalls/lgetxattr/lgetxattr02.c b/testcases/kernel/syscalls/lgetxattr/lgetxattr02.c
index ebc28f29b..c29d5c02a 100644
--- a/testcases/kernel/syscalls/lgetxattr/lgetxattr02.c
+++ b/testcases/kernel/syscalls/lgetxattr/lgetxattr02.c
@@ -62,12 +62,12 @@ static void verify_lgetxattr(unsigned int n)
char buf[tc->size];
TEST(lgetxattr(tc->path, SECURITY_KEY, buf, sizeof(buf)));
- if (TEST_RETURN != -1) {
+ if (TST_RET != -1) {
tst_res(TFAIL, "lgetxattr() succeeded unexpectedly");
return;
}
- if (TEST_ERRNO != tc->exp_err) {
+ if (TST_ERR != tc->exp_err) {
tst_res(TFAIL | TTERRNO, "lgetxattr() failed unexpectedlly, "
"expected %s", tst_strerrno(tc->exp_err));
} else {
diff --git a/testcases/kernel/syscalls/link/link08.c b/testcases/kernel/syscalls/link/link08.c
index 986d5552e..775c0c27b 100644
--- a/testcases/kernel/syscalls/link/link08.c
+++ b/testcases/kernel/syscalls/link/link08.c
@@ -62,13 +62,13 @@ static void link_verify(unsigned int i)
TEST(link(tc->oldpath, tc->newpath));
- if (TEST_RETURN != -1) {
+ if (TST_RET != -1) {
tst_res(TFAIL, "link() succeeded unexpectedly (%li)",
- TEST_RETURN);
+ TST_RET);
return;
}
- if (TEST_ERRNO == tc->exp_errno) {
+ if (TST_ERR == tc->exp_errno) {
tst_res(TPASS | TTERRNO, "link() failed as expected");
return;
}
diff --git a/testcases/kernel/syscalls/listxattr/listxattr01.c b/testcases/kernel/syscalls/listxattr/listxattr01.c
index e2820ca1a..a59547b19 100644
--- a/testcases/kernel/syscalls/listxattr/listxattr01.c
+++ b/testcases/kernel/syscalls/listxattr/listxattr01.c
@@ -61,7 +61,7 @@ static void verify_listxattr(void)
char buf[64];
TEST(listxattr(TESTFILE, buf, sizeof(buf)));
- if (TEST_RETURN == -1) {
+ if (TST_RET == -1) {
tst_res(TFAIL | TTERRNO, "listxattr() failed");
return;
}
diff --git a/testcases/kernel/syscalls/listxattr/listxattr02.c b/testcases/kernel/syscalls/listxattr/listxattr02.c
index 998689a5a..33f57d567 100644
--- a/testcases/kernel/syscalls/listxattr/listxattr02.c
+++ b/testcases/kernel/syscalls/listxattr/listxattr02.c
@@ -69,14 +69,14 @@ static void verify_listxattr(unsigned int n)
char buf[t->size];
TEST(listxattr(t->path, buf, sizeof(buf)));
- if (TEST_RETURN != -1) {
+ if (TST_RET != -1) {
tst_res(TFAIL,
"listxattr() succeeded unexpectedly (returned %ld)",
- TEST_RETURN);
+ TST_RET);
return;
}
- if (t->exp_err != TEST_ERRNO) {
+ if (t->exp_err != TST_ERR) {
tst_res(TFAIL | TTERRNO, "listxattr() failed "
"unexpectedlly, expected %s",
tst_strerrno(t->exp_err));
diff --git a/testcases/kernel/syscalls/listxattr/listxattr03.c b/testcases/kernel/syscalls/listxattr/listxattr03.c
index 9dc7ad76f..dcfb6b1c4 100644
--- a/testcases/kernel/syscalls/listxattr/listxattr03.c
+++ b/testcases/kernel/syscalls/listxattr/listxattr03.c
@@ -57,12 +57,12 @@ static void verify_listxattr(unsigned int n)
const char *name = filename[n];
TEST(listxattr(name, NULL, 0));
- if (TEST_RETURN == -1) {
+ if (TST_RET == -1) {
tst_res(TFAIL | TTERRNO, "listxattr() failed");
return;
}
- if (check_suitable_buf(name, TEST_RETURN))
+ if (check_suitable_buf(name, TST_RET))
tst_res(TPASS, "listxattr() succeed with suitable buffer");
else
tst_res(TFAIL, "listxattr() failed with small buffer");
diff --git a/testcases/kernel/syscalls/llistxattr/llistxattr01.c b/testcases/kernel/syscalls/llistxattr/llistxattr01.c
index f997e0c79..98c1bdfce 100644
--- a/testcases/kernel/syscalls/llistxattr/llistxattr01.c
+++ b/testcases/kernel/syscalls/llistxattr/llistxattr01.c
@@ -62,7 +62,7 @@ static void verify_llistxattr(void)
char buf[64];
TEST(llistxattr(SYMLINK, buf, sizeof(buf)));
- if (TEST_RETURN == -1) {
+ if (TST_RET == -1) {
tst_res(TFAIL | TTERRNO, "llistxattr() failed");
return;
}
diff --git a/testcases/kernel/syscalls/llistxattr/llistxattr02.c b/testcases/kernel/syscalls/llistxattr/llistxattr02.c
index 468ff980c..d239e97bf 100644
--- a/testcases/kernel/syscalls/llistxattr/llistxattr02.c
+++ b/testcases/kernel/syscalls/llistxattr/llistxattr02.c
@@ -68,14 +68,14 @@ static void verify_llistxattr(unsigned int n)
char buf[t->size];
TEST(llistxattr(t->path, buf, sizeof(buf)));
- if (TEST_RETURN != -1) {
+ if (TST_RET != -1) {
tst_res(TFAIL,
"llistxattr() succeeded unexpectedly (returned %ld)",
- TEST_RETURN);
+ TST_RET);
return;
}
- if (TEST_ERRNO != t->exp_err) {
+ if (TST_ERR != t->exp_err) {
tst_res(TFAIL | TTERRNO, "llistxattr() failed "
"unexpectedlly, expected %s",
tst_strerrno(t->exp_err));
diff --git a/testcases/kernel/syscalls/llistxattr/llistxattr03.c b/testcases/kernel/syscalls/llistxattr/llistxattr03.c
index 91bb3f481..a62bc214e 100644
--- a/testcases/kernel/syscalls/llistxattr/llistxattr03.c
+++ b/testcases/kernel/syscalls/llistxattr/llistxattr03.c
@@ -56,12 +56,12 @@ static void verify_llistxattr(unsigned int n)
const char *name = filename[n];
TEST(llistxattr(name, NULL, 0));
- if (TEST_RETURN == -1) {
+ if (TST_RET == -1) {
tst_res(TFAIL | TTERRNO, "llistxattr() failed");
return;
}
- if (check_suitable_buf(name, TEST_RETURN))
+ if (check_suitable_buf(name, TST_RET))
tst_res(TPASS, "llistxattr() succeed with suitable buffer");
else
tst_res(TFAIL, "llistxattr() failed with small buffer");
diff --git a/testcases/kernel/syscalls/lseek/lseek01.c b/testcases/kernel/syscalls/lseek/lseek01.c
index 2e1c36e6f..e7753fd29 100644
--- a/testcases/kernel/syscalls/lseek/lseek01.c
+++ b/testcases/kernel/syscalls/lseek/lseek01.c
@@ -57,15 +57,15 @@ static void verify_lseek(unsigned int n)
memset(read_buf, 0, sizeof(read_buf));
TEST(lseek(fd, tc->off, tc->whence));
- if (TEST_RETURN == (off_t) -1) {
+ if (TST_RET == (off_t) -1) {
tst_res(TFAIL | TTERRNO, "lseek(%s, %ld, %s) failed", TFILE,
tc->off, tc->wname);
return;
}
- if (TEST_RETURN != tc->exp_off) {
+ if (TST_RET != tc->exp_off) {
tst_res(TFAIL, "lseek(%s, %ld, %s) returned %ld, expected %ld",
- TFILE, tc->off, tc->wname, TEST_RETURN, tc->exp_off);
+ TFILE, tc->off, tc->wname, TST_RET, tc->exp_off);
return;
}
diff --git a/testcases/kernel/syscalls/lseek/lseek02.c b/testcases/kernel/syscalls/lseek/lseek02.c
index 66c7bee31..0387d63be 100644
--- a/testcases/kernel/syscalls/lseek/lseek02.c
+++ b/testcases/kernel/syscalls/lseek/lseek02.c
@@ -71,13 +71,13 @@ static void verify_lseek(unsigned int n)
struct tcase *tc = &tcases[n];
TEST(lseek(*tc->fd, (off_t) 1, tc->whence));
- if (TEST_RETURN != (off_t) -1) {
+ if (TST_RET != (off_t) -1) {
tst_res(TFAIL, "lseek(%d, 1, %d) succeeded unexpectedly",
*tc->fd, tc->whence);
return;
}
- if (TEST_ERRNO == tc->exp_err) {
+ if (TST_ERR == tc->exp_err) {
tst_res(TPASS | TTERRNO, "lseek(%d, 1, %d) failed as expected",
*tc->fd, tc->whence);
} else {
diff --git a/testcases/kernel/syscalls/lseek/lseek07.c b/testcases/kernel/syscalls/lseek/lseek07.c
index b46856b9b..50732854a 100644
--- a/testcases/kernel/syscalls/lseek/lseek07.c
+++ b/testcases/kernel/syscalls/lseek/lseek07.c
@@ -54,15 +54,15 @@ static void verify_lseek(unsigned int n)
memset(read_buf, 0, sizeof(read_buf));
TEST(lseek(*tc->fd, tc->off, SEEK_SET));
- if (TEST_RETURN == (off_t) -1) {
+ if (TST_RET == (off_t) -1) {
tst_res(TFAIL | TTERRNO, "lseek(%s, %ld, SEEK_SET) failed",
tc->fname, tc->off);
return;
}
- if (TEST_RETURN != tc->exp_off) {
+ if (TST_RET != tc->exp_off) {
tst_res(TFAIL, "lseek(%s, %ld, SEEK_SET) returned %ld, expected %ld",
- tc->fname, tc->off, TEST_RETURN, tc->exp_off);
+ tc->fname, tc->off, TST_RET, tc->exp_off);
return;
}
diff --git a/testcases/kernel/syscalls/madvise/madvise01.c b/testcases/kernel/syscalls/madvise/madvise01.c
index 8d1d78747..ae08db67d 100644
--- a/testcases/kernel/syscalls/madvise/madvise01.c
+++ b/testcases/kernel/syscalls/madvise/madvise01.c
@@ -108,13 +108,13 @@ static void verify_madvise(unsigned int i)
TEST(madvise(*(tc->addr), st.st_size, tc->advice));
- if (TEST_RETURN == -1) {
- if (TEST_ERRNO == EINVAL) {
+ if (TST_RET == -1) {
+ if (TST_ERR == EINVAL) {
tst_res(TCONF, "%s is not supported", tc->name);
} else {
tst_res(TFAIL, "madvise test for %s failed with "
"return = %ld, errno = %d : %s",
- tc->name, TEST_RETURN, TEST_ERRNO,
+ tc->name, TST_RET, TST_ERR,
tst_strerrno(TFAIL | TTERRNO));
}
} else {
diff --git a/testcases/kernel/syscalls/madvise/madvise02.c b/testcases/kernel/syscalls/madvise/madvise02.c
index 4c357c514..53e4f517c 100644
--- a/testcases/kernel/syscalls/madvise/madvise02.c
+++ b/testcases/kernel/syscalls/madvise/madvise02.c
@@ -183,8 +183,8 @@ static void advice_test(unsigned int i)
}
TEST(madvise(*(tc->addr), st.st_size, tc->advice));
- if (TEST_RETURN == -1) {
- if (TEST_ERRNO == tc->exp_errno) {
+ if (TST_RET == -1) {
+ if (TST_ERR == tc->exp_errno) {
tst_res(TPASS | TTERRNO, "%s failed as expected", tc->name);
} else {
tst_res(TFAIL | TTERRNO,
diff --git a/testcases/kernel/syscalls/madvise/madvise05.c b/testcases/kernel/syscalls/madvise/madvise05.c
index 23dacbd3a..b38a12f79 100644
--- a/testcases/kernel/syscalls/madvise/madvise05.c
+++ b/testcases/kernel/syscalls/madvise/madvise05.c
@@ -38,17 +38,17 @@ static void verify_madvise(void)
MAP_PRIVATE | MAP_ANONYMOUS | MAP_POPULATE, -1, 0);
TEST(mprotect(p, ALLOC_SIZE, PROT_NONE));
- if (TEST_RETURN == -1)
+ if (TST_RET == -1)
tst_brk(TBROK | TTERRNO, "mprotect failed");
TEST(madvise(p, ALLOC_SIZE, MADV_WILLNEED));
SAFE_MUNMAP(p, ALLOC_SIZE);
- if (TEST_RETURN == 0) {
+ if (TST_RET == 0) {
tst_res(TPASS, "issue has not been reproduced");
return;
}
- if (TEST_ERRNO == EBADF)
+ if (TST_ERR == EBADF)
tst_brk(TCONF, "CONFIG_SWAP=n");
else
tst_brk(TBROK | TTERRNO, "madvise failed");
diff --git a/testcases/kernel/syscalls/madvise/madvise06.c b/testcases/kernel/syscalls/madvise/madvise06.c
index 7b178a230..c40aef851 100644
--- a/testcases/kernel/syscalls/madvise/madvise06.c
+++ b/testcases/kernel/syscalls/madvise/madvise06.c
@@ -140,7 +140,7 @@ static void test_advice_willneed(void)
tst_res(TINFO, "SwapCached (before madvise): %ld", swapcached_start);
TEST(madvise(target, CHUNK_SZ, MADV_WILLNEED));
- if (TEST_RETURN == -1)
+ if (TST_RET == -1)
tst_brk(TBROK | TERRNO, "madvise failed");
do {
diff --git a/testcases/kernel/syscalls/madvise/madvise10.c b/testcases/kernel/syscalls/madvise/madvise10.c
index 9cb3d2bf7..ca0b9f39b 100644
--- a/testcases/kernel/syscalls/madvise/madvise10.c
+++ b/testcases/kernel/syscalls/madvise/madvise10.c
@@ -102,8 +102,8 @@ static int set_advice(char *addr, int size, int advise)
{
TEST(madvise(addr, size, advise));
- if (TEST_RETURN == -1) {
- if (TEST_ERRNO == EINVAL) {
+ if (TST_RET == -1) {
+ if (TST_ERR == EINVAL) {
tst_res(TCONF, "madvise(%p, %d, 0x%x) is not supported",
addr, size, advise);
} else {
diff --git a/testcases/kernel/syscalls/mbind/mbind01.c b/testcases/kernel/syscalls/mbind/mbind01.c
index 4b63ed7d4..72345d07b 100644
--- a/testcases/kernel/syscalls/mbind/mbind01.c
+++ b/testcases/kernel/syscalls/mbind/mbind01.c
@@ -189,11 +189,11 @@ static void do_test(unsigned int i)
tc->test(i, p);
- if (TEST_RETURN >= 0) {
+ if (TST_RET >= 0) {
/* Check policy of the allocated memory */
TEST(get_mempolicy(&policy, getnodemask->maskp,
getnodemask->size, p, MPOL_F_ADDR));
- if (TEST_RETURN < 0) {
+ if (TST_RET < 0) {
tst_res(TFAIL | TTERRNO, "get_mempolicy failed");
return;
}
@@ -216,12 +216,12 @@ static void do_test(unsigned int i)
}
}
- if (TEST_RETURN != tc->ret) {
+ if (TST_RET != tc->ret) {
tst_res(TFAIL, "wrong return code: %ld, expected: %d",
- TEST_RETURN, tc->ret);
+ TST_RET, tc->ret);
fail = 1;
}
- if (TEST_RETURN == -1 && TEST_ERRNO != tc->err) {
+ if (TST_RET == -1 && TST_ERR != tc->err) {
tst_res(TFAIL | TTERRNO, "expected errno: %s, got",
tst_strerrno(tc->err));
fail = 1;
diff --git a/testcases/kernel/syscalls/memfd_create/memfd_create02.c b/testcases/kernel/syscalls/memfd_create/memfd_create02.c
index bc01e4452..80cd5c405 100644
--- a/testcases/kernel/syscalls/memfd_create/memfd_create02.c
+++ b/testcases/kernel/syscalls/memfd_create/memfd_create02.c
@@ -88,13 +88,13 @@ static void verify_memfd_create_errno(unsigned int n)
}
TEST(sys_memfd_create(tc->memfd_name, tc->flags));
- if (TEST_ERRNO != tc->memfd_create_exp_err)
+ if (TST_ERR != tc->memfd_create_exp_err)
tst_brk(TFAIL, "test '%s'", tc->descr);
else
tst_res(TPASS, "test '%s'", tc->descr);
- if (TEST_RETURN > 0)
- SAFE_CLOSE(TEST_RETURN);
+ if (TST_RET > 0)
+ SAFE_CLOSE(TST_RET);
}
static struct tst_test test = {
diff --git a/testcases/kernel/syscalls/memfd_create/memfd_create_common.c b/testcases/kernel/syscalls/memfd_create/memfd_create_common.c
index f22e3d345..7a84eba05 100644
--- a/testcases/kernel/syscalls/memfd_create/memfd_create_common.c
+++ b/testcases/kernel/syscalls/memfd_create/memfd_create_common.c
@@ -129,8 +129,8 @@ int mfd_flags_available(const char *filename, const int lineno,
unsigned int flags)
{
TEST(sys_memfd_create("dummy_call", flags));
- if (TEST_RETURN < 0) {
- if (TEST_ERRNO != EINVAL) {
+ if (TST_RET < 0) {
+ if (TST_ERR != EINVAL) {
tst_brk_(filename, lineno, TBROK | TTERRNO,
"memfd_create() failed");
}
@@ -138,7 +138,7 @@ int mfd_flags_available(const char *filename, const int lineno,
return 0;
}
- SAFE_CLOSE(TEST_RETURN);
+ SAFE_CLOSE(TST_RET);
return 1;
}
@@ -377,8 +377,8 @@ void check_mfd_non_writeable(const char *filename, const int lineno,
/* verify write() fails */
TEST(write(fd, "data", 4));
- if (TEST_RETURN < 0) {
- if (TEST_ERRNO != EPERM) {
+ if (TST_RET < 0) {
+ if (TST_ERR != EPERM) {
tst_brk_(filename, lineno, TFAIL | TTERRNO,
"write() didn't fail as expected");
}
diff --git a/testcases/kernel/syscalls/mkdir/mkdir03.c b/testcases/kernel/syscalls/mkdir/mkdir03.c
index 9441afee2..8cadf9c21 100644
--- a/testcases/kernel/syscalls/mkdir/mkdir03.c
+++ b/testcases/kernel/syscalls/mkdir/mkdir03.c
@@ -65,13 +65,13 @@ static void verify_mkdir(unsigned int n)
struct tcase *tc = TC + n;
TEST(mkdir(tc->pathname, MODE));
- if (TEST_RETURN != -1) {
+ if (TST_RET != -1) {
tst_res(TFAIL, "mkdir() returned %ld, expected -1, errno=%d",
- TEST_RETURN, tc->exp_errno);
+ TST_RET, tc->exp_errno);
return;
}
- if (TEST_ERRNO == tc->exp_errno) {
+ if (TST_ERR == tc->exp_errno) {
tst_res(TPASS | TTERRNO, "mkdir() failed as expected");
} else {
tst_res(TFAIL | TTERRNO,
diff --git a/testcases/kernel/syscalls/mkdir/mkdir05.c b/testcases/kernel/syscalls/mkdir/mkdir05.c
index c3d5f0d3c..bc029c3c7 100644
--- a/testcases/kernel/syscalls/mkdir/mkdir05.c
+++ b/testcases/kernel/syscalls/mkdir/mkdir05.c
@@ -35,7 +35,7 @@ static void verify_mkdir(void)
struct stat buf;
TEST(mkdir(TESTDIR, PERMS));
- if (TEST_RETURN == -1) {
+ if (TST_RET == -1) {
tst_res(TFAIL | TTERRNO, "mkdir() Failed");
return;
}
diff --git a/testcases/kernel/syscalls/mkdirat/mkdirat02.c b/testcases/kernel/syscalls/mkdirat/mkdirat02.c
index b2f86efa8..fbe172e11 100644
--- a/testcases/kernel/syscalls/mkdirat/mkdirat02.c
+++ b/testcases/kernel/syscalls/mkdirat/mkdirat02.c
@@ -67,13 +67,13 @@ static void mkdirat_verify(unsigned int i)
TEST(mkdirat(*test->dirfd, test->pathname, 0777));
- if (TEST_RETURN != -1) {
+ if (TST_RET != -1) {
tst_res(TFAIL, "mkdirat() succeeded unexpectedly (%li)",
- TEST_RETURN);
+ TST_RET);
return;
}
- if (TEST_ERRNO == test->exp_errno) {
+ if (TST_ERR == test->exp_errno) {
tst_res(TPASS | TTERRNO, "mkdirat() failed as expected");
return;
}
diff --git a/testcases/kernel/syscalls/move_pages/move_pages12.c b/testcases/kernel/syscalls/move_pages/move_pages12.c
index 5e6245d3a..b1187e307 100644
--- a/testcases/kernel/syscalls/move_pages/move_pages12.c
+++ b/testcases/kernel/syscalls/move_pages/move_pages12.c
@@ -87,7 +87,7 @@ static void do_child(void)
TEST(numa_move_pages(ppid, test_pages,
pages, nodes, status, MPOL_MF_MOVE_ALL));
- if (TEST_RETURN) {
+ if (TST_RET) {
tst_res(TFAIL | TTERRNO, "move_pages failed");
break;
}
@@ -166,9 +166,9 @@ static void alloc_free_huge_on_node(unsigned int node, size_t size)
}
TEST(mlock(mem, size));
- if (TEST_RETURN) {
+ if (TST_RET) {
SAFE_MUNMAP(mem, size);
- if (TEST_ERRNO == ENOMEM || TEST_ERRNO == EAGAIN)
+ if (TST_ERR == ENOMEM || TST_ERR == EAGAIN)
tst_brk(TCONF, "Cannot lock huge pages");
tst_brk(TBROK | TTERRNO, "mlock failed");
}
diff --git a/testcases/kernel/syscalls/mq_notify/mq_notify01.c b/testcases/kernel/syscalls/mq_notify/mq_notify01.c
index b4d0c92c9..c1d789d5b 100644
--- a/testcases/kernel/syscalls/mq_notify/mq_notify01.c
+++ b/testcases/kernel/syscalls/mq_notify/mq_notify01.c
@@ -149,8 +149,8 @@ static void do_test(unsigned int i)
TEST(mq_notify(*tc->fd, &ev));
- if (TEST_RETURN < 0) {
- if (tc->err != TEST_ERRNO)
+ if (TST_RET < 0) {
+ if (tc->err != TST_ERR)
tst_res(TFAIL | TTERRNO,
"mq_notify failed unexpectedly, expected %s",
tst_strerrno(tc->err));
@@ -170,7 +170,7 @@ static void do_test(unsigned int i)
if (*tc->fd == fd)
cleanup_queue(fd);
- if (TEST_RETURN < 0) {
+ if (TST_RET < 0) {
tst_res(TFAIL | TTERRNO, "mq_timedsend failed");
return;
}
@@ -191,8 +191,8 @@ static void do_test(unsigned int i)
info.si_uid, getuid());
}
- if (TEST_RETURN < 0) {
- if (tc->err != TEST_ERRNO)
+ if (TST_RET < 0) {
+ if (tc->err != TST_ERR)
tst_res(TFAIL | TTERRNO,
"mq_timedsend failed unexpectedly, expected %s",
tst_strerrno(tc->err));
@@ -201,9 +201,9 @@ static void do_test(unsigned int i)
return;
}
- if (tc->ret != TEST_RETURN) {
+ if (tc->ret != TST_RET) {
tst_res(TFAIL, "mq_timedsend returned %ld, expected %d",
- TEST_RETURN, tc->ret);
+ TST_RET, tc->ret);
return;
}
diff --git a/testcases/kernel/syscalls/mq_open/mq_open01.c b/testcases/kernel/syscalls/mq_open/mq_open01.c
index 3f4bf7e3b..58067cfa4 100644
--- a/testcases/kernel/syscalls/mq_open/mq_open01.c
+++ b/testcases/kernel/syscalls/mq_open/mq_open01.c
@@ -261,36 +261,36 @@ static void do_test(unsigned int i)
}
if (tc->ret == 0) {
- if (TEST_RETURN < 0) {
+ if (TST_RET < 0) {
tst_res(TFAIL | TTERRNO, "%s wrong return code: %ld",
- tc->desc, TEST_RETURN);
+ tc->desc, TST_RET);
} else {
tst_res(TPASS | TTERRNO, "%s returned: %ld",
- tc->desc, TEST_RETURN);
+ tc->desc, TST_RET);
}
goto CLEANUP;
}
- if (TEST_ERRNO != tc->err) {
+ if (TST_ERR != tc->err) {
tst_res(TFAIL | TTERRNO, "%s expected errno: %d",
- tc->desc, TEST_ERRNO);
+ tc->desc, TST_ERR);
goto CLEANUP;
}
- if (TEST_RETURN != tc->ret) {
+ if (TST_RET != tc->ret) {
tst_res(TFAIL | TTERRNO, "%s wrong return code: %ld",
- tc->desc, TEST_RETURN);
+ tc->desc, TST_RET);
} else {
tst_res(TPASS | TTERRNO, "%s returned: %ld",
- tc->desc, TEST_RETURN);
+ tc->desc, TST_RET);
}
CLEANUP:
if (tc->cleanup)
tc->cleanup();
- if (TEST_RETURN != -1) {
+ if (TST_RET != -1) {
if (fd > 0)
SAFE_CLOSE(fd);
mq_unlink(qname);
diff --git a/testcases/kernel/syscalls/mq_timedreceive/mq_timedreceive01.c b/testcases/kernel/syscalls/mq_timedreceive/mq_timedreceive01.c
index f3f5295c1..1be515ced 100644
--- a/testcases/kernel/syscalls/mq_timedreceive/mq_timedreceive01.c
+++ b/testcases/kernel/syscalls/mq_timedreceive/mq_timedreceive01.c
@@ -160,8 +160,8 @@ static void do_test(unsigned int i)
if (*tc->fd == fd)
cleanup_queue(fd);
- if (TEST_RETURN < 0) {
- if (tc->err != TEST_ERRNO)
+ if (TST_RET < 0) {
+ if (tc->err != TST_ERR)
tst_res(TFAIL | TTERRNO,
"mq_timedreceive failed unexpectedly, expected %s",
tst_strerrno(tc->err));
@@ -171,9 +171,9 @@ static void do_test(unsigned int i)
return;
}
- if (tc->len != TEST_RETURN) {
+ if (tc->len != TST_RET) {
tst_res(TFAIL, "mq_timedreceive wrong length %ld, expected %zu",
- TEST_RETURN, tc->len);
+ TST_RET, tc->len);
return;
}
@@ -193,7 +193,7 @@ static void do_test(unsigned int i)
}
tst_res(TPASS, "mq_timedreceive returned %ld, priority %u, length: %zu",
- TEST_RETURN, prio, len);
+ TST_RET, prio, len);
}
static struct tst_test test = {
diff --git a/testcases/kernel/syscalls/mq_timedsend/mq_timedsend01.c b/testcases/kernel/syscalls/mq_timedsend/mq_timedsend01.c
index d54de1d65..8f209d396 100644
--- a/testcases/kernel/syscalls/mq_timedsend/mq_timedsend01.c
+++ b/testcases/kernel/syscalls/mq_timedsend/mq_timedsend01.c
@@ -161,8 +161,8 @@ static void do_test(unsigned int i)
if (pid > 0)
kill_pid(pid);
- if (TEST_RETURN < 0) {
- if (tc->err != TEST_ERRNO)
+ if (TST_RET < 0) {
+ if (tc->err != TST_ERR)
tst_res(TFAIL | TTERRNO,
"mq_timedsend failed unexpectedly, expected %s",
tst_strerrno(tc->err));
@@ -180,8 +180,8 @@ static void do_test(unsigned int i)
if (*tc->fd == fd)
cleanup_queue(fd);
- if (TEST_RETURN < 0) {
- if (tc->err != TEST_ERRNO) {
+ if (TST_RET < 0) {
+ if (tc->err != TST_ERR) {
tst_res(TFAIL | TTERRNO,
"mq_timedreceive failed unexpectedly, expected %s",
tst_strerrno(tc->err));
@@ -190,14 +190,14 @@ static void do_test(unsigned int i)
if (tc->ret >= 0) {
tst_res(TFAIL | TTERRNO, "mq_timedreceive returned %ld, expected %d",
- TEST_RETURN, tc->ret);
+ TST_RET, tc->ret);
return;
}
}
- if (tc->len != TEST_RETURN) {
+ if (tc->len != TST_RET) {
tst_res(TFAIL, "mq_timedreceive wrong length %ld, expected %d",
- TEST_RETURN, tc->len);
+ TST_RET, tc->len);
return;
}
@@ -217,7 +217,7 @@ static void do_test(unsigned int i)
}
tst_res(TPASS, "mq_timedreceive returned %ld, priority %u, length: %zu",
- TEST_RETURN, prio, len);
+ TST_RET, prio, len);
}
static struct tst_test test = {
diff --git a/testcases/kernel/syscalls/mq_unlink/mq_unlink01.c b/testcases/kernel/syscalls/mq_unlink/mq_unlink01.c
index 6e271c5d1..8c9126de5 100644
--- a/testcases/kernel/syscalls/mq_unlink/mq_unlink01.c
+++ b/testcases/kernel/syscalls/mq_unlink/mq_unlink01.c
@@ -104,12 +104,12 @@ static void do_test(unsigned int i)
/* test */
TEST(mq_unlink(tc->qname));
- if (TEST_ERRNO != tc->err || TEST_RETURN != tc->ret) {
+ if (TST_ERR != tc->err || TST_RET != tc->ret) {
tst_res(TFAIL | TTERRNO, "mq_unlink returned %ld, expected %d,"
- " expected errno %s (%d)", TEST_RETURN,
+ " expected errno %s (%d)", TST_RET,
tc->ret, tst_strerrno(tc->err), tc->err);
} else {
- tst_res(TPASS | TTERRNO, "mq_unlink returned %ld", TEST_RETURN);
+ tst_res(TPASS | TTERRNO, "mq_unlink returned %ld", TST_RET);
}
EXIT:
diff --git a/testcases/kernel/syscalls/nanosleep/nanosleep01.c b/testcases/kernel/syscalls/nanosleep/nanosleep01.c
index bcec1f8f6..96e1cf1b4 100644
--- a/testcases/kernel/syscalls/nanosleep/nanosleep01.c
+++ b/testcases/kernel/syscalls/nanosleep/nanosleep01.c
@@ -37,9 +37,9 @@ int sample_fn(int clk_id, long long usec)
tst_timer_stop();
tst_timer_sample();
- if (TEST_RETURN != 0) {
+ if (TST_RET != 0) {
tst_res(TFAIL | TERRNO,
- "nanosleep() returned %li", TEST_RETURN);
+ "nanosleep() returned %li", TST_RET);
return 1;
}
diff --git a/testcases/kernel/syscalls/nice/nice01.c b/testcases/kernel/syscalls/nice/nice01.c
index fede2c79f..82791a52a 100644
--- a/testcases/kernel/syscalls/nice/nice01.c
+++ b/testcases/kernel/syscalls/nice/nice01.c
@@ -39,13 +39,13 @@ static void verify_nice(void)
TEST(nice(NICEINC));
- if (TEST_RETURN != (orig_nice + NICEINC)) {
+ if (TST_RET != (orig_nice + NICEINC)) {
tst_res(TFAIL | TTERRNO, "nice(%d) returned %li, expected %i",
- NICEINC, TEST_RETURN, orig_nice + NICEINC);
+ NICEINC, TST_RET, orig_nice + NICEINC);
return;
}
- if (TEST_ERRNO) {
+ if (TST_ERR) {
tst_res(TFAIL | TTERRNO, "nice(%d) failed", NICEINC);
return;
}
@@ -61,7 +61,7 @@ static void verify_nice(void)
tst_res(TPASS, "nice(%d) passed", NICEINC);
TEST(nice(-NICEINC));
- if (TEST_ERRNO)
+ if (TST_ERR)
tst_brk(TBROK | TERRNO, "nice(-NICEINC) failed");
}
diff --git a/testcases/kernel/syscalls/nice/nice02.c b/testcases/kernel/syscalls/nice/nice02.c
index 6ae70f8f1..03fd17182 100644
--- a/testcases/kernel/syscalls/nice/nice02.c
+++ b/testcases/kernel/syscalls/nice/nice02.c
@@ -38,12 +38,12 @@ static void verify_nice(void)
TEST(nice(NICEINC));
- if (TEST_RETURN == -1) {
+ if (TST_RET == -1) {
tst_res(TFAIL | TTERRNO, "nice(%d) returned -1", NICEINC);
return;
}
- if (TEST_ERRNO) {
+ if (TST_ERR) {
tst_res(TFAIL | TTERRNO, "nice(%d) failed", NICEINC);
return;
}
@@ -59,7 +59,7 @@ static void verify_nice(void)
tst_res(TPASS, "nice(%d) passed", NICEINC);
TEST(nice(DEFAULT_PRIO));
- if (TEST_ERRNO)
+ if (TST_ERR)
tst_brk(TBROK | TERRNO, "nice(-NICEINC) failed");
}
diff --git a/testcases/kernel/syscalls/nice/nice03.c b/testcases/kernel/syscalls/nice/nice03.c
index 7c41e2856..17200179a 100644
--- a/testcases/kernel/syscalls/nice/nice03.c
+++ b/testcases/kernel/syscalls/nice/nice03.c
@@ -39,12 +39,12 @@ static void nice_test(void)
TEST(nice(NICEINC));
- if (TEST_RETURN == -1) {
+ if (TST_RET == -1) {
tst_res(TFAIL | TTERRNO, "nice(%d) returned -1", NICEINC);
return;
}
- if (TEST_ERRNO) {
+ if (TST_ERR) {
tst_res(TFAIL | TTERRNO, "nice(%d) failed", NICEINC);
return;
}
diff --git a/testcases/kernel/syscalls/nice/nice04.c b/testcases/kernel/syscalls/nice/nice04.c
index 07ad21e66..56d76f8c6 100644
--- a/testcases/kernel/syscalls/nice/nice04.c
+++ b/testcases/kernel/syscalls/nice/nice04.c
@@ -32,13 +32,13 @@ static void verify_nice(void)
{
TEST(nice(NICEINC));
- if (TEST_RETURN != -1) {
+ if (TST_RET != -1) {
tst_res(TFAIL, "nice(%i) succeded unexpectedly (returned %li)",
- NICEINC, TEST_RETURN);
+ NICEINC, TST_RET);
return;
}
- if (TEST_ERRNO != EPERM) {
+ if (TST_ERR != EPERM) {
tst_res(TFAIL | TTERRNO, "nice(%i) should fail with EPERM",
NICEINC);
return;
diff --git a/testcases/kernel/syscalls/open/open01.c b/testcases/kernel/syscalls/open/open01.c
index 43305b2ef..cecb77e0b 100644
--- a/testcases/kernel/syscalls/open/open01.c
+++ b/testcases/kernel/syscalls/open/open01.c
@@ -59,7 +59,7 @@ static void verify_open(unsigned int n)
struct stat buf;
TEST(open(tc->filename, tc->flag, tc->mode));
- fd = TEST_RETURN;
+ fd = TST_RET;
if (fd == -1) {
tst_res(TFAIL, "Cannot open a file");
return;
diff --git a/testcases/kernel/syscalls/open/open02.c b/testcases/kernel/syscalls/open/open02.c
index f09bfe03d..4b1f5b4db 100644
--- a/testcases/kernel/syscalls/open/open02.c
+++ b/testcases/kernel/syscalls/open/open02.c
@@ -63,13 +63,13 @@ static void verify_open(unsigned int n)
TEST(open(tc->filename, tc->flag, 0444));
- if (TEST_RETURN != -1) {
+ if (TST_RET != -1) {
tst_res(TFAIL, "open(%s) succeeded unexpectedly",
tc->filename);
return;
}
- if (tc->exp_errno != TEST_ERRNO) {
+ if (tc->exp_errno != TST_ERR) {
tst_res(TFAIL | TTERRNO,
"open() should fail with %s",
tst_strerrno(tc->exp_errno));
diff --git a/testcases/kernel/syscalls/open/open08.c b/testcases/kernel/syscalls/open/open08.c
index 0a06d3afe..fb19a805d 100644
--- a/testcases/kernel/syscalls/open/open08.c
+++ b/testcases/kernel/syscalls/open/open08.c
@@ -86,19 +86,19 @@ void verify_open(unsigned int i)
TEST(open(*tcases[i].fname, tcases[i].flags,
S_IRUSR | S_IWUSR | S_IRGRP | S_IROTH));
- if (TEST_RETURN != -1) {
+ if (TST_RET != -1) {
tst_res(TFAIL, "call succeeded unexpectedly");
return;
}
- if (TEST_ERRNO == tcases[i].error) {
+ if (TST_ERR == tcases[i].error) {
tst_res(TPASS, "expected failure - "
- "errno = %d : %s", TEST_ERRNO,
- strerror(TEST_ERRNO));
+ "errno = %d : %s", TST_ERR,
+ strerror(TST_ERR));
} else {
tst_res(TFAIL, "unexpected error - %d : %s - "
- "expected %d", TEST_ERRNO,
- strerror(TEST_ERRNO), tcases[i].error);
+ "expected %d", TST_ERR,
+ strerror(TST_ERR), tcases[i].error);
}
}
diff --git a/testcases/kernel/syscalls/pause/pause01.c b/testcases/kernel/syscalls/pause/pause01.c
index 1c5585535..3afa78927 100644
--- a/testcases/kernel/syscalls/pause/pause01.c
+++ b/testcases/kernel/syscalls/pause/pause01.c
@@ -29,9 +29,9 @@ static void do_child(void)
TST_CHECKPOINT_WAKE(0);
TEST(pause());
- if (TEST_RETURN != -1)
+ if (TST_RET != -1)
tst_res(TFAIL, "pause() succeeded unexpectedly");
- else if (TEST_ERRNO == EINTR)
+ else if (TST_ERR == EINTR)
tst_res(TPASS, "pause() interrupted with EINTR");
else
tst_res(TFAIL | TTERRNO, "pause() unexpected errno");
diff --git a/testcases/kernel/syscalls/pipe/pipe01.c b/testcases/kernel/syscalls/pipe/pipe01.c
index 8f71460c4..0c681b300 100644
--- a/testcases/kernel/syscalls/pipe/pipe01.c
+++ b/testcases/kernel/syscalls/pipe/pipe01.c
@@ -35,7 +35,7 @@ static void verify_pipe(void)
TEST(pipe(fds));
- if (TEST_RETURN == -1) {
+ if (TST_RET == -1) {
tst_res(TFAIL | TTERRNO, "pipe()");
return;
}
diff --git a/testcases/kernel/syscalls/pipe/pipe02.c b/testcases/kernel/syscalls/pipe/pipe02.c
index 8defa5eb2..9afb8f8a7 100644
--- a/testcases/kernel/syscalls/pipe/pipe02.c
+++ b/testcases/kernel/syscalls/pipe/pipe02.c
@@ -58,7 +58,7 @@ static void verify_pipe(void)
#endif
TEST(pipe(fd));
- if (TEST_RETURN == -1) {
+ if (TST_RET == -1) {
tst_res(TFAIL|TERRNO, "pipe() failed");
return;
}
diff --git a/testcases/kernel/syscalls/pipe/pipe03.c b/testcases/kernel/syscalls/pipe/pipe03.c
index 267cf88cc..77496b615 100644
--- a/testcases/kernel/syscalls/pipe/pipe03.c
+++ b/testcases/kernel/syscalls/pipe/pipe03.c
@@ -31,13 +31,13 @@ static void verify_pipe(void)
char buf[2];
TEST(pipe(fd));
- if (TEST_RETURN == -1) {
+ if (TST_RET == -1) {
tst_res(TFAIL | TTERRNO, "pipe() failed unexpectedly");
return;
}
TEST(write(fd[0], "A", 1));
- if (TEST_RETURN == -1 && errno == EBADF) {
+ if (TST_RET == -1 && errno == EBADF) {
tst_res(TPASS | TTERRNO, "expected failure writing "
"to read end of pipe");
} else {
@@ -46,7 +46,7 @@ static void verify_pipe(void)
}
TEST(read(fd[1], buf, 1));
- if (TEST_RETURN == -1 && errno == EBADF) {
+ if (TST_RET == -1 && errno == EBADF) {
tst_res(TPASS | TTERRNO, "expected failure reading "
"from write end of pipe");
} else {
diff --git a/testcases/kernel/syscalls/poll/poll01.c b/testcases/kernel/syscalls/poll/poll01.c
index f11022b19..4e82d0323 100644
--- a/testcases/kernel/syscalls/poll/poll01.c
+++ b/testcases/kernel/syscalls/poll/poll01.c
@@ -42,7 +42,7 @@ static void verify_pollout(void)
TEST(poll(outfds, 1, -1));
- if (TEST_RETURN == -1) {
+ if (TST_RET == -1) {
tst_res(TFAIL | TTERRNO, "poll() POLLOUT failed");
return;
}
@@ -68,7 +68,7 @@ static void verify_pollin(void)
TEST(poll(infds, 1, -1));
- if (TEST_RETURN == -1) {
+ if (TST_RET == -1) {
tst_res(TFAIL | TTERRNO, "poll() POLLIN failed");
goto end;
}
diff --git a/testcases/kernel/syscalls/poll/poll02.c b/testcases/kernel/syscalls/poll/poll02.c
index b85df2926..98f0c89d5 100644
--- a/testcases/kernel/syscalls/poll/poll02.c
+++ b/testcases/kernel/syscalls/poll/poll02.c
@@ -41,8 +41,8 @@ int sample_fn(int clk_id, long long usec)
tst_timer_stop();
tst_timer_sample();
- if (TEST_RETURN != 0) {
- tst_res(TFAIL | TTERRNO, "poll() returned %li", TEST_RETURN);
+ if (TST_RET != 0) {
+ tst_res(TFAIL | TTERRNO, "poll() returned %li", TST_RET);
return 1;
}
diff --git a/testcases/kernel/syscalls/prctl/prctl01.c b/testcases/kernel/syscalls/prctl/prctl01.c
index b235981e6..6ec41f143 100644
--- a/testcases/kernel/syscalls/prctl/prctl01.c
+++ b/testcases/kernel/syscalls/prctl/prctl01.c
@@ -17,7 +17,7 @@ static void verify_prctl(void)
int get_sig = 0;
TEST(prctl(PR_SET_PDEATHSIG, SIGUSR2));
- if (TEST_RETURN == -1) {
+ if (TST_RET == -1) {
tst_res(TFAIL | TTERRNO, "prctl(PR_SET_PDEATHSIG) failed");
return;
}
@@ -25,7 +25,7 @@ static void verify_prctl(void)
tst_res(TPASS, "prctl(PR_SET_PDEATHSIG) succeeded");
TEST(prctl(PR_GET_PDEATHSIG, &get_sig));
- if (TEST_RETURN == -1) {
+ if (TST_RET == -1) {
tst_res(TFAIL | TTERRNO, "prctl(PR_GET_PDEATHSIG) failed");
return;
}
diff --git a/testcases/kernel/syscalls/prctl/prctl02.c b/testcases/kernel/syscalls/prctl/prctl02.c
index ee4a6afe4..a6a852011 100644
--- a/testcases/kernel/syscalls/prctl/prctl02.c
+++ b/testcases/kernel/syscalls/prctl/prctl02.c
@@ -30,12 +30,12 @@ static void verify_prctl(unsigned int n)
struct tcase *tc = &tcases[n];
TEST(prctl(tc->option, tc->arg2));
- if (TEST_RETURN == 0) {
+ if (TST_RET == 0) {
tst_res(TFAIL, "prctl() succeeded unexpectedly");
return;
}
- if (tc->exp_errno == TEST_ERRNO) {
+ if (tc->exp_errno == TST_ERR) {
tst_res(TPASS | TTERRNO, "prctl() failed as expected");
} else {
tst_res(TPASS | TTERRNO, "prctl() failed unexpectedly, expected %s",
diff --git a/testcases/kernel/syscalls/preadv/preadv01.c b/testcases/kernel/syscalls/preadv/preadv01.c
index 5ee27fbdb..0565a086b 100644
--- a/testcases/kernel/syscalls/preadv/preadv01.c
+++ b/testcases/kernel/syscalls/preadv/preadv01.c
@@ -62,14 +62,14 @@ void verify_preadv(unsigned int n)
SAFE_LSEEK(fd, 0, SEEK_SET);
TEST(preadv(fd, rd_iovec, tc->count, tc->offset));
- if (TEST_RETURN < 0) {
+ if (TST_RET < 0) {
tst_res(TFAIL | TTERRNO, "Preadv(2) failed");
return;
}
- if (TEST_RETURN != tc->size) {
+ if (TST_RET != tc->size) {
tst_res(TFAIL, "Preadv(2) read %li bytes, expected %zi",
- TEST_RETURN, tc->size);
+ TST_RET, tc->size);
return;
}
diff --git a/testcases/kernel/syscalls/preadv/preadv02.c b/testcases/kernel/syscalls/preadv/preadv02.c
index c171d8358..af1c3b0c4 100644
--- a/testcases/kernel/syscalls/preadv/preadv02.c
+++ b/testcases/kernel/syscalls/preadv/preadv02.c
@@ -88,12 +88,12 @@ static void verify_preadv(unsigned int n)
TEST(preadv(*tc->fd, tc->name, tc->count, tc->offset));
- if (TEST_RETURN == 0) {
+ if (TST_RET == 0) {
tst_res(TFAIL, "preadv() succeeded unexpectedly");
return;
}
- if (TEST_ERRNO == tc->exp_err) {
+ if (TST_ERR == tc->exp_err) {
tst_res(TPASS | TTERRNO, "preadv() failed as expected");
return;
}
diff --git a/testcases/kernel/syscalls/preadv/preadv03.c b/testcases/kernel/syscalls/preadv/preadv03.c
index 2f23ff31f..f09325df5 100644
--- a/testcases/kernel/syscalls/preadv/preadv03.c
+++ b/testcases/kernel/syscalls/preadv/preadv03.c
@@ -69,14 +69,14 @@ static void verify_direct_preadv(unsigned int n)
SAFE_LSEEK(fd, 0, SEEK_SET);
TEST(preadv(fd, rd_iovec, tc->count, *tc->offset));
- if (TEST_RETURN < 0) {
+ if (TST_RET < 0) {
tst_res(TFAIL | TTERRNO, "preadv(O_DIRECT) fails");
return;
}
- if (TEST_RETURN != *tc->size) {
+ if (TST_RET != *tc->size) {
tst_res(TFAIL, "preadv(O_DIRECT) read %li bytes, expected %zi",
- TEST_RETURN, *tc->size);
+ TST_RET, *tc->size);
return;
}
diff --git a/testcases/kernel/syscalls/pselect/pselect01.c b/testcases/kernel/syscalls/pselect/pselect01.c
index 139268925..0052b97ab 100644
--- a/testcases/kernel/syscalls/pselect/pselect01.c
+++ b/testcases/kernel/syscalls/pselect/pselect01.c
@@ -34,9 +34,9 @@ int sample_fn(int clk_id, long long usec)
tst_timer_stop();
tst_timer_sample();
- if (TEST_RETURN != 0) {
+ if (TST_RET != 0) {
tst_res(TFAIL | TTERRNO,
- "pselect() returned %li on timeout", TEST_RETURN);
+ "pselect() returned %li on timeout", TST_RET);
return 1;
}
diff --git a/testcases/kernel/syscalls/pselect/pselect03.c b/testcases/kernel/syscalls/pselect/pselect03.c
index 4a2b849d8..d93ee5dd2 100644
--- a/testcases/kernel/syscalls/pselect/pselect03.c
+++ b/testcases/kernel/syscalls/pselect/pselect03.c
@@ -39,8 +39,8 @@ static void verify_pselect(void)
FD_SET(fd, &readfds);
TEST(pselect(fd, &readfds, 0, 0, &tv, NULL));
- if (TEST_RETURN >= 0)
- tst_res(TPASS, "pselect() succeeded retval=%li", TEST_RETURN);
+ if (TST_RET >= 0)
+ tst_res(TPASS, "pselect() succeeded retval=%li", TST_RET);
else
tst_res(TFAIL | TTERRNO, "pselect() failed unexpectedly");
}
diff --git a/testcases/kernel/syscalls/ptrace/ptrace07.c b/testcases/kernel/syscalls/ptrace/ptrace07.c
index 82698a4ca..46ae59a10 100644
--- a/testcases/kernel/syscalls/ptrace/ptrace07.c
+++ b/testcases/kernel/syscalls/ptrace/ptrace07.c
@@ -113,19 +113,19 @@ static void do_test(void)
sched_yield();
TEST(ptrace(PTRACE_ATTACH, pid, 0, 0));
- if (TEST_RETURN != 0)
+ if (TST_RET != 0)
tst_brk(TBROK | TTERRNO, "PTRACE_ATTACH failed");
SAFE_WAITPID(pid, NULL, 0);
TEST(ptrace(PTRACE_GETREGSET, pid, NT_X86_XSTATE, &iov));
- if (TEST_RETURN != 0) {
- if (TEST_ERRNO == EIO)
+ if (TST_RET != 0) {
+ if (TST_ERR == EIO)
tst_brk(TCONF, "GETREGSET/SETREGSET is unsupported");
- if (TEST_ERRNO == EINVAL)
+ if (TST_ERR == EINVAL)
tst_brk(TCONF, "NT_X86_XSTATE is unsupported");
- if (TEST_ERRNO == ENODEV)
+ if (TST_ERR == ENODEV)
tst_brk(TCONF, "CPU doesn't support XSAVE instruction");
tst_brk(TBROK | TTERRNO,
@@ -143,9 +143,9 @@ static void do_test(void)
* below in either case) is present.
*/
TEST(ptrace(PTRACE_SETREGSET, pid, NT_X86_XSTATE, &iov));
- if (TEST_RETURN == 0) {
+ if (TST_RET == 0) {
tst_res(TINFO, "PTRACE_SETREGSET with reserved bits succeeded");
- } else if (TEST_ERRNO == EINVAL) {
+ } else if (TST_ERR == EINVAL) {
tst_res(TINFO,
"PTRACE_SETREGSET with reserved bits failed with EINVAL");
} else {
@@ -154,7 +154,7 @@ static void do_test(void)
}
TEST(ptrace(PTRACE_CONT, pid, 0, 0));
- if (TEST_RETURN != 0)
+ if (TST_RET != 0)
tst_brk(TBROK | TTERRNO, "PTRACE_CONT failed");
okay = true;
diff --git a/testcases/kernel/syscalls/pwrite/pwrite02.c b/testcases/kernel/syscalls/pwrite/pwrite02.c
index df506afd6..57aba4346 100644
--- a/testcases/kernel/syscalls/pwrite/pwrite02.c
+++ b/testcases/kernel/syscalls/pwrite/pwrite02.c
@@ -90,12 +90,12 @@ static void verify_pwrite(unsigned int i)
TEST(pwrite(*tc->fd, tc->buf, BS, tc->off));
- if (TEST_RETURN >= 0) {
+ if (TST_RET >= 0) {
tst_res(TFAIL, "call succeeded unexpectedly");
return;
}
- if (TEST_ERRNO != tc->exp_errno) {
+ if (TST_ERR != tc->exp_errno) {
tst_res(TFAIL | TTERRNO,
"pwrite failed unexpectedly, expected %s",
tst_strerrno(tc->exp_errno));
diff --git a/testcases/kernel/syscalls/pwrite/pwrite03.c b/testcases/kernel/syscalls/pwrite/pwrite03.c
index ef99de49b..efc7747b7 100644
--- a/testcases/kernel/syscalls/pwrite/pwrite03.c
+++ b/testcases/kernel/syscalls/pwrite/pwrite03.c
@@ -28,7 +28,7 @@ static void verify_pwrite(void)
{
TEST(pwrite(fd, NULL, 0, 0));
- if (TEST_RETURN != 0) {
+ if (TST_RET != 0) {
tst_res(TFAIL | TTERRNO,
"pwrite() should have succeeded with ret=0");
return;
diff --git a/testcases/kernel/syscalls/pwritev/pwritev01.c b/testcases/kernel/syscalls/pwritev/pwritev01.c
index 7c97f7227..76fcc6e66 100644
--- a/testcases/kernel/syscalls/pwritev/pwritev01.c
+++ b/testcases/kernel/syscalls/pwritev/pwritev01.c
@@ -62,14 +62,14 @@ static void verify_pwritev(unsigned int n)
SAFE_LSEEK(fd, 0, SEEK_SET);
TEST(pwritev(fd, wr_iovec, tc->count, tc->offset));
- if (TEST_RETURN < 0) {
+ if (TST_RET < 0) {
tst_res(TFAIL | TTERRNO, "pwritev() failed");
return;
}
- if (TEST_RETURN != tc->size) {
+ if (TST_RET != tc->size) {
tst_res(TFAIL, "pwritev() wrote %li bytes, expected %zi",
- TEST_RETURN, tc->size);
+ TST_RET, tc->size);
return;
}
diff --git a/testcases/kernel/syscalls/pwritev/pwritev02.c b/testcases/kernel/syscalls/pwritev/pwritev02.c
index 76b722b21..2e6dbab57 100644
--- a/testcases/kernel/syscalls/pwritev/pwritev02.c
+++ b/testcases/kernel/syscalls/pwritev/pwritev02.c
@@ -83,12 +83,12 @@ static void verify_pwritev(unsigned int n)
struct tcase *tc = &tcases[n];
TEST(pwritev(*tc->fd, tc->name, tc->count, tc->offset));
- if (TEST_RETURN == 0) {
+ if (TST_RET == 0) {
tst_res(TFAIL, "pwritev() succeeded unexpectedly");
return;
}
- if (TEST_ERRNO == tc->exp_err) {
+ if (TST_ERR == tc->exp_err) {
tst_res(TPASS | TTERRNO, "pwritev() failed as expected");
return;
}
diff --git a/testcases/kernel/syscalls/pwritev/pwritev03.c b/testcases/kernel/syscalls/pwritev/pwritev03.c
index a2ad01fb1..ad24124c2 100644
--- a/testcases/kernel/syscalls/pwritev/pwritev03.c
+++ b/testcases/kernel/syscalls/pwritev/pwritev03.c
@@ -65,14 +65,14 @@ static void verify_direct_pwritev(unsigned int n)
SAFE_PWRITE(1, fd, initbuf, blksz * 2, 0);
TEST(pwritev(fd, wr_iovec, tc->count, *tc->offset));
- if (TEST_RETURN < 0) {
+ if (TST_RET < 0) {
tst_res(TFAIL | TTERRNO, "pwritev(O_DIRECT) fails");
return;
}
- if (TEST_RETURN != *tc->size) {
+ if (TST_RET != *tc->size) {
tst_res(TFAIL, "pwritev(O_DIRECT) wrote %li bytes, expected %zi",
- TEST_RETURN, *tc->size);
+ TST_RET, *tc->size);
return;
}
diff --git a/testcases/kernel/syscalls/quotactl/quotactl01.c b/testcases/kernel/syscalls/quotactl/quotactl01.c
index 0173ed4f3..92b654eba 100644
--- a/testcases/kernel/syscalls/quotactl/quotactl01.c
+++ b/testcases/kernel/syscalls/quotactl/quotactl01.c
@@ -191,7 +191,7 @@ static void verify_quota(unsigned int n)
fmt_buf = 0;
TEST(quotactl(tc->cmd, tst_device->dev, *tc->id, tc->addr));
- if (TEST_RETURN == -1) {
+ if (TST_RET == -1) {
tst_res(TFAIL | TTERRNO, "quotactl failed to %s", tc->des);
return;
}
diff --git a/testcases/kernel/syscalls/quotactl/quotactl02.c b/testcases/kernel/syscalls/quotactl/quotactl02.c
index 9e6408a70..d8b1784de 100644
--- a/testcases/kernel/syscalls/quotactl/quotactl02.c
+++ b/testcases/kernel/syscalls/quotactl/quotactl02.c
@@ -163,7 +163,7 @@ static void verify_quota(unsigned int n)
struct t_case *tc = &tcases[n];
TEST(quotactl(tc->cmd, tst_device->dev, test_id, tc->addr));
- if (TEST_RETURN == -1) {
+ if (TST_RET == -1) {
tst_res(TFAIL | TTERRNO, "quotactl() failed to %s", tc->des);
return;
}
diff --git a/testcases/kernel/syscalls/quotactl/quotactl03.c b/testcases/kernel/syscalls/quotactl/quotactl03.c
index 64caac304..376fee546 100644
--- a/testcases/kernel/syscalls/quotactl/quotactl03.c
+++ b/testcases/kernel/syscalls/quotactl/quotactl03.c
@@ -66,20 +66,20 @@ static void verify_quota(void)
TEST(quotactl(QCMD(Q_XGETNEXTQUOTA, USRQUOTA), tst_device->dev,
test_id, (void *)&res_dquota));
- if (TEST_RETURN != -1) {
+ if (TST_RET != -1) {
tst_res(TFAIL, "quotactl() found the next active ID:"
" %u unexpectedly", res_dquota.d_id);
return;
}
- if (TEST_ERRNO == EINVAL) {
+ if (TST_ERR == EINVAL) {
tst_brk(TCONF | TTERRNO,
"Q_XGETNEXTQUOTA wasn't supported in quotactl()");
}
- if (TEST_ERRNO != ENOENT) {
+ if (TST_ERR != ENOENT) {
tst_res(TFAIL | TTERRNO, "quotaclt() failed unexpectedly with"
- " %s expected ENOENT", tst_strerrno(TEST_ERRNO));
+ " %s expected ENOENT", tst_strerrno(TST_ERR));
} else {
tst_res(TPASS, "quotaclt() failed with ENOENT as expected");
}
diff --git a/testcases/kernel/syscalls/read/read01.c b/testcases/kernel/syscalls/read/read01.c
index 855a3a18c..68aea0917 100644
--- a/testcases/kernel/syscalls/read/read01.c
+++ b/testcases/kernel/syscalls/read/read01.c
@@ -45,10 +45,10 @@ static void verify_read(void)
TEST(read(fd, buf, SIZE));
- if (TEST_RETURN == -1)
+ if (TST_RET == -1)
tst_res(TFAIL | TTERRNO, "read(2) failed");
else
- tst_res(TPASS, "read(2) returned %ld", TEST_RETURN);
+ tst_res(TPASS, "read(2) returned %ld", TST_RET);
}
static void setup(void)
diff --git a/testcases/kernel/syscalls/read/read02.c b/testcases/kernel/syscalls/read/read02.c
index dae2385aa..a92f95786 100644
--- a/testcases/kernel/syscalls/read/read02.c
+++ b/testcases/kernel/syscalls/read/read02.c
@@ -84,18 +84,18 @@ static void verify_read(unsigned int n)
TEST(read(*tc->fd, *tc->buf, tc->count));
- if (*tc->fd == fd4 && TEST_RETURN >= 0) {
+ if (*tc->fd == fd4 && TST_RET >= 0) {
tst_res(TPASS,
"O_DIRECT unaligned reads fallbacks to buffered I/O");
return;
}
- if (TEST_RETURN != -1) {
+ if (TST_RET != -1) {
tst_res(TFAIL, "read() succeeded unexpectedly");
return;
}
- if (TEST_ERRNO == tc->exp_error) {
+ if (TST_ERR == tc->exp_error) {
tst_res(TPASS | TTERRNO, "read() failed as expected");
} else {
tst_res(TFAIL | TTERRNO, "read() failed unexpectedly, "
diff --git a/testcases/kernel/syscalls/readlink/readlink01.c b/testcases/kernel/syscalls/readlink/readlink01.c
index 4207c8cde..0b7f52f29 100644
--- a/testcases/kernel/syscalls/readlink/readlink01.c
+++ b/testcases/kernel/syscalls/readlink/readlink01.c
@@ -36,14 +36,14 @@ static void test_readlink(void)
int exp_val = strlen(TESTFILE);
TEST(readlink(SYMFILE, buffer, sizeof(buffer)));
- if (TEST_RETURN == -1) {
+ if (TST_RET == -1) {
tst_res(TFAIL | TTERRNO, "readlink() on %s failed", SYMFILE);
return;
}
- if (TEST_RETURN != exp_val) {
+ if (TST_RET != exp_val) {
tst_res(TFAIL, "readlink() returned value %ld "
- "did't match, Expected %d", TEST_RETURN, exp_val);
+ "did't match, Expected %d", TST_RET, exp_val);
return;
}
diff --git a/testcases/kernel/syscalls/readlink/readlink03.c b/testcases/kernel/syscalls/readlink/readlink03.c
index 1c1f7f3c1..d757cf7fc 100644
--- a/testcases/kernel/syscalls/readlink/readlink03.c
+++ b/testcases/kernel/syscalls/readlink/readlink03.c
@@ -76,17 +76,17 @@ static void verify_readlink(unsigned int n)
struct tcase *tc = &tcases[n];
TEST(readlink(tc->link, tc->buf, tc->buf_size));
- if (TEST_RETURN != -1) {
+ if (TST_RET != -1) {
tst_res(TFAIL, "readlink() sueeeeded unexpectedly");
return;
}
- if (TEST_ERRNO != tc->exp_errno) {
+ if (TST_ERR != tc->exp_errno) {
tst_res(TFAIL | TTERRNO,
"readlink() failed unexpectedly; expected: %d - %s, got",
tc->exp_errno, tst_strerrno(tc->exp_errno));
- if (tc->exp_errno == ENOENT && TEST_ERRNO == EINVAL) {
+ if (tc->exp_errno == ENOENT && TST_ERR == EINVAL) {
tst_res(TWARN | TTERRNO,
"It may be a Kernel Bug, see the patch:"
"http://git.kernel.org/linus/1fa1e7f6");
diff --git a/testcases/kernel/syscalls/request_key/request_key01.c b/testcases/kernel/syscalls/request_key/request_key01.c
index d290a0de7..db7ff1537 100644
--- a/testcases/kernel/syscalls/request_key/request_key01.c
+++ b/testcases/kernel/syscalls/request_key/request_key01.c
@@ -38,12 +38,12 @@ static void verify_request_key(void)
{
TEST(request_key("keyring", "ltp", NULL, KEY_REQKEY_DEFL_DEFAULT));
- if (TEST_RETURN == -1) {
+ if (TST_RET == -1) {
tst_res(TFAIL | TTERRNO, "request_key() failed");
return;
}
- if (TEST_RETURN != key)
+ if (TST_RET != key)
tst_res(TFAIL, "serial number mismatched");
else
tst_res(TPASS, "request_key() succeed");
diff --git a/testcases/kernel/syscalls/request_key/request_key02.c b/testcases/kernel/syscalls/request_key/request_key02.c
index bde74c492..e6123018e 100644
--- a/testcases/kernel/syscalls/request_key/request_key02.c
+++ b/testcases/kernel/syscalls/request_key/request_key02.c
@@ -54,12 +54,12 @@ static void verify_request_key(unsigned int n)
struct test_case *tc = tcases + n;
TEST(request_key("keyring", tc->des, NULL, *tc->id));
- if (TEST_RETURN != -1) {
+ if (TST_RET != -1) {
tst_res(TFAIL, "request_key() succeed unexpectly");
return;
}
- if (TEST_ERRNO == tc->exp_err) {
+ if (TST_ERR == tc->exp_err) {
tst_res(TPASS | TTERRNO, "request_key() failed expectly");
return;
}
diff --git a/testcases/kernel/syscalls/request_key/request_key03.c b/testcases/kernel/syscalls/request_key/request_key03.c
index 8711b1250..9996a6f87 100644
--- a/testcases/kernel/syscalls/request_key/request_key03.c
+++ b/testcases/kernel/syscalls/request_key/request_key03.c
@@ -66,13 +66,13 @@ static void test_with_key_type(const char *type, const char *payload,
bool info_only;
TEST(keyctl(KEYCTL_JOIN_SESSION_KEYRING, NULL));
- if (TEST_RETURN < 0)
+ if (TST_RET < 0)
tst_brk(TBROK | TTERRNO, "failed to join new session keyring");
TEST(add_key(type, "desc", payload, strlen(payload),
KEY_SPEC_SESSION_KEYRING));
- if (TEST_RETURN < 0 && TEST_ERRNO != EINVAL) {
- if (TEST_ERRNO == ENODEV) {
+ if (TST_RET < 0 && TST_ERR != EINVAL) {
+ if (TST_ERR == ENODEV) {
tst_res(TCONF, "kernel doesn't support key type '%s'",
type);
return;
@@ -108,14 +108,14 @@ static void test_with_key_type(const char *type, const char *payload,
usleep(rand() % 1024);
TEST(add_key(type, "desc", payload, strlen(payload),
KEY_SPEC_SESSION_KEYRING));
- if (TEST_RETURN < 0 && TEST_ERRNO != EINVAL &&
- TEST_ERRNO != ENOKEY && TEST_ERRNO != EDQUOT) {
+ if (TST_RET < 0 && TST_ERR != EINVAL &&
+ TST_ERR != ENOKEY && TST_ERR != EDQUOT) {
tst_brk(TBROK | TTERRNO,
"unexpected error adding key of type '%s'",
type);
}
TEST(keyctl(KEYCTL_CLEAR, KEY_SPEC_SESSION_KEYRING));
- if (TEST_RETURN < 0) {
+ if (TST_RET < 0) {
tst_brk(TBROK | TTERRNO,
"unable to clear keyring");
}
@@ -128,8 +128,8 @@ static void test_with_key_type(const char *type, const char *payload,
for (i = 0; i < 5000 * effort; i++) {
TEST(request_key(type, "desc", "callout_info",
KEY_SPEC_SESSION_KEYRING));
- if (TEST_RETURN < 0 && TEST_ERRNO != ENOKEY &&
- TEST_ERRNO != ENOENT && TEST_ERRNO != EDQUOT) {
+ if (TST_RET < 0 && TST_ERR != ENOKEY &&
+ TST_ERR != ENOENT && TST_ERR != EDQUOT) {
tst_brk(TBROK | TTERRNO,
"unexpected error requesting key of type '%s'",
type);
diff --git a/testcases/kernel/syscalls/request_key/request_key04.c b/testcases/kernel/syscalls/request_key/request_key04.c
index 878b0de00..9e4c0bfac 100644
--- a/testcases/kernel/syscalls/request_key/request_key04.c
+++ b/testcases/kernel/syscalls/request_key/request_key04.c
@@ -37,44 +37,44 @@ static void do_test(void)
int saved_errno;
TEST(keyctl(KEYCTL_JOIN_SESSION_KEYRING, NULL));
- if (TEST_RETURN < 0)
+ if (TST_RET < 0)
tst_brk(TBROK | TTERRNO, "failed to join new session keyring");
TEST(keyctl(KEYCTL_SETPERM, KEY_SPEC_SESSION_KEYRING,
KEY_POS_SEARCH|KEY_POS_READ|KEY_POS_VIEW));
- if (TEST_RETURN < 0) {
+ if (TST_RET < 0) {
tst_brk(TBROK | TTERRNO,
"failed to set permissions on session keyring");
}
TEST(keyctl(KEYCTL_SET_REQKEY_KEYRING,
KEY_REQKEY_DEFL_SESSION_KEYRING));
- if (TEST_RETURN < 0) {
+ if (TST_RET < 0) {
tst_brk(TBROK | TTERRNO,
"failed to set request-key default keyring");
}
TEST(keyctl(KEYCTL_READ, KEY_SPEC_SESSION_KEYRING,
&keyid, sizeof(keyid)));
- if (TEST_RETURN < 0)
+ if (TST_RET < 0)
tst_brk(TBROK | TTERRNO, "failed to read from session keyring");
- if (TEST_RETURN != 0)
+ if (TST_RET != 0)
tst_brk(TBROK, "session keyring is not empty");
TEST(request_key("user", "desc", "callout_info", 0));
- if (TEST_RETURN != -1)
+ if (TST_RET != -1)
tst_brk(TBROK, "request_key() unexpectedly succeeded");
- saved_errno = TEST_ERRNO;
+ saved_errno = TST_ERR;
TEST(keyctl(KEYCTL_READ, KEY_SPEC_SESSION_KEYRING,
&keyid, sizeof(keyid)));
- if (TEST_RETURN < 0)
+ if (TST_RET < 0)
tst_brk(TBROK | TTERRNO, "failed to read from session keyring");
- if (TEST_RETURN != 0)
+ if (TST_RET != 0)
tst_brk(TFAIL, "added key to keyring without permission");
- TEST_ERRNO = saved_errno;
- if (TEST_ERRNO == EACCES) {
+ TST_ERR = saved_errno;
+ if (TST_ERR == EACCES) {
tst_res(TPASS, "request_key() failed with EACCES as expected");
} else {
tst_res(TBROK | TTERRNO,
diff --git a/testcases/kernel/syscalls/rmdir/rmdir01.c b/testcases/kernel/syscalls/rmdir/rmdir01.c
index 9f911ecf9..c8544b76f 100644
--- a/testcases/kernel/syscalls/rmdir/rmdir01.c
+++ b/testcases/kernel/syscalls/rmdir/rmdir01.c
@@ -34,7 +34,7 @@ static void verify_rmdir(void)
SAFE_MKDIR(TESTDIR, 0777);
TEST(rmdir(TESTDIR));
- if (TEST_RETURN == -1) {
+ if (TST_RET == -1) {
tst_res(TFAIL | TTERRNO, "rmdir(%s) failed", TESTDIR);
return;
}
diff --git a/testcases/kernel/syscalls/rmdir/rmdir02.c b/testcases/kernel/syscalls/rmdir/rmdir02.c
index d7cec8d4e..3f3669213 100644
--- a/testcases/kernel/syscalls/rmdir/rmdir02.c
+++ b/testcases/kernel/syscalls/rmdir/rmdir02.c
@@ -94,13 +94,13 @@ static void verify_rmdir(unsigned int n)
TEST(rmdir(tc->dir));
- if (TEST_RETURN != -1) {
+ if (TST_RET != -1) {
tst_res(TFAIL, "rmdir() succeeded unexpectedly (%li)",
- TEST_RETURN);
+ TST_RET);
return;
}
- if (TEST_ERRNO == tc->exp_errno) {
+ if (TST_ERR == tc->exp_errno) {
tst_res(TPASS | TTERRNO, "rmdir() failed as expected");
return;
}
diff --git a/testcases/kernel/syscalls/rmdir/rmdir03.c b/testcases/kernel/syscalls/rmdir/rmdir03.c
index 9ea107ce8..d3ad5b5ef 100644
--- a/testcases/kernel/syscalls/rmdir/rmdir03.c
+++ b/testcases/kernel/syscalls/rmdir/rmdir03.c
@@ -57,13 +57,13 @@ static void do_rmdir(unsigned int n)
struct testcase *tc = &tcases[n];
TEST(rmdir(tc->subdir));
- if (TEST_RETURN != -1) {
+ if (TST_RET != -1) {
tst_res(TFAIL, "rmdir() succeeded unexpectedly");
return;
}
- if (TEST_ERRNO != EACCES) {
- if (tc->dir_mode & S_ISVTX && TEST_ERRNO == EPERM)
+ if (TST_ERR != EACCES) {
+ if (tc->dir_mode & S_ISVTX && TST_ERR == EPERM)
tst_res(TPASS | TTERRNO, "rmdir() got expected errno");
else
tst_res(TFAIL | TTERRNO, "expected EPERM, but got");
diff --git a/testcases/kernel/syscalls/sched_setscheduler/sched_setscheduler03.c b/testcases/kernel/syscalls/sched_setscheduler/sched_setscheduler03.c
index a51310656..dd3853b1e 100644
--- a/testcases/kernel/syscalls/sched_setscheduler/sched_setscheduler03.c
+++ b/testcases/kernel/syscalls/sched_setscheduler/sched_setscheduler03.c
@@ -110,7 +110,7 @@ static void verify_fn(unsigned int i)
TEST(sched_setscheduler(*cases[i].pid, cases[i].policy,
cases[i].sched_param));
- if (TEST_RETURN)
+ if (TST_RET)
tst_res(TFAIL | TTERRNO, "case[%d] expected: %d, got: ",
i + 1, cases[i].error);
else
diff --git a/testcases/kernel/syscalls/select/select04.c b/testcases/kernel/syscalls/select/select04.c
index 4ca7a3174..86bdffcdf 100644
--- a/testcases/kernel/syscalls/select/select04.c
+++ b/testcases/kernel/syscalls/select/select04.c
@@ -43,8 +43,8 @@ static int sample_fn(int clk_id, long long usec)
tst_timer_stop();
tst_timer_sample();
- if (TEST_RETURN != 0) {
- tst_res(TFAIL | TTERRNO, "select() returned %li", TEST_RETURN);
+ if (TST_RET != 0) {
+ tst_res(TFAIL | TTERRNO, "select() returned %li", TST_RET);
return 1;
}
diff --git a/testcases/kernel/syscalls/sendto/sendto02.c b/testcases/kernel/syscalls/sendto/sendto02.c
index c8c2979ff..5c272d144 100644
--- a/testcases/kernel/syscalls/sendto/sendto02.c
+++ b/testcases/kernel/syscalls/sendto/sendto02.c
@@ -68,12 +68,12 @@ static void cleanup(void)
static void verify_sendto(void)
{
TEST(sendto(sockfd, NULL, 1, 0, (struct sockaddr *) &sa, sizeof(sa)));
- if (TEST_RETURN != -1) {
+ if (TST_RET != -1) {
tst_res(TFAIL, "sendto(fd, NULL, ...) succeeded unexpectedly");
return;
}
- if (TEST_ERRNO == EFAULT) {
+ if (TST_ERR == EFAULT) {
tst_res(TPASS | TTERRNO,
"sendto(fd, NULL, ...) failed expectedly");
return;
diff --git a/testcases/kernel/syscalls/setpriority/setpriority01.c b/testcases/kernel/syscalls/setpriority/setpriority01.c
index d6cc79e5a..38b77b77f 100644
--- a/testcases/kernel/syscalls/setpriority/setpriority01.c
+++ b/testcases/kernel/syscalls/setpriority/setpriority01.c
@@ -64,7 +64,7 @@ static void setpriority_test(struct tcase *tc)
for (new_prio = -20; new_prio < 20; new_prio++) {
TEST(setpriority(tc->which, *tc->who, new_prio));
- if (TEST_RETURN != 0) {
+ if (TST_RET != 0) {
tst_res(TFAIL | TTERRNO,
"setpriority(%d, %d, %d) failed",
tc->which, *tc->who, new_prio);
diff --git a/testcases/kernel/syscalls/setpriority/setpriority02.c b/testcases/kernel/syscalls/setpriority/setpriority02.c
index 0f61fcae8..01a4c8108 100644
--- a/testcases/kernel/syscalls/setpriority/setpriority02.c
+++ b/testcases/kernel/syscalls/setpriority/setpriority02.c
@@ -73,15 +73,15 @@ static void setpriority_test(struct tcase *tc)
TEST(setpriority(tc->which, tc->who, tc->prio));
- if (TEST_RETURN != -1) {
+ if (TST_RET != -1) {
tst_res(TFAIL,
"setpriority(%d, %d, %d) %ssucceeds unexpectedly "
"returned %ld", tc->which, tc->who, tc->prio, desc,
- TEST_RETURN);
+ TST_RET);
return;
}
- if (TEST_ERRNO != tc->exp_errno) {
+ if (TST_ERR != tc->exp_errno) {
tst_res(TFAIL | TTERRNO,
"setpriority(%d, %d, %d) %sshould fail with %s",
tc->which, tc->who, tc->prio, desc,
diff --git a/testcases/kernel/syscalls/setrlimit/setrlimit02.c b/testcases/kernel/syscalls/setrlimit/setrlimit02.c
index 633279c6c..77adaf082 100644
--- a/testcases/kernel/syscalls/setrlimit/setrlimit02.c
+++ b/testcases/kernel/syscalls/setrlimit/setrlimit02.c
@@ -42,12 +42,12 @@ static void verify_setrlimit(unsigned int n)
TEST(setrlimit(tc->resource, tc->rlim));
- if (TEST_RETURN != -1) {
+ if (TST_RET != -1) {
tst_res(TFAIL, "call succeeded unexpectedly");
return;
}
- if (TEST_ERRNO != tc->exp_errno) {
+ if (TST_ERR != tc->exp_errno) {
tst_res(TFAIL | TTERRNO,
"setrlimit() should fail with %s got",
tst_strerrno(tc->exp_errno));
diff --git a/testcases/kernel/syscalls/setrlimit/setrlimit03.c b/testcases/kernel/syscalls/setrlimit/setrlimit03.c
index d551c90ac..29b52aa7f 100644
--- a/testcases/kernel/syscalls/setrlimit/setrlimit03.c
+++ b/testcases/kernel/syscalls/setrlimit/setrlimit03.c
@@ -50,12 +50,12 @@ static void verify_setrlimit(unsigned int n)
struct tcase *tc = &tcases[n];
TEST(setrlimit(RLIMIT_NOFILE, tc->rlimt));
- if (TEST_RETURN != -1) {
+ if (TST_RET != -1) {
tst_res(TFAIL, "call succeeded unexpectedly");
return;
}
- if (TEST_ERRNO != tc->exp_err) {
+ if (TST_ERR != tc->exp_err) {
tst_res(TFAIL | TTERRNO, "setrlimit() should fail with %s, got",
tst_strerrno(tc->exp_err));
} else {
diff --git a/testcases/kernel/syscalls/setrlimit/setrlimit05.c b/testcases/kernel/syscalls/setrlimit/setrlimit05.c
index 7ea7d629f..e7167229b 100644
--- a/testcases/kernel/syscalls/setrlimit/setrlimit05.c
+++ b/testcases/kernel/syscalls/setrlimit/setrlimit05.c
@@ -34,13 +34,13 @@ static void verify_setrlimit(void)
pid = SAFE_FORK();
if (!pid) {
TEST(setrlimit(RLIMIT_NOFILE, (void *) -1));
- if (TEST_RETURN != -1) {
+ if (TST_RET != -1) {
tst_res(TFAIL, "setrlimit() succeeded unexpectedly");
exit(0);
}
/* Usually, setrlimit() should return EFAULT */
- if (TEST_ERRNO == EFAULT) {
+ if (TST_ERR == EFAULT) {
tst_res(TPASS | TTERRNO,
"setrlimit() failed as expected");
} else {
diff --git a/testcases/kernel/syscalls/setsockopt/setsockopt02.c b/testcases/kernel/syscalls/setsockopt/setsockopt02.c
index 22dc43ade..474df245f 100644
--- a/testcases/kernel/syscalls/setsockopt/setsockopt02.c
+++ b/testcases/kernel/syscalls/setsockopt/setsockopt02.c
@@ -97,9 +97,9 @@ static int create_skbuf(unsigned int sizeof_priv)
sk = SAFE_SOCKET(AF_PACKET, SOCK_RAW, htons(ETH_P_ALL));
TEST(setsockopt(sk, SOL_PACKET, PACKET_VERSION, &ver, sizeof(ver)));
- if (TEST_RETURN && TEST_ERRNO == EINVAL)
+ if (TST_RET && TST_ERR == EINVAL)
tst_brk(TCONF | TTERRNO, "TPACKET_V3 not supported");
- if (TEST_RETURN)
+ if (TST_RET)
tst_brk(TBROK | TTERRNO, "setsockopt(sk, SOL_PACKET, PACKET_VERSION, TPACKET_V3)");
return setsockopt(sk, SOL_PACKET, PACKET_RX_RING, &req, sizeof(req));
@@ -108,7 +108,7 @@ static int create_skbuf(unsigned int sizeof_priv)
static void good_size(void)
{
TEST(create_skbuf(512));
- if (TEST_RETURN)
+ if (TST_RET)
tst_brk(TBROK | TTERRNO, "Can't create ring buffer with good settings");
tst_res(TPASS, "Can create ring buffer with good settinegs");
@@ -117,9 +117,9 @@ static void good_size(void)
static void bad_size(void)
{
TEST(create_skbuf(3U << 30));
- if (TEST_RETURN && TEST_ERRNO != EINVAL)
+ if (TST_RET && TST_ERR != EINVAL)
tst_brk(TBROK | TTERRNO, "Unexpected setsockopt() error");
- if (TEST_RETURN)
+ if (TST_RET)
tst_res(TPASS | TTERRNO, "Refused bad tp_sizeof_priv value");
else
tst_res(TFAIL, "Allowed bad tp_sizeof_priv value");
diff --git a/testcases/kernel/syscalls/setuid/setuid01.c b/testcases/kernel/syscalls/setuid/setuid01.c
index 4eb8414ad..1b866a5e8 100644
--- a/testcases/kernel/syscalls/setuid/setuid01.c
+++ b/testcases/kernel/syscalls/setuid/setuid01.c
@@ -36,7 +36,7 @@ static void verify_setuid(void)
UID16_CHECK(uid, setuid);
TEST(SETUID(uid));
- if (TEST_RETURN == -1)
+ if (TST_RET == -1)
tst_res(TFAIL | TTERRNO, "setuid(%d) failed", uid);
else
tst_res(TPASS, "setuid(%d) successfully", uid);
diff --git a/testcases/kernel/syscalls/setuid/setuid03.c b/testcases/kernel/syscalls/setuid/setuid03.c
index c8ae64ade..8e1bf7d56 100644
--- a/testcases/kernel/syscalls/setuid/setuid03.c
+++ b/testcases/kernel/syscalls/setuid/setuid03.c
@@ -32,12 +32,12 @@
static void verify_setuid(void)
{
TEST(SETUID(ROOT_USER));
- if (TEST_RETURN != -1) {
+ if (TST_RET != -1) {
tst_res(TFAIL | TTERRNO, "setuid() succeeded unexpectedly");
return;
}
- if (TEST_ERRNO == EPERM)
+ if (TST_ERR == EPERM)
tst_res(TPASS, "setuid() returned errno EPERM");
else
tst_res(TFAIL | TTERRNO, "setuid() returned unexpected errno");
diff --git a/testcases/kernel/syscalls/setuid/setuid04.c b/testcases/kernel/syscalls/setuid/setuid04.c
index 2f2244fde..c37fac847 100644
--- a/testcases/kernel/syscalls/setuid/setuid04.c
+++ b/testcases/kernel/syscalls/setuid/setuid04.c
@@ -51,13 +51,13 @@ static void dosetuid(void)
int tst_fd;
TEST(tst_fd = open(FILENAME, O_RDWR));
- if (TEST_RETURN != -1) {
+ if (TST_RET != -1) {
tst_res(TFAIL, "open() succeeded unexpectedly");
close(tst_fd);
return;
}
- if (TEST_ERRNO == EACCES)
+ if (TST_ERR == EACCES)
tst_res(TPASS, "open() returned errno EACCES");
else
tst_res(TFAIL | TTERRNO, "open() returned unexpected errno");
diff --git a/testcases/kernel/syscalls/setxattr/setxattr01.c b/testcases/kernel/syscalls/setxattr/setxattr01.c
index 4db56123a..b9797df2c 100644
--- a/testcases/kernel/syscalls/setxattr/setxattr01.c
+++ b/testcases/kernel/syscalls/setxattr/setxattr01.c
@@ -136,13 +136,13 @@ static void verify_setxattr(unsigned int i)
{
TEST(setxattr(FNAME, tc[i].key, *tc[i].value, tc[i].size, tc[i].flags));
- if (TEST_RETURN == -1 && TEST_ERRNO == EOPNOTSUPP)
+ if (TST_RET == -1 && TST_ERR == EOPNOTSUPP)
tst_brk(TCONF, "setxattr() not supported");
if (!tc[i].exp_err) {
- if (TEST_RETURN) {
+ if (TST_RET) {
tst_res(TFAIL | TTERRNO,
- "setxattr() failed with %li", TEST_RETURN);
+ "setxattr() failed with %li", TST_RET);
return;
}
@@ -150,12 +150,12 @@ static void verify_setxattr(unsigned int i)
return;
}
- if (TEST_RETURN == 0) {
+ if (TST_RET == 0) {
tst_res(TFAIL, "setxattr() passed unexpectedly");
return;
}
- if (TEST_ERRNO != tc[i].exp_err) {
+ if (TST_ERR != tc[i].exp_err) {
tst_res(TFAIL | TTERRNO, "setxattr() should fail with %s",
tst_strerrno(tc[i].exp_err));
return;
diff --git a/testcases/kernel/syscalls/setxattr/setxattr02.c b/testcases/kernel/syscalls/setxattr/setxattr02.c
index 0b6ecb3fa..aa80c1e5e 100644
--- a/testcases/kernel/syscalls/setxattr/setxattr02.c
+++ b/testcases/kernel/syscalls/setxattr/setxattr02.c
@@ -143,13 +143,13 @@ static void verify_setxattr(unsigned int i)
{
TEST(setxattr(tc[i].fname, tc[i].key, tc[i].value, tc[i].size, tc[i].flags));
- if (TEST_RETURN == -1 && TEST_ERRNO == EOPNOTSUPP)
+ if (TST_RET == -1 && TST_ERR == EOPNOTSUPP)
tst_brk(TCONF, "setxattr() not supported");
if (!tc[i].exp_err) {
- if (TEST_RETURN) {
+ if (TST_RET) {
tst_res(TFAIL | TTERRNO,
- "setxattr() failed with %li", TEST_RETURN);
+ "setxattr() failed with %li", TST_RET);
return;
}
@@ -157,12 +157,12 @@ static void verify_setxattr(unsigned int i)
return;
}
- if (TEST_RETURN == 0) {
+ if (TST_RET == 0) {
tst_res(TFAIL, "setxattr() passed unexpectedly");
return;
}
- if (TEST_ERRNO != tc[i].exp_err) {
+ if (TST_ERR != tc[i].exp_err) {
tst_res(TFAIL | TTERRNO, "setxattr() should fail with %s",
tst_strerrno(tc[i].exp_err));
return;
diff --git a/testcases/kernel/syscalls/socket/socket01.c b/testcases/kernel/syscalls/socket/socket01.c
index 9d2fe4f7c..6107274cb 100644
--- a/testcases/kernel/syscalls/socket/socket01.c
+++ b/testcases/kernel/syscalls/socket/socket01.c
@@ -57,19 +57,19 @@ static void verify_socket(unsigned int n)
struct test_case_t *tc = &tdat[n];
TEST(fd = socket(tc->domain, tc->type, tc->proto));
- if (TEST_RETURN >= 0)
- TEST_RETURN = 0;
+ if (TST_RET >= 0)
+ TST_RET = 0;
if (fd > 0)
SAFE_CLOSE(fd);
- if (TEST_RETURN != tc->retval) {
+ if (TST_RET != tc->retval) {
tst_res(TFAIL, "%s returned %d (expected %d)",
tc->desc, fd, tc->retval);
return;
}
- if (TEST_ERRNO != tc->experrno) {
+ if (TST_ERR != tc->experrno) {
tst_res(TFAIL | TTERRNO, "expected %s(%d)",
tst_strerrno(tc->experrno), tc->experrno);
return;
diff --git a/testcases/kernel/syscalls/socketcall/socketcall01.c b/testcases/kernel/syscalls/socketcall/socketcall01.c
index 7fe5cbe80..f7128a734 100644
--- a/testcases/kernel/syscalls/socketcall/socketcall01.c
+++ b/testcases/kernel/syscalls/socketcall/socketcall01.c
@@ -49,15 +49,15 @@ void verify_socketcall(unsigned int i)
{
TEST(socketcall(TC[i].call, TC[i].args));
- if (TEST_RETURN < 0) {
+ if (TST_RET < 0) {
tst_res(TFAIL | TTERRNO, "socketcall() for %s failed with %li",
- TC[i].desc, TEST_RETURN);
+ TC[i].desc, TST_RET);
return;
}
tst_res(TPASS, "socketcall() for %s", TC[i].desc);
- SAFE_CLOSE(TEST_RETURN);
+ SAFE_CLOSE(TST_RET);
}
static struct tst_test test = {
diff --git a/testcases/kernel/syscalls/socketpair/socketpair01.c b/testcases/kernel/syscalls/socketpair/socketpair01.c
index 67290750d..a61f268cc 100644
--- a/testcases/kernel/syscalls/socketpair/socketpair01.c
+++ b/testcases/kernel/syscalls/socketpair/socketpair01.c
@@ -62,18 +62,18 @@ static void verify_socketpair(unsigned int n)
TEST(socketpair(tc->domain, tc->type, tc->proto, tc->sv));
- if (TEST_RETURN == 0) {
+ if (TST_RET == 0) {
SAFE_CLOSE(fds[0]);
SAFE_CLOSE(fds[1]);
}
- if (TEST_RETURN != tc->retval) {
+ if (TST_RET != tc->retval) {
tst_res(TFAIL, "%s returned %ld (expected %d)",
- tc->desc, TEST_RETURN, tc->retval);
+ tc->desc, TST_RET, tc->retval);
return;
}
- if (TEST_ERRNO != tc->experrno) {
+ if (TST_ERR != tc->experrno) {
tst_res(TFAIL | TTERRNO, "expected %s(%d)",
tst_strerrno(tc->experrno), tc->experrno);
return;
diff --git a/testcases/kernel/syscalls/socketpair/socketpair02.c b/testcases/kernel/syscalls/socketpair/socketpair02.c
index f8057ce5f..ca24915ee 100644
--- a/testcases/kernel/syscalls/socketpair/socketpair02.c
+++ b/testcases/kernel/syscalls/socketpair/socketpair02.c
@@ -56,7 +56,7 @@ static void verify_socketpair(unsigned int n)
TEST(socketpair(PF_UNIX, tc->type, 0, fds));
- if (TEST_RETURN == -1)
+ if (TST_RET == -1)
tst_brk(TFAIL | TTERRNO, "socketpair() failed");
for (i = 0; i < 2; i++) {
diff --git a/testcases/kernel/syscalls/splice/splice02.c b/testcases/kernel/syscalls/splice/splice02.c
index a9ca51539..a59703e76 100644
--- a/testcases/kernel/syscalls/splice/splice02.c
+++ b/testcases/kernel/syscalls/splice/splice02.c
@@ -40,9 +40,9 @@ static void splice_test(void)
fd = SAFE_OPEN("splice02-temp", O_WRONLY | O_CREAT | O_TRUNC, 0644);
TEST(splice(STDIN_FILENO, NULL, fd, NULL, SPLICE_SIZE, 0));
- if (TEST_RETURN < 0) {
+ if (TST_RET < 0) {
tst_res(TFAIL, "splice failed - errno = %d : %s",
- TEST_ERRNO, strerror(TEST_ERRNO));
+ TST_ERR, strerror(TST_ERR));
} else {
tst_res(TPASS, "splice() system call Passed");
}
diff --git a/testcases/kernel/syscalls/splice/splice03.c b/testcases/kernel/syscalls/splice/splice03.c
index 86363dd96..12326d2a2 100644
--- a/testcases/kernel/syscalls/splice/splice03.c
+++ b/testcases/kernel/syscalls/splice/splice03.c
@@ -94,13 +94,13 @@ static void splice_verify(unsigned int n)
TEST(splice(*(tc->fdin), tc->offin, *(tc->fdout),
tc->offout, SPLICE_TEST_LEN, 0));
- if (TEST_RETURN != -1) {
+ if (TST_RET != -1) {
tst_res(TFAIL, "splice() returned %ld expected %s",
- TEST_RETURN, tst_strerrno(tc->exp_errno));
+ TST_RET, tst_strerrno(tc->exp_errno));
return;
}
- if (TEST_ERRNO != tc->exp_errno) {
+ if (TST_ERR != tc->exp_errno) {
tst_res(TFAIL | TTERRNO,
"splice() failed unexpectedly; expected: %d - %s",
tc->exp_errno, tst_strerrno(tc->exp_errno));
diff --git a/testcases/kernel/syscalls/sysctl/sysctl01.c b/testcases/kernel/syscalls/sysctl/sysctl01.c
index 68fa44a3b..70905d806 100644
--- a/testcases/kernel/syscalls/sysctl/sysctl01.c
+++ b/testcases/kernel/syscalls/sysctl/sysctl01.c
@@ -59,7 +59,7 @@ static void verify_sysctl(unsigned int n)
};
TEST(tst_syscall(__NR__sysctl, &args));
- if (TEST_RETURN != 0) {
+ if (TST_RET != 0) {
tst_res(TFAIL | TTERRNO, "sysctl() failed unexpectedly");
return;
}
diff --git a/testcases/kernel/syscalls/sysctl/sysctl03.c b/testcases/kernel/syscalls/sysctl/sysctl03.c
index cc126c0ed..820ab0bfe 100644
--- a/testcases/kernel/syscalls/sysctl/sysctl03.c
+++ b/testcases/kernel/syscalls/sysctl/sysctl03.c
@@ -62,12 +62,12 @@ static void verify_sysctl(void)
};
TEST(tst_syscall(__NR__sysctl, &args));
- if (TEST_RETURN != -1) {
+ if (TST_RET != -1) {
tst_res(TFAIL, "sysctl(2) succeeded unexpectedly");
return;
}
- if (TEST_ERRNO == exp_eno) {
+ if (TST_ERR == exp_eno) {
tst_res(TPASS | TTERRNO, "Got expected error");
} else {
tst_res(TFAIL | TTERRNO, "Got unexpected error, expected %s",
diff --git a/testcases/kernel/syscalls/sysctl/sysctl04.c b/testcases/kernel/syscalls/sysctl/sysctl04.c
index 36b25cff0..059307082 100644
--- a/testcases/kernel/syscalls/sysctl/sysctl04.c
+++ b/testcases/kernel/syscalls/sysctl/sysctl04.c
@@ -59,12 +59,12 @@ static void verify_sysctl(unsigned int n)
};
TEST(tst_syscall(__NR__sysctl, &args));
- if (TEST_RETURN != -1) {
+ if (TST_RET != -1) {
tst_res(TFAIL, "sysctl(2) succeeded unexpectedly");
return;
}
- if (TEST_ERRNO == tc->exp_err) {
+ if (TST_ERR == tc->exp_err) {
tst_res(TPASS | TTERRNO, "Got expected error");
} else {
tst_res(TFAIL | TTERRNO, "Got unexpected error, expected %s",
diff --git a/testcases/kernel/syscalls/tee/tee02.c b/testcases/kernel/syscalls/tee/tee02.c
index d454f4adb..744d51a87 100644
--- a/testcases/kernel/syscalls/tee/tee02.c
+++ b/testcases/kernel/syscalls/tee/tee02.c
@@ -66,14 +66,14 @@ static void tee_verify(unsigned int n)
TEST(tee(*(tc->fdin), *(tc->fdout), TEE_TEST_LEN, 0));
- if (TEST_RETURN != -1) {
+ if (TST_RET != -1) {
tst_res(TFAIL, "tee() returned %ld, "
- "expected -1, errno:%d", TEST_RETURN,
+ "expected -1, errno:%d", TST_RET,
tc->exp_errno);
return;
}
- if (TEST_ERRNO != tc->exp_errno) {
+ if (TST_ERR != tc->exp_errno) {
tst_res(TFAIL | TTERRNO,
"tee() failed unexpectedly; expected: %d - %s",
tc->exp_errno, tst_strerrno(tc->exp_errno));
diff --git a/testcases/kernel/syscalls/umask/umask01.c b/testcases/kernel/syscalls/umask/umask01.c
index ee8062498..87bfcdcf8 100644
--- a/testcases/kernel/syscalls/umask/umask01.c
+++ b/testcases/kernel/syscalls/umask/umask01.c
@@ -39,15 +39,15 @@ static void verify_umask(void)
for (mskval = 0000; mskval < 01000; mskval++) {
TEST(umask(mskval));
- if (TEST_RETURN < 0 || TEST_RETURN > 0777) {
+ if (TST_RET < 0 || TST_RET > 0777) {
tst_brk(TFAIL, "umask(%o) result outside range %ld",
- mskval, TEST_RETURN);
+ mskval, TST_RET);
}
- if (mskval > 0000 && TEST_RETURN != mskval - 1) {
+ if (mskval > 0000 && TST_RET != mskval - 1) {
failflag = 1;
tst_res(TFAIL, "umask(%o) returned %ld, expected %d",
- mskval, TEST_RETURN, mskval - 1);
+ mskval, TST_RET, mskval - 1);
}
fd = SAFE_CREAT("testfile", 0777);
diff --git a/testcases/kernel/syscalls/umount/umount01.c b/testcases/kernel/syscalls/umount/umount01.c
index 80a80c9ac..b959356fb 100644
--- a/testcases/kernel/syscalls/umount/umount01.c
+++ b/testcases/kernel/syscalls/umount/umount01.c
@@ -38,13 +38,13 @@ static void verify_umount(void)
TEST(umount(MNTPOINT));
- if (TEST_RETURN != 0 && TEST_ERRNO == EBUSY) {
+ if (TST_RET != 0 && TST_ERR == EBUSY) {
tst_res(TINFO, "umount() Failed with EBUSY "
"possibly some daemon (gvfsd-trash) "
"is probing newly mounted dirs");
}
- if (TEST_RETURN != 0) {
+ if (TST_RET != 0) {
tst_res(TFAIL | TTERRNO, "umount() Failed");
return;
}
diff --git a/testcases/kernel/syscalls/umount/umount02.c b/testcases/kernel/syscalls/umount/umount02.c
index 5bcd17d9e..ad8783e29 100644
--- a/testcases/kernel/syscalls/umount/umount02.c
+++ b/testcases/kernel/syscalls/umount/umount02.c
@@ -57,12 +57,12 @@ static void verify_umount(unsigned int n)
TEST(umount(tc->mntpoint));
- if (TEST_RETURN != -1) {
+ if (TST_RET != -1) {
tst_res(TFAIL, "umount() succeeds unexpectedly");
return;
}
- if (tc->exp_errno != TEST_ERRNO) {
+ if (tc->exp_errno != TST_ERR) {
tst_res(TFAIL | TTERRNO, "umount() should fail with %s",
tst_strerrno(tc->exp_errno));
return;
diff --git a/testcases/kernel/syscalls/umount/umount03.c b/testcases/kernel/syscalls/umount/umount03.c
index abff0ce86..3042aeac2 100644
--- a/testcases/kernel/syscalls/umount/umount03.c
+++ b/testcases/kernel/syscalls/umount/umount03.c
@@ -35,12 +35,12 @@ static void verify_umount(void)
{
TEST(umount(MNTPOINT));
- if (TEST_RETURN != -1) {
+ if (TST_RET != -1) {
tst_res(TFAIL, "umount() succeeds unexpectedly");
return;
}
- if (TEST_ERRNO != EPERM) {
+ if (TST_ERR != EPERM) {
tst_res(TFAIL | TTERRNO, "umount() should fail with EPERM");
return;
}
diff --git a/testcases/kernel/syscalls/unlink/unlink05.c b/testcases/kernel/syscalls/unlink/unlink05.c
index 5305e9421..8d10052ce 100644
--- a/testcases/kernel/syscalls/unlink/unlink05.c
+++ b/testcases/kernel/syscalls/unlink/unlink05.c
@@ -59,7 +59,7 @@ static void verify_unlink(unsigned int n)
tc->setupfunc(fname);
TEST(unlink(fname));
- if (TEST_RETURN == -1) {
+ if (TST_RET == -1) {
tst_res(TFAIL | TTERRNO, "unlink(%s) failed", tc->desc);
return;
}
diff --git a/testcases/kernel/syscalls/unlink/unlink07.c b/testcases/kernel/syscalls/unlink/unlink07.c
index e521b6409..04cd78342 100644
--- a/testcases/kernel/syscalls/unlink/unlink07.c
+++ b/testcases/kernel/syscalls/unlink/unlink07.c
@@ -52,13 +52,13 @@ static void verify_unlink(unsigned int n)
struct test_case_t *tc = &tcases[n];
TEST(unlink(tc->name));
- if (TEST_RETURN != -1) {
+ if (TST_RET != -1) {
tst_res(TFAIL, "unlink(<%s>) succeeded unexpectedly",
tc->desc);
return;
}
- if (TEST_ERRNO == tc->exp_errno) {
+ if (TST_ERR == tc->exp_errno) {
tst_res(TPASS | TTERRNO, "unlink(<%s>) failed as expected",
tc->desc);
} else {
diff --git a/testcases/kernel/syscalls/unlink/unlink08.c b/testcases/kernel/syscalls/unlink/unlink08.c
index ba435ee49..f1a778f9e 100644
--- a/testcases/kernel/syscalls/unlink/unlink08.c
+++ b/testcases/kernel/syscalls/unlink/unlink08.c
@@ -49,13 +49,13 @@ static struct test_case_t {
static void verify_unlink(struct test_case_t *tc)
{
TEST(unlink(tc->name));
- if (TEST_RETURN != -1) {
+ if (TST_RET != -1) {
tst_res(TFAIL, "unlink(<%s>) succeeded unexpectedly",
tc->desc);
return;
}
- if (TEST_ERRNO == tc->exp_errno) {
+ if (TST_ERR == tc->exp_errno) {
tst_res(TPASS | TTERRNO, "unlink(<%s>) failed as expected",
tc->desc);
} else {
diff --git a/testcases/kernel/syscalls/utimes/utimes01.c b/testcases/kernel/syscalls/utimes/utimes01.c
index b67543b09..c6ee75c59 100644
--- a/testcases/kernel/syscalls/utimes/utimes01.c
+++ b/testcases/kernel/syscalls/utimes/utimes01.c
@@ -93,7 +93,7 @@ static void utimes_verify(unsigned int i)
TEST(utimes(tc->pathname, tc->times));
- if (TEST_ERRNO == tc->exp_errno) {
+ if (TST_ERR == tc->exp_errno) {
tst_res(TPASS | TTERRNO, "utimes() worked as expected");
} else {
tst_res(TFAIL | TTERRNO,
@@ -101,7 +101,7 @@ static void utimes_verify(unsigned int i)
tc->exp_errno, tst_strerrno(tc->exp_errno));
}
- if (TEST_ERRNO == 0 && utimes(tc->pathname, tmp_tv) == -1)
+ if (TST_ERR == 0 && utimes(tc->pathname, tmp_tv) == -1)
tst_brk(TBROK | TERRNO, "utimes() failed.");
}
diff --git a/testcases/kernel/syscalls/vmsplice/vmsplice02.c b/testcases/kernel/syscalls/vmsplice/vmsplice02.c
index 1e100a143..ec9fb8239 100644
--- a/testcases/kernel/syscalls/vmsplice/vmsplice02.c
+++ b/testcases/kernel/syscalls/vmsplice/vmsplice02.c
@@ -82,14 +82,14 @@ static void vmsplice_verify(unsigned int n)
TEST(vmsplice(*(tc->fd), tc->iov, tc->nr_segs, 0));
- if (TEST_RETURN != -1) {
+ if (TST_RET != -1) {
tst_res(TFAIL, "vmsplice() returned %ld, "
- "expected -1, errno:%d", TEST_RETURN,
+ "expected -1, errno:%d", TST_RET,
tc->exp_errno);
return;
}
- if (TEST_ERRNO != tc->exp_errno) {
+ if (TST_ERR != tc->exp_errno) {
tst_res(TFAIL | TTERRNO,
"vmsplice() failed unexpectedly; expected: %d - %s",
tc->exp_errno, tst_strerrno(tc->exp_errno));
diff --git a/testcases/kernel/syscalls/wait4/wait401.c b/testcases/kernel/syscalls/wait4/wait401.c
index 418abb993..77151ea85 100644
--- a/testcases/kernel/syscalls/wait4/wait401.c
+++ b/testcases/kernel/syscalls/wait4/wait401.c
@@ -43,14 +43,14 @@ static void run(void)
}
TEST(wait4(pid, &status, 0, &rusage));
- if (TEST_RETURN == -1) {
+ if (TST_RET == -1) {
tst_res(TFAIL | TERRNO, "wait4() failed");
return;
}
- if (TEST_RETURN != pid) {
+ if (TST_RET != pid) {
tst_res(TFAIL, "waitpid() returned wrong pid %li, expected %i",
- TEST_RETURN, pid);
+ TST_RET, pid);
} else {
tst_res(TPASS, "waitpid() returned correct pid %i", pid);
}
diff --git a/testcases/kernel/syscalls/write/write01.c b/testcases/kernel/syscalls/write/write01.c
index c6c8fa8ca..592920b6d 100644
--- a/testcases/kernel/syscalls/write/write01.c
+++ b/testcases/kernel/syscalls/write/write01.c
@@ -40,15 +40,15 @@ static void verify_write(void)
for (i = BUFSIZ; i > 0; i--) {
TEST(write(fd, buf, i));
- if (TEST_RETURN == -1) {
+ if (TST_RET == -1) {
tst_res(TFAIL | TTERRNO, "write failed");
return;
}
- if (TEST_RETURN != i) {
+ if (TST_RET != i) {
badcount++;
tst_res(TINFO, "write() returned %ld, expected %d",
- TEST_RETURN, i);
+ TST_RET, i);
}
}
diff --git a/testcases/kernel/syscalls/write/write02.c b/testcases/kernel/syscalls/write/write02.c
index 3cec43d5f..34b9ae089 100644
--- a/testcases/kernel/syscalls/write/write02.c
+++ b/testcases/kernel/syscalls/write/write02.c
@@ -28,7 +28,7 @@ static void verify_write(void)
{
TEST(write(fd, NULL, 0));
- if (TEST_RETURN != 0) {
+ if (TST_RET != 0) {
tst_res(TFAIL | TTERRNO,
"write() should have succeeded with ret=0");
return;
diff --git a/testcases/kernel/syscalls/write/write04.c b/testcases/kernel/syscalls/write/write04.c
index 36ef97e8a..4ca8eca88 100644
--- a/testcases/kernel/syscalls/write/write04.c
+++ b/testcases/kernel/syscalls/write/write04.c
@@ -45,12 +45,12 @@ static void verify_write(void)
TEST(write(wfd, wbuf, sizeof(wbuf)));
- if (TEST_RETURN != -1) {
+ if (TST_RET != -1) {
tst_res(TFAIL, "write() succeeded unexpectedly");
return;
}
- if (TEST_ERRNO != EAGAIN) {
+ if (TST_ERR != EAGAIN) {
tst_res(TFAIL | TTERRNO,
"write() failed unexpectedly, expected EAGAIN");
return;
diff --git a/testcases/kernel/syscalls/write/write05.c b/testcases/kernel/syscalls/write/write05.c
index ec157ae28..023b04a68 100644
--- a/testcases/kernel/syscalls/write/write05.c
+++ b/testcases/kernel/syscalls/write/write05.c
@@ -71,12 +71,12 @@ static void verify_write(unsigned int i)
TEST(write(*tc->fd, *tc->buf, tc->size));
- if (TEST_RETURN != -1) {
+ if (TST_RET != -1) {
tst_res(TFAIL, "write() succeeded unexpectedly");
return;
}
- if (TEST_ERRNO != tc->exp_errno) {
+ if (TST_ERR != tc->exp_errno) {
tst_res(TFAIL | TTERRNO,
"write() failed unexpectedly, expected %s",
tst_strerrno(tc->exp_errno));
diff --git a/testcases/kernel/syscalls/writev/writev01.c b/testcases/kernel/syscalls/writev/writev01.c
index 7753db4ac..539b529b8 100644
--- a/testcases/kernel/syscalls/writev/writev01.c
+++ b/testcases/kernel/syscalls/writev/writev01.c
@@ -130,17 +130,17 @@ static void test_writev(unsigned int i)
TEST(writev(*(tcase->pfd), *(tcase->piovec), tcase->iovcnt));
- ret = (TEST_RETURN == tcase->exp_ret);
- if (TEST_RETURN < 0 || tcase->exp_ret < 0) {
- ret &= (TEST_ERRNO == tcase->exp_errno);
+ ret = (TST_RET == tcase->exp_ret);
+ if (TST_RET < 0 || tcase->exp_ret < 0) {
+ ret &= (TST_ERR == tcase->exp_errno);
tst_res((ret ? TPASS : TFAIL),
"%s, expected: %d (%s), got: %ld (%s)", tcase->desc,
tcase->exp_ret, tst_strerrno(tcase->exp_errno),
- TEST_RETURN, tst_strerrno(TEST_ERRNO));
+ TST_RET, tst_strerrno(TST_ERR));
} else {
tst_res((ret ? TPASS : TFAIL),
"%s, expected: %d, got: %ld", tcase->desc,
- tcase->exp_ret, TEST_RETURN);
+ tcase->exp_ret, TST_RET);
}
}
diff --git a/testcases/kernel/syscalls/writev/writev07.c b/testcases/kernel/syscalls/writev/writev07.c
index 732218942..ec883ed15 100644
--- a/testcases/kernel/syscalls/writev/writev07.c
+++ b/testcases/kernel/syscalls/writev/writev07.c
@@ -71,14 +71,14 @@ static void test_partially_valid_iovec(int initial_file_offset)
off_after = (long) SAFE_LSEEK(fd, 0, SEEK_CUR);
/* bad errno */
- if (TEST_RETURN == -1 && TEST_ERRNO != EFAULT) {
+ if (TST_RET == -1 && TST_ERR != EFAULT) {
tst_res(TFAIL | TTERRNO, "unexpected errno");
SAFE_CLOSE(fd);
return;
}
/* nothing has been written */
- if (TEST_RETURN == -1 && TEST_ERRNO == EFAULT) {
+ if (TST_RET == -1 && TST_ERR == EFAULT) {
tst_res(TINFO, "got EFAULT");
/* initial file content remains untouched */
SAFE_LSEEK(fd, 0, SEEK_SET);
@@ -100,8 +100,8 @@ static void test_partially_valid_iovec(int initial_file_offset)
}
/* writev() wrote more bytes than bytes preceding invalid iovec */
- tst_res(TINFO, "writev() has written %ld bytes", TEST_RETURN);
- if (TEST_RETURN > (long) wr_iovec[0].iov_len) {
+ tst_res(TINFO, "writev() has written %ld bytes", TST_RET);
+ if (TST_RET > (long) wr_iovec[0].iov_len) {
tst_res(TFAIL, "writev wrote more than expected");
SAFE_CLOSE(fd);
return;
@@ -109,19 +109,19 @@ static void test_partially_valid_iovec(int initial_file_offset)
/* file content matches written bytes */
SAFE_LSEEK(fd, initial_file_offset, SEEK_SET);
- SAFE_READ(1, fd, tmp, TEST_RETURN);
- if (memcmp(tmp, wr_iovec[0].iov_base, TEST_RETURN) == 0) {
+ SAFE_READ(1, fd, tmp, TST_RET);
+ if (memcmp(tmp, wr_iovec[0].iov_base, TST_RET) == 0) {
tst_res(TPASS, "file has expected content");
} else {
tst_res(TFAIL, "file has unexpected content");
- tst_res_hexd(TFAIL, wr_iovec[0].iov_base, TEST_RETURN,
+ tst_res_hexd(TFAIL, wr_iovec[0].iov_base, TST_RET,
"expected:");
- tst_res_hexd(TFAIL, tmp, TEST_RETURN,
+ tst_res_hexd(TFAIL, tmp, TST_RET,
"actual file content:");
}
/* file offset has been updated according to written bytes */
- if (off_after == initial_file_offset + TEST_RETURN)
+ if (off_after == initial_file_offset + TST_RET)
tst_res(TPASS, "offset at %ld as expected", off_after);
else
tst_res(TFAIL, "offset unexpected %ld", off_after);
diff --git a/testcases/network/lib6/in6_01.c b/testcases/network/lib6/in6_01.c
index dc1461735..cb1801191 100644
--- a/testcases/network/lib6/in6_01.c
+++ b/testcases/network/lib6/in6_01.c
@@ -147,12 +147,12 @@ static void test_in6_is_addr_v4mapped(void)
"\"%s\" is not a valid IPv6 address",
maptab[i].addr);
TEST(IN6_IS_ADDR_V4MAPPED(in6.s6_addr));
- if (maptab[i].ismap == TEST_RETURN)
+ if (maptab[i].ismap == TST_RET)
tst_res(TINFO, "IN6_IS_ADDR_V4MAPPED(\"%s\") %ld",
- maptab[i].addr, TEST_RETURN);
+ maptab[i].addr, TST_RET);
else {
tst_res(TFAIL, "IN6_IS_ADDR_V4MAPPED(\"%s\") %ld",
- maptab[i].addr, TEST_RETURN);
+ maptab[i].addr, TST_RET);
return;
}
}
diff --git a/testcases/network/lib6/in6_02.c b/testcases/network/lib6/in6_02.c
index d5fa74996..6cc0242f9 100644
--- a/testcases/network/lib6/in6_02.c
+++ b/testcases/network/lib6/in6_02.c
@@ -66,24 +66,24 @@ static void if_nametoindex_test(void)
}
TEST(if_nametoindex(test_case[i].name));
- if (!TEST_RETURN != !test_case[i].nonzero) {
+ if (!TST_RET != !test_case[i].nonzero) {
tst_res(TFAIL, "if_nametoindex(%s) %ld [should be %szero]",
- test_case[i].name, TEST_RETURN,
+ test_case[i].name, TST_RET,
test_case[i].nonzero ? "non" : "");
return;
}
- if (TEST_RETURN) {
- pifn = if_indextoname(TEST_RETURN, ifname);
+ if (TST_RET) {
+ pifn = if_indextoname(TST_RET, ifname);
if (!pifn || strcmp(test_case[i].name, pifn)) {
tst_res(TFAIL,
"if_nametoindex(%s) %ld doesn't match if_indextoname(%ld) '%s'",
- test_case[i].name, TEST_RETURN,
- TEST_RETURN, pifn ? pifn : "");
+ test_case[i].name, TST_RET,
+ TST_RET, pifn ? pifn : "");
return;
}
}
tst_res(TINFO, "if_nametoindex(%s) %ld",
- test_case[i].name, TEST_RETURN);
+ test_case[i].name, TST_RET);
}
tst_res(TPASS, "if_nametoindex() test succeeded");
@@ -95,11 +95,11 @@ static int sub_if_indextoname_test(unsigned int if_index)
unsigned int idx;
TEST((ifname == if_indextoname(if_index, ifname)));
- if (!TEST_RETURN) {
- if (TEST_ERRNO != ENXIO) {
+ if (!TST_RET) {
+ if (TST_ERR != ENXIO) {
tst_res(TFAIL,
"if_indextoname(%d) returns %ld but errno %d != ENXIO",
- if_index, TEST_RETURN, TEST_ERRNO);
+ if_index, TST_RET, TST_ERR);
return 0;
}
tst_res(TINFO, "if_indextoname(%d) returns NULL", if_index);
@@ -176,7 +176,7 @@ static void if_nameindex_test(void)
pini = if_nameindex();
if (pini == NULL) {
tst_res(TFAIL, "if_nameindex() returns NULL, errno %d (%s)",
- TEST_ERRNO, strerror(TEST_ERRNO));
+ TST_ERR, strerror(TST_ERR));
return;
}
for (i = 0; pini[i].if_index; ++i) {
--
2.16.4
^ permalink raw reply related
* Re: [PATCH 3/2 for pb/bisect-helper-2] squash! bisect--helper: `bisect_start` shell function partially in C
From: Derrick Stolee @ 2018-07-23 13:24 UTC (permalink / raw)
To: SZEDER Gábor, Junio C Hamano
Cc: git, Lars Schneider, Nguyễn Thái Ngọc Duy
In-Reply-To: <20180723130603.22703-1-szeder.dev@gmail.com>
On 7/23/2018 9:06 AM, SZEDER Gábor wrote:
> bisect--helper: use oid_to_hex()
>
> Signed-off-by: SZEDER Gábor <szeder.dev@gmail.com>
> ---
> builtin/bisect--helper.c | 2 +-
> 1 file changed, 1 insertion(+), 1 deletion(-)
>
> diff --git a/builtin/bisect--helper.c b/builtin/bisect--helper.c
> index fc02f889e6..eac4c27787 100644
> --- a/builtin/bisect--helper.c
> +++ b/builtin/bisect--helper.c
> @@ -547,7 +547,7 @@ static int bisect_start(struct bisect_terms *terms, int no_checkout,
> if (!get_oid(head, &head_oid) &&
> !starts_with(head, "refs/heads/")) {
> strbuf_reset(&start_head);
> - strbuf_addstr(&start_head, sha1_to_hex(head_oid.hash));
> + strbuf_addstr(&start_head, oid_to_hex(&head_oid));
> } else if (!get_oid(head, &head_oid) &&
> skip_prefix(head, "refs/heads/", &head)) {
> /*
This patch looks obviously correct. Thanks!
-Stolee
^ permalink raw reply
* Re: [PATCH 2/2] travis-ci: fail if Coccinelle static analysis found something to transform
From: Derrick Stolee @ 2018-07-23 13:23 UTC (permalink / raw)
To: SZEDER Gábor, Junio C Hamano
Cc: git, Lars Schneider, Nguyễn Thái Ngọc Duy
In-Reply-To: <20180723130230.22491-3-szeder.dev@gmail.com>
On 7/23/2018 9:02 AM, SZEDER Gábor wrote:
> Coccinelle's and in turn 'make coccicheck's exit code only indicates
> that Coccinelle managed to finish its analysis without any errors
> (e.g. no unknown --options, no missing files, no syntax errors in the
> semantic patches, etc.), but it doesn't indicate whether it found any
> undesired code patterns to transform or not. To find out the latter,
> one has to look closer at 'make coccicheck's standard output and look
> for lines like:
>
> SPATCH result: contrib/coccinelle/<something>.cocci.patch
>
> And this only indicates that there is something to transform, but to
> see what the suggested transformations are one has to actually look
> into those '*.cocci.patch' files.
>
> This makes the automated static analysis build job on Travis CI not
> particularly useful, because it neither draws our attention to
> Coccinelle's findings, nor shows the actual findings. Consequently,
> new topics introducing undesired code patterns graduated to master
> on several occasions without anyone noticing.
>
> The only way to draw attention in such an automated setting is to fail
> the build job. Therefore, modify the 'ci/run-static-analysis.sh'
> build script to check all the resulting '*.cocci.patch' files, and
> fail the build job if any of them turns out to be not empty. Include
> those files' contents, i.e. Coccinelle's suggested transformations, in
> the build job's trace log, so we'll know why it failed.
>
> Signed-off-by: SZEDER Gábor <szeder.dev@gmail.com>
> ---
> ci/run-static-analysis.sh | 19 +++++++++++++++++++
> 1 file changed, 19 insertions(+)
>
> diff --git a/ci/run-static-analysis.sh b/ci/run-static-analysis.sh
> index fa719c9ef9..5688f261d0 100755
> --- a/ci/run-static-analysis.sh
> +++ b/ci/run-static-analysis.sh
> @@ -7,4 +7,23 @@
>
> make --jobs=2 coccicheck
>
> +set +x
> +
> +fail=
> +for cocci_patch in contrib/coccinelle/*.patch
> +do
> + if test -s "$cocci_patch"
> + then
> + echo "$(tput setaf 1)Coccinelle suggests the following changes in '$cocci_patch':$(tput sgr0)"
> + cat "$cocci_patch"
> + fail=UnfortunatelyYes
> + fi
> +done
> +
> +if test -n "$fail"
> +then
> + echo "$(tput setaf 1)error: Coccinelle suggested some changes$(tput sgr0)"
> + exit 1
> +fi
> +
> save_good_tree
This looks like the right way to report a failure. It provides as much
information as possible. I agree that we should have this as part of CI
so we find issues more quickly.
Thanks!
-Stolee
^ permalink raw reply
* Re: [PATCH] Btrfs: remove unused key assignment when doing a full send
From: David Sterba @ 2018-07-23 12:22 UTC (permalink / raw)
To: fdmanana; +Cc: linux-btrfs
In-Reply-To: <20180723081009.4884-1-fdmanana@kernel.org>
On Mon, Jul 23, 2018 at 09:10:09AM +0100, fdmanana@kernel.org wrote:
> From: Filipe Manana <fdmanana@suse.com>
>
> At send.c:full_send_tree() we were setting the 'key' variable in the loop
> while never using it later. We were also using two btrfs_key variables
> to store the initial key for search and the key found in every iteration
> of the loop. So remove this useless key assignment and use the same
> btrfs_key variable to store the initial search key and the key found in
> each iteration. This was introduced in the initial send commit but was
> never used (commit 31db9f7c23fb ("Btrfs: introduce BTRFS_IOC_SEND for
> btrfs send/receive").
>
> Signed-off-by: Filipe Manana <fdmanana@suse.com>
Reviewed-by: David Sterba <dsterba@suse.com>
^ permalink raw reply
* Re: [PATCH] mkfs: avoid divide-by-zero when hardware reports optimal i/o size as 0
From: Carlos Maiolino @ 2018-07-23 12:21 UTC (permalink / raw)
To: Darrick J. Wong
Cc: Jeff Mahoney, linux-xfs@vger.kernel.org, Eric Sandeen,
Dave Chinner
In-Reply-To: <20180720161923.GO4813@magnolia>
On Fri, Jul 20, 2018 at 09:19:23AM -0700, Darrick J. Wong wrote:
> On Fri, Jul 20, 2018 at 05:55:29PM +0200, Carlos Maiolino wrote:
> > On Thu, Jul 19, 2018 at 05:23:22PM -0400, Jeff Mahoney wrote:
> > > Commit 051b4e37f5e (mkfs: factor AG alignment) factored out the
> > > AG alignment code into a separate function. It got rid of
> > > redundant checks for dswidth != 0 since calc_stripe_factors was
> > > supposed to guarantee that if dsunit is non-zero dswidth will be
> > > as well. Unfortunately, there's hardware out there that reports its
> > > optimal i/o size as larger than the maximum i/o size, which the kernel
> > > treats as broken and zeros out the optimal i/o size. We'll accept
> > > the multi-sector dsunit but have a zero dswidth and hit a divide-by-zero
> > > in align_ag_geometry.
> > >
> > > To resolve this we can check the topology before consuming it, default
> > > to using the stripe unit as the stripe width, and warn the user about it.
> > >
> >
> > I wonder if this shouldn't go into blkid_get_topology since something is wrong
> > with the information reported by the storage.
>
> If the storage gives us crap geometry information we don't have to use
> it. Keep the message that we autodetected nonsense and are dropping it;
> the sysadmin can always re-run mkfs with sensible dsunit/dswidth.
>
> > And require a force_overwrite to continue, at this point, something looks quite
> > wrong in the storage, and I think this is the last 'resource' a sysadmin will
> > have to notice this before making the FS, and start using it, so, maybe requiring
> > force_overwrite would bring more attention.
>
> I prefer reserving -f for "This is about to destroy something and can't
> be undone", not "This auto-optimization is screwed up, continue? (y/N)"
Yeah, I agree, forget everything I said here :P
>
> --D
>
> > > Fixes: 051b4e37f5e (mkfs: factor AG alignment)
> > > Signed-off-by: Jeff Mahoney <jeffm@suse.com>
> > > ---
> > > mkfs/xfs_mkfs.c | 6 ++++++
> > > 1 file changed, 6 insertions(+)
> > >
> > > diff --git a/mkfs/xfs_mkfs.c b/mkfs/xfs_mkfs.c
> > > index a135e06e..35542e57 100644
> > > --- a/mkfs/xfs_mkfs.c
> > > +++ b/mkfs/xfs_mkfs.c
> > > @@ -2295,6 +2295,12 @@ _("data stripe width (%d) must be a multiple of the data stripe unit (%d)\n"),
> > > if (!dsunit) {
> > > dsunit = ft->dsunit;
> > > dswidth = ft->dswidth;
> > > + if (dsunit && dswidth == 0) {
> > > + fprintf(stderr,
> > > +_("%s: Volume reports stripe unit of %d bytes but stripe width of 0. Using stripe width of %d bytes, which may not be optimal.\n"),
> > > + progname, dsunit << 9, dsunit << 9);
> > > + dswidth = dsunit;
> > > + }
> > > use_dev = true;
> > > } else {
> > > /* check and warn is alignment is sub-optimal */
> > > --
> > > 2.16.4
> > >
> > >
> > > --
> > > To unsubscribe from this list: send the line "unsubscribe linux-xfs" in
> > > the body of a message to majordomo@vger.kernel.org
> > > More majordomo info at http://vger.kernel.org/majordomo-info.html
> >
> > --
> > Carlos
> > --
> > To unsubscribe from this list: send the line "unsubscribe linux-xfs" in
> > the body of a message to majordomo@vger.kernel.org
> > More majordomo info at http://vger.kernel.org/majordomo-info.html
> --
> To unsubscribe from this list: send the line "unsubscribe linux-xfs" in
> the body of a message to majordomo@vger.kernel.org
> More majordomo info at http://vger.kernel.org/majordomo-info.html
--
Carlos
^ permalink raw reply
* Re: [f2fs-dev] [PATCH v2] f2fs: split discard command in prior to block layer
From: Chao Yu @ 2018-07-23 13:22 UTC (permalink / raw)
To: Jaegeuk Kim; +Cc: linux-kernel, linux-f2fs-devel
In-Reply-To: <20180723124747.GB19644@jaegeuk-macbookpro.roam.corp.google.com>
On 2018/7/23 20:47, Jaegeuk Kim wrote:
> On 07/15, Chao Yu wrote:
>> On 2018/7/15 11:13, Jaegeuk Kim wrote:
>>> On 07/15, Chao Yu wrote:
>>>> Hi Jaegeuk,
>>>>
>>>> On 2018/7/15 9:27, Jaegeuk Kim wrote:
>>>>> On 07/08, Chao Yu wrote:
>>>>>> From: Chao Yu <yuchao0@huawei.com>
>>>>>>
>>>>>> Some devices has small max_{hw,}discard_sectors, so that in
>>>>>> __blkdev_issue_discard(), one big size discard bio can be split
>>>>>> into multiple small size discard bios, result in heavy load in IO
>>>>>> scheduler and device, which can hang other sync IO for long time.
>>>>>>
>>>>>> Now, f2fs is trying to control discard commands more elaboratively,
>>>>>> in order to make less conflict in between discard IO and user IO
>>>>>> to enhance application's performance, so in this patch, we will
>>>>>> split discard bio in f2fs in prior to in block layer to reduce
>>>>>> issuing multiple discard bios in a short time.
>>>>>
>>>>> Can we just change __submit_discard_cmd() to submit the large candidate
>>>>> partially and adjust lstart in the original candidate?
>>>>
>>>> Yep, could you check __submit_discard_cmd() implementation below? Does that
>>>> match the thoughts from you?
>>>>
>>>> Thanks,
>>>>
>>>>>
>>>>>>
>>>>>> Signed-off-by: Chao Yu <yuchao0@huawei.com>
>>>>>> ---
>>>>>> v2:
>>>>>> - change to split discard command entry before submission.
>>>>>> fs/f2fs/f2fs.h | 13 +++---
>>>>>> fs/f2fs/segment.c | 117 +++++++++++++++++++++++++++++++++++++-----------------
>>>>>> 2 files changed, 86 insertions(+), 44 deletions(-)
>>>>>>
>>>>>> diff --git a/fs/f2fs/f2fs.h b/fs/f2fs/f2fs.h
>>>>>> index c48b655d5d8d..359526d88d3f 100644
>>>>>> --- a/fs/f2fs/f2fs.h
>>>>>> +++ b/fs/f2fs/f2fs.h
>>>>>> @@ -178,7 +178,6 @@ enum {
>>>>>>
>>>>>> #define MAX_DISCARD_BLOCKS(sbi) BLKS_PER_SEC(sbi)
>>>>>> #define DEF_MAX_DISCARD_REQUEST 8 /* issue 8 discards per round */
>>>>>> -#define DEF_MAX_DISCARD_LEN 512 /* Max. 2MB per discard */
>>>>>> #define DEF_MIN_DISCARD_ISSUE_TIME 50 /* 50 ms, if exists */
>>>>>> #define DEF_MID_DISCARD_ISSUE_TIME 500 /* 500 ms, if device busy */
>>>>>> #define DEF_MAX_DISCARD_ISSUE_TIME 60000 /* 60 s, if no candidates */
>>>>>> @@ -709,22 +708,22 @@ static inline void set_extent_info(struct extent_info *ei, unsigned int fofs,
>>>>>> }
>>>>>>
>>>>>> static inline bool __is_discard_mergeable(struct discard_info *back,
>>>>>> - struct discard_info *front)
>>>>>> + struct discard_info *front, unsigned int max_len)
>>>>>> {
>>>>>> return (back->lstart + back->len == front->lstart) &&
>>>>>> - (back->len + front->len < DEF_MAX_DISCARD_LEN);
>>>>>> + (back->len + front->len <= max_len);
>>>>>> }
>>>>>>
>>>>>> static inline bool __is_discard_back_mergeable(struct discard_info *cur,
>>>>>> - struct discard_info *back)
>>>>>> + struct discard_info *back, unsigned int max_len)
>>>>>> {
>>>>>> - return __is_discard_mergeable(back, cur);
>>>>>> + return __is_discard_mergeable(back, cur, max_len);
>>>>>> }
>>>>>>
>>>>>> static inline bool __is_discard_front_mergeable(struct discard_info *cur,
>>>>>> - struct discard_info *front)
>>>>>> + struct discard_info *front, unsigned int max_len)
>>>>>> {
>>>>>> - return __is_discard_mergeable(cur, front);
>>>>>> + return __is_discard_mergeable(cur, front, max_len);
>>>>>> }
>>>>>>
>>>>>> static inline bool __is_extent_mergeable(struct extent_info *back,
>>>>>> diff --git a/fs/f2fs/segment.c b/fs/f2fs/segment.c
>>>>>> index f7f56dd091b4..cbf8f3f9a8e7 100644
>>>>>> --- a/fs/f2fs/segment.c
>>>>>> +++ b/fs/f2fs/segment.c
>>>>>> @@ -966,17 +966,24 @@ static void __init_discard_policy(struct f2fs_sb_info *sbi,
>>>>>> }
>>>>>> }
>>>>>>
>>>>>> -
>>>
>>> ===================== BEGIN
>>>
>>>>>> +static void __update_discard_tree_range(struct f2fs_sb_info *sbi,
>>>>>> + struct block_device *bdev, block_t lstart,
>>>>>> + block_t start, block_t len);
>>>>>> /* this function is copied from blkdev_issue_discard from block/blk-lib.c */
>>>>>> static void __submit_discard_cmd(struct f2fs_sb_info *sbi,
>>>>>> struct discard_policy *dpolicy,
>>>>>> - struct discard_cmd *dc)
>>>>>> + struct discard_cmd *dc,
>>>>>> + unsigned int *issued)
>>>>>> {
>>>>>> + struct block_device *bdev = dc->bdev;
>>>>>> + struct request_queue *q = bdev_get_queue(bdev);
>>>>>> + unsigned int max_discard_blocks =
>>>>>> + SECTOR_TO_BLOCK(q->limits.max_discard_sectors);
>>>>>> struct discard_cmd_control *dcc = SM_I(sbi)->dcc_info;
>>>>>> struct list_head *wait_list = (dpolicy->type == DPOLICY_FSTRIM) ?
>>>>>> &(dcc->fstrim_list) : &(dcc->wait_list);
>>>>>> - struct bio *bio = NULL;
>>>>>> int flag = dpolicy->sync ? REQ_SYNC : 0;
>>>>>> + block_t lstart, start, len, total_len;
>>>>>>
>>>>>> if (dc->state != D_PREP)
>>>>>> return;
>>>>>> @@ -984,30 +991,63 @@ static void __submit_discard_cmd(struct f2fs_sb_info *sbi,
>>>>>> if (is_sbi_flag_set(sbi, SBI_NEED_FSCK))
>>>>>> return;
>>>>>>
>>>>>> - trace_f2fs_issue_discard(dc->bdev, dc->start, dc->len);
>>>>>> -
>>>>>> - dc->error = __blkdev_issue_discard(dc->bdev,
>>>>>> - SECTOR_FROM_BLOCK(dc->start),
>>>>>> - SECTOR_FROM_BLOCK(dc->len),
>>>>>> - GFP_NOFS, 0, &bio);
>>>>>> - if (!dc->error) {
>>>>>> - /* should keep before submission to avoid D_DONE right away */
>>>>>> - dc->state = D_SUBMIT;
>>>>>> - atomic_inc(&dcc->issued_discard);
>>>>>> - atomic_inc(&dcc->issing_discard);
>>>>>> - if (bio) {
>>>>>> - bio->bi_private = dc;
>>>>>> - bio->bi_end_io = f2fs_submit_discard_endio;
>>>>>> - bio->bi_opf |= flag;
>>>>>> - submit_bio(bio);
>>>>>> - list_move_tail(&dc->list, wait_list);
>>>>>> - __check_sit_bitmap(sbi, dc->start, dc->start + dc->len);
>>>>>> -
>>>>>> - f2fs_update_iostat(sbi, FS_DISCARD, 1);
>>>>>> + trace_f2fs_issue_discard(bdev, dc->start, dc->len);
>>>>>> +
>>>>>> + lstart = dc->lstart;
>>>>>> + start = dc->start;
>>>>>> + len = dc->len;
>>>>>> + total_len = len;
>>>>>> +
>>>>>> + while (total_len && *issued < dpolicy->max_requests) {
>>>>>> + struct bio *bio = NULL;
>>>>>> +
>>>>>> + if (len > max_discard_blocks)
>>>>>> + len = max_discard_blocks;
>>>>>> +
>>>>>> + dc->error = __blkdev_issue_discard(bdev,
>>>>>> + SECTOR_FROM_BLOCK(start),
>>>>>> + SECTOR_FROM_BLOCK(len),
>>>>>> + GFP_NOFS, 0, &bio);
>>>>>> + if (!dc->error) {
>>>>>> + /*
>>>>>> + * should keep before submission to avoid D_DONE
>>>>>> + * right away
>>>>>> + */
>>>>>> + dc->state = D_SUBMIT;
>>>>>> + dc->len = len;
>>>>>> + atomic_inc(&dcc->issued_discard);
>>>>>> + atomic_inc(&dcc->issing_discard);
>>>>>> + if (bio) {
>>>>>> + bio->bi_private = dc;
>>>>>> + bio->bi_end_io = f2fs_submit_discard_endio;
>>>>>> + bio->bi_opf |= flag;
>>>>>> + submit_bio(bio);
>>>>>> + list_move_tail(&dc->list, wait_list);
>>>>>> + __check_sit_bitmap(sbi, dc->start,
>>>>>> + dc->start + dc->len);
>>>>>> +
>>>>>> + f2fs_update_iostat(sbi, FS_DISCARD, 1);
>>>>>> + }
>>>>>> + } else {
>>>>>> + __remove_discard_cmd(sbi, dc);
>>>
>>> Keep the original one, since it's partially failed?
>>
>> During __submit_discard_cmd(), we are trying to split original dc into multiple
>> dc, and once we failed to submit some of them, we will remove corresponding dc,
>> the removal logic is the same as before, not being changed...
>>
>> If we want to keep failed dc and do retry, we'd better add another patch for
>> that, right?
>
> I thought removing failed portion of the dc.
>
>>
>>>
>>>>>> + return;
>>>>>> + }
>>>>>> + lstart += len;
>>>>>> + start += len;
>>>>>> + total_len -= len;
>>>>>> + len = total_len;
>>>>>> + (*issued)++;
>>>>>> +
>>>>>> + if (len) {
>>>>>> + __update_discard_tree_range(sbi, bdev, lstart,
>>>>>> + start, len);
>>>
>>> Do we really need this? We already grabbed one candidate which was not merged
>>> well.
>>
>> You mean submitting multiple bios based on one large size dc?
>
> Yes.
>
>>
>> Previously, one bio references to one dc as below, in end_io, it will change
>> dc->state which can be detected by its own waiter.
>>
>> bio->bi_private = dc;
>> bio->bi_end_io = f2fs_submit_discard_endio;
>> bio->bi_opf |= flag;
>>
>> If multiple bios reference to one dc, it will be more complicated to handle
>> that. How do you think?
>
> I was concerned about too many entries in the lists. How about adding a refcnt
> to count how many bios were issued on the dc?
Got you, let me try to refactor a bit for that.
Thanks,
>
> Thanks,
>
>>
>> Thanks,
>>
>>>
>>>>>> + dc = (struct discard_cmd *)f2fs_lookup_rb_tree(
>>>>>> + &dcc->root, NULL, lstart);
>>>>>> + f2fs_bug_on(sbi, !dc);
>>>>>> }
>>>>>> - } else {
>>>>>> - __remove_discard_cmd(sbi, dc);
>>>>>> }
>>>>>> +
>>>>>> + return;
>>>>>> }
>>>
>>> ======================= END
>>>
>>>
>>>>>>
>>>>>> static struct discard_cmd *__insert_discard_tree(struct f2fs_sb_info *sbi,
>>>>>> @@ -1088,10 +1128,11 @@ static void __update_discard_tree_range(struct f2fs_sb_info *sbi,
>>>>>> struct discard_cmd *dc;
>>>>>> struct discard_info di = {0};
>>>>>> struct rb_node **insert_p = NULL, *insert_parent = NULL;
>>>>>> + struct request_queue *q = bdev_get_queue(bdev);
>>>>>> + unsigned int max_discard_blocks =
>>>>>> + SECTOR_TO_BLOCK(q->limits.max_discard_sectors);
>>>>>> block_t end = lstart + len;
>>>>>>
>>>>>> - mutex_lock(&dcc->cmd_lock);
>>>>>> -
>>>>>> dc = (struct discard_cmd *)f2fs_lookup_rb_tree_ret(&dcc->root,
>>>>>> NULL, lstart,
>>>>>> (struct rb_entry **)&prev_dc,
>>>>>> @@ -1131,7 +1172,8 @@ static void __update_discard_tree_range(struct f2fs_sb_info *sbi,
>>>>>>
>>>>>> if (prev_dc && prev_dc->state == D_PREP &&
>>>>>> prev_dc->bdev == bdev &&
>>>>>> - __is_discard_back_mergeable(&di, &prev_dc->di)) {
>>>>>> + __is_discard_back_mergeable(&di, &prev_dc->di,
>>>>>> + max_discard_blocks)) {
>>>>>> prev_dc->di.len += di.len;
>>>>>> dcc->undiscard_blks += di.len;
>>>>>> __relocate_discard_cmd(dcc, prev_dc);
>>>>>> @@ -1142,7 +1184,8 @@ static void __update_discard_tree_range(struct f2fs_sb_info *sbi,
>>>>>>
>>>>>> if (next_dc && next_dc->state == D_PREP &&
>>>>>> next_dc->bdev == bdev &&
>>>>>> - __is_discard_front_mergeable(&di, &next_dc->di)) {
>>>>>> + __is_discard_front_mergeable(&di, &next_dc->di,
>>>>>> + max_discard_blocks)) {
>>>>>> next_dc->di.lstart = di.lstart;
>>>>>> next_dc->di.len += di.len;
>>>>>> next_dc->di.start = di.start;
>>>>>> @@ -1165,8 +1208,6 @@ static void __update_discard_tree_range(struct f2fs_sb_info *sbi,
>>>>>> node = rb_next(&prev_dc->rb_node);
>>>>>> next_dc = rb_entry_safe(node, struct discard_cmd, rb_node);
>>>>>> }
>>>>>> -
>>>>>> - mutex_unlock(&dcc->cmd_lock);
>>>>>> }
>>>>>>
>>>>>> static int __queue_discard_cmd(struct f2fs_sb_info *sbi,
>>>>>> @@ -1181,7 +1222,9 @@ static int __queue_discard_cmd(struct f2fs_sb_info *sbi,
>>>>>>
>>>>>> blkstart -= FDEV(devi).start_blk;
>>>>>> }
>>>>>> + mutex_lock(&SM_I(sbi)->dcc_info->cmd_lock);
>>>>>> __update_discard_tree_range(sbi, bdev, lblkstart, blkstart, blklen);
>>>>>> + mutex_unlock(&SM_I(sbi)->dcc_info->cmd_lock);
>>>>>> return 0;
>>>>>> }
>>>>>>
>>>>>> @@ -1220,9 +1263,9 @@ static unsigned int __issue_discard_cmd_orderly(struct f2fs_sb_info *sbi,
>>>>>> }
>>>>>>
>>>>>> dcc->next_pos = dc->lstart + dc->len;
>>>>>> - __submit_discard_cmd(sbi, dpolicy, dc);
>>>>>> + __submit_discard_cmd(sbi, dpolicy, dc, &issued);
>>>>>>
>>>>>> - if (++issued >= dpolicy->max_requests)
>>>>>> + if (issued >= dpolicy->max_requests)
>>>>>> break;
>>>>>> next:
>>>>>> node = rb_next(&dc->rb_node);
>>>>>> @@ -1277,9 +1320,9 @@ static int __issue_discard_cmd(struct f2fs_sb_info *sbi,
>>>>>> break;
>>>>>> }
>>>>>>
>>>>>> - __submit_discard_cmd(sbi, dpolicy, dc);
>>>>>> + __submit_discard_cmd(sbi, dpolicy, dc, &issued);
>>>>>>
>>>>>> - if (++issued >= dpolicy->max_requests)
>>>>>> + if (issued >= dpolicy->max_requests)
>>>>>> break;
>>>>>> }
>>>>>> blk_finish_plug(&plug);
>>>>>> @@ -2475,9 +2518,9 @@ static unsigned int __issue_discard_cmd_range(struct f2fs_sb_info *sbi,
>>>>>> goto skip;
>>>>>> }
>>>>>>
>>>>>> - __submit_discard_cmd(sbi, dpolicy, dc);
>>>>>> + __submit_discard_cmd(sbi, dpolicy, dc, &issued);
>>>>>>
>>>>>> - if (++issued >= dpolicy->max_requests) {
>>>>>> + if (issued >= dpolicy->max_requests) {
>>>>>> start = dc->lstart + dc->len;
>>>>>>
>>>>>> blk_finish_plug(&plug);
>>>>>> --
>>>>>> 2.16.2.17.g38e79b1fd
>
> ------------------------------------------------------------------------------
> Check out the vibrant tech community on one of the world's most
> engaging tech sites, Slashdot.org! http://sdm.link/slashdot
> _______________________________________________
> Linux-f2fs-devel mailing list
> Linux-f2fs-devel@lists.sourceforge.net
> https://lists.sourceforge.net/lists/listinfo/linux-f2fs-devel
>
^ permalink raw reply
* Re: [PATCH 0/6] UBI fixes backported to 4.4.x
From: Greg KH @ 2018-07-23 12:20 UTC (permalink / raw)
To: Richard Weinberger; +Cc: stable
In-Reply-To: <20180723121014.30778-1-richard@nod.at>
On Mon, Jul 23, 2018 at 02:10:08PM +0200, Richard Weinberger wrote:
> Greg,
>
> this series contains backports of the following upstream commits:
>
> 243a4f8126fc ubi: Introduce vol_ignored()
> fdf10ed710c0 ubi: Rework Fastmap attach base code
> 74f2c6e9a47c ubi: Be more paranoid while seaching for the most recent Fastmap
> 2e8f08deabbc ubi: Fix races around ubi_refill_pools()
> f7d11b33d4e8 ubi: Fix Fastmap's update_vol()
> 5793f39de7f6 ubi: fastmap: Erase outdated anchor PEBs during attach
This last one was really commit f78e5623f45bab2b726eec29dc5cefbbab2d0b1c
upstream, please be a bit more careful in the future.
All now queued up.
thanks,
greg k-h
^ permalink raw reply
* [PATCH] drm/i915/gvt: fix cleanup sequence in intel_gvt_clean_device
From: hang.yuan @ 2018-07-23 12:15 UTC (permalink / raw)
To: intel-gvt-dev; +Cc: stable, Hang Yuan
From: Hang Yuan <hang.yuan@linux.intel.com>
Create one vGPU and then unbind IGD device from i915 driver. The following
oops will happen. This patch will free vgpu resource first and then gvt
resource to remove these oops.
BUG: unable to handle kernel NULL pointer dereference at 00000000000000a8
PGD 80000003c9d2c067 P4D 80000003c9d2c067 PUD 3c817c067 P MD 0
Oops: 0002 [#1] SMP PTI
RIP: 0010:down_write+0x1b/0x40
Call Trace:
debugfs_remove_recursive+0x46/0x1a0
intel_gvt_debugfs_remove_vgpu+0x15/0x30 [i915]
intel_gvt_destroy_vgpu+0x2d/0xf0 [i915]
intel_vgpu_remove+0x2c/0x30 [kvmgt]
mdev_device_remove_ops+0x23/0x50 [mdev]
mdev_device_remove+0xdb/0x190 [mdev]
mdev_device_remove+0x190/0x190 [mdev]
device_for_each_child+0x47/0x90
mdev_unregister_device+0xd5/0x120 [mdev]
intel_gvt_clean_device+0x91/0x120 [i915]
i915_driver_unload+0x9d/0x120 [i915]
i915_pci_remove+0x15/0x20 [i915]
pci_device_remove+0x3b/0xc0
device_release_driver_internal+0x157/0x230
unbind_store+0xfc/0x150
kernfs_fop_write+0x10f/0x180
__vfs_write+0x36/0x180
? common_file_perm+0x41/0x130
? _cond_resched+0x16/0x40
vfs_write+0xb3/0x1a0
ksys_write+0x52/0xc0
do_syscall_64+0x55/0x100
entry_SYSCALL_64_after_hwframe+0x44/0xa9
BUG: unable to handle kernel NULL pointer dereference at 0 000000000000038
PGD 8000000405bce067 P4D 8000000405bce067 PUD 405bcd067 PM D 0
Oops: 0000 [#1] SMP PTI
RIP: 0010:hrtimer_active+0x5/0x40
Call Trace:
hrtimer_try_to_cancel+0x25/0x120
? tbs_sched_clean_vgpu+0x1f/0x50 [i915]
hrtimer_cancel+0x15/0x20
intel_gvt_destroy_vgpu+0x4c/0xf0 [i915]
intel_vgpu_remove+0x2c/0x30 [kvmgt]
mdev_device_remove_ops+0x23/0x50 [mdev]
mdev_device_remove+0xdb/0x190 [mdev]
? mdev_device_remove+0x190/0x190 [mdev]
device_for_each_child+0x47/0x90
mdev_unregister_device+0xd5/0x120 [mdev]
intel_gvt_clean_device+0x89/0x120 [i915]
i915_driver_unload+0x9d/0x120 [i915]
i915_pci_remove+0x15/0x20 [i915]
pci_device_remove+0x3b/0xc0
device_release_driver_internal+0x157/0x230
unbind_store+0xfc/0x150
kernfs_fop_write+0x10f/0x180
__vfs_write+0x36/0x180
? common_file_perm+0x41/0x130
? _cond_resched+0x16/0x40
vfs_write+0xb3/0x1a0
ksys_write+0x52/0xc0
do_syscall_64+0x55/0x100
entry_SYSCALL_64_after_hwframe+0x44/0xa9
Fixes: bc7b0be316ae("drm/i915/gvt: Add basic debugfs infrastructure")
Fixes: afe04fbe6c52("drm/i915/gvt: create an idle vGPU")
Signed-off-by: Hang Yuan <hang.yuan@linux.intel.com>
---
drivers/gpu/drm/i915/gvt/gvt.c | 14 ++++++--------
1 file changed, 6 insertions(+), 8 deletions(-)
diff --git a/drivers/gpu/drm/i915/gvt/gvt.c b/drivers/gpu/drm/i915/gvt/gvt.c
index 4e65266..b96c6c7 100644
--- a/drivers/gpu/drm/i915/gvt/gvt.c
+++ b/drivers/gpu/drm/i915/gvt/gvt.c
@@ -315,6 +315,11 @@ void intel_gvt_clean_device(struct drm_i915_private *dev_priv)
if (WARN_ON(!gvt))
return;
+ intel_gvt_destroy_idle_vgpu(gvt->idle_vgpu);
+ intel_gvt_hypervisor_host_exit(&dev_priv->drm.pdev->dev, gvt);
+ intel_gvt_cleanup_vgpu_type_groups(gvt);
+ intel_gvt_clean_vgpu_types(gvt);
+
intel_gvt_debugfs_clean(gvt);
clean_service_thread(gvt);
intel_gvt_clean_cmd_parser(gvt);
@@ -322,17 +327,10 @@ void intel_gvt_clean_device(struct drm_i915_private *dev_priv)
intel_gvt_clean_workload_scheduler(gvt);
intel_gvt_clean_gtt(gvt);
intel_gvt_clean_irq(gvt);
- intel_gvt_clean_mmio_info(gvt);
intel_gvt_free_firmware(gvt);
-
- intel_gvt_hypervisor_host_exit(&dev_priv->drm.pdev->dev, gvt);
- intel_gvt_cleanup_vgpu_type_groups(gvt);
- intel_gvt_clean_vgpu_types(gvt);
-
+ intel_gvt_clean_mmio_info(gvt);
idr_destroy(&gvt->vgpu_idr);
- intel_gvt_destroy_idle_vgpu(gvt->idle_vgpu);
-
kfree(dev_priv->gvt);
dev_priv->gvt = NULL;
}
--
2.7.4
^ permalink raw reply related
* [PATCH v2 16/17] driver/edac: enable Hygon support to AMD64 EDAC driver
From: Pu Wen @ 2018-07-23 13:20 UTC (permalink / raw)
To: tglx, bp, thomas.lendacky, mingo, hpa, peterz, tony.luck,
pbonzini, rkrcmar, boris.ostrovsky, jgross, rjw, lenb,
viresh.kumar, mchehab, trenn, shuah, JBeulich, x86
Cc: linux-arch, xen-devel, linux-kernel, kvm
In-Reply-To: <1532352037-7151-1-git-send-email-puwen@hygon.cn>
To make AMD64 MCE and EDAC drivers working on Hygon platforms, add Hygon
vendor check for them. Also Hygon PCI Device ID DF_F0/DF_F6(0x1460/0x1466)
of Host bridge is needed for these drivers. And support Dhyana processors
by using AMD 0x17 codes.
Signed-off-by: Pu Wen <puwen@hygon.cn>
---
drivers/edac/amd64_edac.c | 20 +++++++++++++++++++-
drivers/edac/amd64_edac.h | 4 ++++
drivers/edac/mce_amd.c | 4 +++-
3 files changed, 26 insertions(+), 2 deletions(-)
diff --git a/drivers/edac/amd64_edac.c b/drivers/edac/amd64_edac.c
index 18aeabb..d8b4b0e 100644
--- a/drivers/edac/amd64_edac.c
+++ b/drivers/edac/amd64_edac.c
@@ -211,7 +211,7 @@ static int __set_scrub_rate(struct amd64_pvt *pvt, u32 new_bw, u32 min_rate)
scrubval = scrubrates[i].scrubval;
- if (pvt->fam == 0x17) {
+ if (pvt->fam == 0x17 || pvt->fam == 0x18) {
__f17h_set_scrubval(pvt, scrubval);
} else if (pvt->fam == 0x15 && pvt->model == 0x60) {
f15h_select_dct(pvt, 0);
@@ -264,6 +264,7 @@ static int get_scrub_rate(struct mem_ctl_info *mci)
break;
case 0x17:
+ case 0x18:
amd64_read_pci_cfg(pvt->F6, F17H_SCR_BASE_ADDR, &scrubval);
if (scrubval & BIT(0)) {
amd64_read_pci_cfg(pvt->F6, F17H_SCR_LIMIT_ADDR, &scrubval);
@@ -1044,6 +1045,7 @@ static void determine_memory_type(struct amd64_pvt *pvt)
goto ddr3;
case 0x17:
+ case 0x18:
if ((pvt->umc[0].dimm_cfg | pvt->umc[1].dimm_cfg) & BIT(5))
pvt->dram_type = MEM_LRDDR4;
else if ((pvt->umc[0].dimm_cfg | pvt->umc[1].dimm_cfg) & BIT(4))
@@ -2200,6 +2202,16 @@ static struct amd64_family_type family_types[] = {
.dbam_to_cs = f17_base_addr_to_cs_size,
}
},
+ [HYGON_F18_CPUS] = {
+ /* Hygon F18h uses the same AMD F17h support */
+ .ctl_name = "Hygon_F18h",
+ .f0_id = PCI_DEVICE_ID_HYGON_18H_DF_F0,
+ .f6_id = PCI_DEVICE_ID_HYGON_18H_DF_F6,
+ .ops = {
+ .early_channel_count = f17_early_channel_count,
+ .dbam_to_cs = f17_base_addr_to_cs_size,
+ }
+ },
};
/*
@@ -3192,6 +3204,11 @@ static struct amd64_family_type *per_family_init(struct amd64_pvt *pvt)
pvt->ops = &family_types[F17_CPUS].ops;
break;
+ case 0x18:
+ fam_type = &family_types[HYGON_F18_CPUS];
+ pvt->ops = &family_types[HYGON_F18_CPUS].ops;
+ break;
+
default:
amd64_err("Unsupported family!\n");
return NULL;
@@ -3428,6 +3445,7 @@ static const struct x86_cpu_id amd64_cpuids[] = {
{ X86_VENDOR_AMD, 0x15, X86_MODEL_ANY, X86_FEATURE_ANY, 0 },
{ X86_VENDOR_AMD, 0x16, X86_MODEL_ANY, X86_FEATURE_ANY, 0 },
{ X86_VENDOR_AMD, 0x17, X86_MODEL_ANY, X86_FEATURE_ANY, 0 },
+ { X86_VENDOR_HYGON, 0x18, X86_MODEL_ANY, X86_FEATURE_ANY, 0 },
{ }
};
MODULE_DEVICE_TABLE(x86cpu, amd64_cpuids);
diff --git a/drivers/edac/amd64_edac.h b/drivers/edac/amd64_edac.h
index 1d4b74e..6e5f609 100644
--- a/drivers/edac/amd64_edac.h
+++ b/drivers/edac/amd64_edac.h
@@ -116,6 +116,9 @@
#define PCI_DEVICE_ID_AMD_17H_DF_F0 0x1460
#define PCI_DEVICE_ID_AMD_17H_DF_F6 0x1466
+#define PCI_DEVICE_ID_HYGON_18H_DF_F0 0x1460
+#define PCI_DEVICE_ID_HYGON_18H_DF_F6 0x1466
+
/*
* Function 1 - Address Map
*/
@@ -281,6 +284,7 @@ enum amd_families {
F16_CPUS,
F16_M30H_CPUS,
F17_CPUS,
+ HYGON_F18_CPUS,
NUM_FAMILIES,
};
diff --git a/drivers/edac/mce_amd.c b/drivers/edac/mce_amd.c
index 2ab4d61..c605089 100644
--- a/drivers/edac/mce_amd.c
+++ b/drivers/edac/mce_amd.c
@@ -1059,7 +1059,8 @@ static int __init mce_amd_init(void)
{
struct cpuinfo_x86 *c = &boot_cpu_data;
- if (c->x86_vendor != X86_VENDOR_AMD)
+ if (c->x86_vendor != X86_VENDOR_AMD &&
+ c->x86_vendor != X86_VENDOR_HYGON)
return -ENODEV;
fam_ops = kzalloc(sizeof(struct amd_decoder_ops), GFP_KERNEL);
@@ -1113,6 +1114,7 @@ static int __init mce_amd_init(void)
break;
case 0x17:
+ case 0x18:
xec_mask = 0x3f;
if (!boot_cpu_has(X86_FEATURE_SMCA)) {
printk(KERN_WARNING "Decoding supported only on Scalable MCA processors.\n");
--
2.7.4
_______________________________________________
Xen-devel mailing list
Xen-devel@lists.xenproject.org
https://lists.xenproject.org/mailman/listinfo/xen-devel
^ permalink raw reply related
* [PATCH v2 15/17] driver/cpufreq: enable Hygon support to cpufreq driver
From: Pu Wen @ 2018-07-23 13:20 UTC (permalink / raw)
To: tglx, bp, thomas.lendacky, mingo, hpa, peterz, tony.luck,
pbonzini, rkrcmar, boris.ostrovsky, jgross, rjw, lenb,
viresh.kumar, mchehab, trenn, shuah, JBeulich, x86
Cc: linux-arch, xen-devel, linux-kernel, kvm
In-Reply-To: <1532352037-7151-1-git-send-email-puwen@hygon.cn>
Enable ACPI cpufreq driver support for Hygon by adding family ID check
along with AMD.
As Hygon platforms have SMBus device(PCI device ID 0x790b), enable Hygon
support to function amd_freq_sensitivity_init().
Signed-off-by: Pu Wen <puwen@hygon.cn>
---
drivers/cpufreq/acpi-cpufreq.c | 11 +++++++++++
drivers/cpufreq/amd_freq_sensitivity.c | 9 +++++++--
2 files changed, 18 insertions(+), 2 deletions(-)
diff --git a/drivers/cpufreq/acpi-cpufreq.c b/drivers/cpufreq/acpi-cpufreq.c
index b61f4ec..cd97a7e 100644
--- a/drivers/cpufreq/acpi-cpufreq.c
+++ b/drivers/cpufreq/acpi-cpufreq.c
@@ -61,6 +61,7 @@ enum {
#define INTEL_MSR_RANGE (0xffff)
#define AMD_MSR_RANGE (0x7)
+#define HYGON_MSR_RANGE (0x7)
#define MSR_K7_HWCR_CPB_DIS (1ULL << 25)
@@ -99,6 +100,10 @@ static bool boost_state(unsigned int cpu)
rdmsr_on_cpu(cpu, MSR_K7_HWCR, &lo, &hi);
msr = lo | ((u64)hi << 32);
return !(msr & MSR_K7_HWCR_CPB_DIS);
+ case X86_VENDOR_HYGON:
+ rdmsr_on_cpu(cpu, MSR_K7_HWCR, &lo, &hi);
+ msr = lo | ((u64)hi << 32);
+ return !(msr & MSR_K7_HWCR_CPB_DIS);
}
return false;
}
@@ -117,6 +122,10 @@ static int boost_set_msr(bool enable)
msr_addr = MSR_K7_HWCR;
msr_mask = MSR_K7_HWCR_CPB_DIS;
break;
+ case X86_VENDOR_HYGON:
+ msr_addr = MSR_K7_HWCR;
+ msr_mask = MSR_K7_HWCR_CPB_DIS;
+ break;
default:
return -EINVAL;
}
@@ -225,6 +234,8 @@ static unsigned extract_msr(struct cpufreq_policy *policy, u32 msr)
if (boot_cpu_data.x86_vendor == X86_VENDOR_AMD)
msr &= AMD_MSR_RANGE;
+ else if (boot_cpu_data.x86_vendor == X86_VENDOR_HYGON)
+ msr &= HYGON_MSR_RANGE;
else
msr &= INTEL_MSR_RANGE;
diff --git a/drivers/cpufreq/amd_freq_sensitivity.c b/drivers/cpufreq/amd_freq_sensitivity.c
index be926d9..4ac7c3c 100644
--- a/drivers/cpufreq/amd_freq_sensitivity.c
+++ b/drivers/cpufreq/amd_freq_sensitivity.c
@@ -111,11 +111,16 @@ static int __init amd_freq_sensitivity_init(void)
{
u64 val;
struct pci_dev *pcidev;
+ unsigned int pci_vendor;
- if (boot_cpu_data.x86_vendor != X86_VENDOR_AMD)
+ if (boot_cpu_data.x86_vendor == X86_VENDOR_AMD)
+ pci_vendor = PCI_VENDOR_ID_AMD;
+ else if (boot_cpu_data.x86_vendor == X86_VENDOR_HYGON)
+ pci_vendor = PCI_VENDOR_ID_HYGON;
+ else
return -ENODEV;
- pcidev = pci_get_device(PCI_VENDOR_ID_AMD,
+ pcidev = pci_get_device(pci_vendor,
PCI_DEVICE_ID_AMD_KERNCZ_SMBUS, NULL);
if (!pcidev) {
--
2.7.4
_______________________________________________
Xen-devel mailing list
Xen-devel@lists.xenproject.org
https://lists.xenproject.org/mailman/listinfo/xen-devel
^ permalink raw reply related
page: next (older) | prev (newer) | latest
- recent:[subjects (threaded)|topics (new)|topics (active)]
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.