Unverified Commit 1b9eceef authored by openeuler-ci-bot's avatar openeuler-ci-bot Committed by Gitee
Browse files

!5385 v3 enable arm64_pbha by default

Merge Pull Request from: @ci-robot 
 
PR sync from: Wupeng Ma <mawupeng1@huawei.com>
https://mailweb.openeuler.org/hyperkitty/list/kernel@openeuler.org/message/YFCX7GP54BOBMPOHCC2TY5SVT35F5GVM/ 
From: Ma Wupeng <mawupeng1@huawei.com>

Enhanced maintenance and test capability for pbha.
Enable ARM64_PBHA by default.

Changelog since v2:
- make PM_PBHA_BIT0 0 if CONFIG_ARM64_PBHA is not enabled

Changelog since v1:
- let {pte,pmd}_pbha return false if pbha is not enabled

Ma Wupeng (7):
  proc: introduce proc_hide_ents to hide proc files
  arm64: mm: Cleanup in pbha_bit0_pte_range
  mm: cpufeature: Make update_pbha_perf_only_bit static
  arm64: mm: Do not show info during startup if pbha is not enabled
  arm64: mm: Hide pbha_bit0 in procfs if pbha is not enabled
  arm64: mm: pagemap: Export pbha bit0 info
  config: Enable ARM64_PBHA by default


-- 
2.25.1
 
https://gitee.com/openeuler/kernel/issues/I96IZH 
 
Link:https://gitee.com/openeuler/kernel/pulls/5385

 

Reviewed-by: default avatarWeilong Chen <chenweilong@huawei.com>
Reviewed-by: default avatarZucheng Zheng <zhengzucheng@huawei.com>
Reviewed-by: default avatarKefeng Wang <wangkefeng.wang@huawei.com>
Reviewed-by: default avatarLiu Chao <liuchao173@huawei.com>
Reviewed-by: default avatarZhang Jianhua <chris.zjh@huawei.com>
Signed-off-by: default avatarJialin Zhang <zhangjialin11@huawei.com>
parents c349aaad a008e846
Loading
Loading
Loading
Loading
+3 −1
Original line number Diff line number Diff line
@@ -21,7 +21,9 @@ There are four components to pagemap:
    * Bit  55    pte is soft-dirty (see
      :ref:`Documentation/admin-guide/mm/soft-dirty.rst <soft_dirty>`)
    * Bit  56    page exclusively mapped (since 4.2)
    * Bits 57-60 zero
    * Bits 57-58 zero
    * Bit  59    PBHA bit0, used only CONFIG_ARM64_PBHA is enabled
    * Bits 60 zero
    * Bit  61    page is file-page or shared-anon (since 3.5)
    * Bit  62    page swapped
    * Bit  63    page present
+1 −1
Original line number Diff line number Diff line
@@ -497,7 +497,7 @@ CONFIG_ARM64_VHE=y
CONFIG_ARM64_PMEM=y
CONFIG_ARM64_RAS_EXTN=y
CONFIG_ARM64_CNP=y
# CONFIG_ARM64_PBHA is not set
CONFIG_ARM64_PBHA=y
# end of ARMv8.2 architectural features

#
+1 −1
Original line number Diff line number Diff line
@@ -1687,7 +1687,7 @@ static void stage2_test_pbha_value(u8 val)
		arm64_pbha_stage2_safe_bits |= val;
}

void update_pbha_perf_only_bit(const u8 *bits, int cnt)
static void update_pbha_perf_only_bit(const u8 *bits, int cnt)
{
	u8 val;
	int i;
+5 −6
Original line number Diff line number Diff line
@@ -99,7 +99,7 @@ static int pbha_bit0_pte_range(pmd_t *pmd, unsigned long addr,
{
	int *op = (int *)walk->private;
	struct vm_area_struct *vma = walk->vma;
	pte_t *pte, ptent;
	pte_t *pte;
	spinlock_t *ptl;
	bool set = (*op == SET_PBHA_BIT0_FLAG);

@@ -115,11 +115,8 @@ static int pbha_bit0_pte_range(pmd_t *pmd, unsigned long addr,
		return 0;

	pte = pte_offset_map_lock(vma->vm_mm, pmd, addr, &ptl);
	for (; addr != end; pte++, addr += PAGE_SIZE) {
		ptent = *pte;

	for (; addr != end; pte++, addr += PAGE_SIZE)
		pbha_bit0_update_pte_bits(vma, addr, pte, set);
	}
	pte_unmap_unlock(pte - 1, ptl);
	cond_resched();
	return 0;
@@ -200,7 +197,9 @@ static int __init setup_pbha(char *str)
		pbha_bit0_enabled = true;
	}

	pr_info("pbha bit_0 enabled, kernel: %d\n", pbha_bit0_kernel_enabled);
	if (pbha_bit0_enabled)
		pr_info("pbha bit_0 enabled, kernel: %d\n",
			pbha_bit0_kernel_enabled);

	return 0;
}
+23 −2
Original line number Diff line number Diff line
@@ -1450,6 +1450,16 @@ static const struct file_operations proc_pbha_bit0_ops = {
	.write      = pbha_bit0_write,
	.llseek     = generic_file_llseek,
};

bool pbha_bit0_hide_file(const char *name)
{
	if (!system_support_pbha_bit0() && !strncmp("pbha_bit0", name, 9))
		return true;

	return false;
}
#else
static bool pbha_bit0_hide_file(const char *name) { return false; }
#endif

#ifdef CONFIG_AUDIT
@@ -2847,6 +2857,14 @@ static struct dentry *proc_pident_instantiate(struct dentry *dentry,
	return d_splice_alias(inode, dentry);
}

static bool proc_hide_pidents(const struct pid_entry *p)
{
	if (pbha_bit0_hide_file(p->name))
		return true;

	return false;
}

static struct dentry *proc_pident_lookup(struct inode *dir, 
					 struct dentry *dentry,
					 const struct pid_entry *p,
@@ -2865,6 +2883,8 @@ static struct dentry *proc_pident_lookup(struct inode *dir,
	for (; p < end; p++) {
		if (p->len != dentry->d_name.len)
			continue;
		if (proc_hide_pidents(p))
			continue;
		if (!memcmp(dentry->d_name.name, p->name, p->len)) {
			res = proc_pident_instantiate(dentry, task, p);
			break;
@@ -2891,7 +2911,8 @@ static int proc_pident_readdir(struct file *file, struct dir_context *ctx,
		goto out;

	for (p = ents + (ctx->pos - 2); p < ents + nents; p++) {
		if (!proc_fill_cache(file, ctx, p->name, p->len,
		if (!proc_hide_pidents(p) &&
		    !proc_fill_cache(file, ctx, p->name, p->len,
				     proc_pident_instantiate, task, p))
			break;
		ctx->pos++;
Loading