From patchwork Tue Jun 11 21:55:43 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Jiaqi Yan X-Patchwork-Id: 13694215 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from kanga.kvack.org (kanga.kvack.org [205.233.56.17]) by smtp.lore.kernel.org (Postfix) with ESMTP id 8C690C27C65 for ; Tue, 11 Jun 2024 21:55:55 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id A9D9A6B00ED; Tue, 11 Jun 2024 17:55:54 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id A4B7D6B00EE; Tue, 11 Jun 2024 17:55:54 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 8ECBB6B00EF; Tue, 11 Jun 2024 17:55:54 -0400 (EDT) X-Delivered-To: linux-mm@kvack.org Received: from relay.hostedemail.com (smtprelay0017.hostedemail.com [216.40.44.17]) by kanga.kvack.org (Postfix) with ESMTP id 6FD806B00ED for ; Tue, 11 Jun 2024 17:55:54 -0400 (EDT) Received: from smtpin28.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay02.hostedemail.com (Postfix) with ESMTP id 1C0B412078E for ; Tue, 11 Jun 2024 21:55:54 +0000 (UTC) X-FDA: 82219965828.28.547ED11 Received: from mail-yb1-f201.google.com (mail-yb1-f201.google.com [209.85.219.201]) by imf02.hostedemail.com (Postfix) with ESMTP id 516338000C for ; Tue, 11 Jun 2024 21:55:52 +0000 (UTC) Authentication-Results: imf02.hostedemail.com; dkim=pass header.d=google.com header.s=20230601 header.b=gDchoHc0; spf=pass (imf02.hostedemail.com: domain of 358doZggKCFQ54wC4Kw92AA270.yA8749GJ-886Hwy6.AD2@flex--jiaqiyan.bounces.google.com designates 209.85.219.201 as permitted sender) smtp.mailfrom=358doZggKCFQ54wC4Kw92AA270.yA8749GJ-886Hwy6.AD2@flex--jiaqiyan.bounces.google.com; dmarc=pass (policy=reject) header.from=google.com ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=hostedemail.com; s=arc-20220608; t=1718142952; h=from:from:sender:reply-to:subject:subject:date:date: message-id:message-id:to:to:cc:cc:mime-version:mime-version: content-type:content-type:content-transfer-encoding: in-reply-to:in-reply-to:references:references:dkim-signature; bh=gyQTVglq7Cwm4lMbb1naXFnTTx4rj2liHiRoRZq6pME=; b=8ls+us7drHsxUF6v2WgyBJDLv78ZMFwxriShQZN7kz/JyyAAbMo80GK5nLBycLAwgeUpJj WZWcCoch/fbE+r6u02bKGrVijeQprcurdL8CE9UUQWyZukVONqoUA1LUkCzG7qUAGxrD8R yI67cO7GdRGUFkFzDexi09b/DPIQeqQ= ARC-Seal: i=1; s=arc-20220608; d=hostedemail.com; t=1718142952; a=rsa-sha256; cv=none; b=VJOrvx0RpDDmIN7/62h0u2sLh5tugnPCR6GZZmuzzYPoSYqwsFPWaNCZ7G/XhxI/HRsKB1 L/UKktSHa924/oKQs+T1gSGiRYhmohhdeLCIJYdTyPFL/AxOICr1FpLgyZzW7rbLrfgA3g hCwjkoU0++uQ0pidhi2hh8v/7Yy+nIs= ARC-Authentication-Results: i=1; imf02.hostedemail.com; dkim=pass header.d=google.com header.s=20230601 header.b=gDchoHc0; spf=pass (imf02.hostedemail.com: domain of 358doZggKCFQ54wC4Kw92AA270.yA8749GJ-886Hwy6.AD2@flex--jiaqiyan.bounces.google.com designates 209.85.219.201 as permitted sender) smtp.mailfrom=358doZggKCFQ54wC4Kw92AA270.yA8749GJ-886Hwy6.AD2@flex--jiaqiyan.bounces.google.com; dmarc=pass (policy=reject) header.from=google.com Received: by mail-yb1-f201.google.com with SMTP id 3f1490d57ef6-dfe25446483so381580276.0 for ; Tue, 11 Jun 2024 14:55:52 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20230601; t=1718142951; x=1718747751; darn=kvack.org; h=cc:to:from:subject:message-id:references:mime-version:in-reply-to :date:from:to:cc:subject:date:message-id:reply-to; bh=gyQTVglq7Cwm4lMbb1naXFnTTx4rj2liHiRoRZq6pME=; b=gDchoHc0CuK1D9wN1MihB2CfQe4r8MQsrGJYaC2iJb4Q3dNreDP5IZ6tWh/Zauk/Tu eRDj4u3Yt4csG3jyGSOHbKSYfEVIZz4Nc04UlYPgU6zt4p+kVyHv1OM2YQGFqccvMS2L 4ZorXX7d57aDUB5Hp6rUId9Gu249Itpz6KOWdUJM2+KTCWO+0e2R7RiSswVqyUqmvrMY BcHNKyLb2L/5VSkCDUG64BbiOT5KLHduC+TzhndseqzhdvOja7vl7+4bJHSCSj4AhWWh op5PvwJA18L+cJGR1CUmc8LPSqyF/A4wLv3YQ7BQfMdmwVskl3RPW9fOPgP4129ngoYa DQ8A== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1718142951; x=1718747751; h=cc:to:from:subject:message-id:references:mime-version:in-reply-to :date:x-gm-message-state:from:to:cc:subject:date:message-id:reply-to; bh=gyQTVglq7Cwm4lMbb1naXFnTTx4rj2liHiRoRZq6pME=; b=Qp/yLmQ6PkksnBIRtchKdSSXK833JiWUoBybj9+A5iRrWfWyn+7fSswAM77j1B9lxR ED4FkljlnrVD5awqD0c0NfcQawBGRUZphDVw5g8eFTOxtmfOoU3NXAOMlByQmftnkyUH Np5pPdXJM+H/4umMMHxyOLFLTKx/zCCCxDq5jHRnIswhcPdXMOapmwH30CcuC63sk0AN 3aSYP1W0ZlehyNp7n1kJgYkP1U0HQfkRg3TzmDAyRg2pqb1EYlG1g0kCDfBx3+mq7huG ZdC546HQ610nkCDj5mD7Z/42S3hjHJyew0RZtlBHPxOZxs8Nt6DoIm9Kluzou8BzuCnp U59A== X-Forwarded-Encrypted: i=1; AJvYcCUjiBXh1Js8r6D9FvXhjXfoz3IDtGVn7FMR+OAVXb7MZz/AZc5nri4uFOx+BrsQec8jfuZSdnbfXnI/GGlSbqr82jw= X-Gm-Message-State: AOJu0Yw4EmjOCvlly/2Ska6B7whwNHGYroQuAUQ248UPr2eduSUBTTSv YYJGojPOnVAwftH/uFvreqy5rWioH/j9hlpPRHfQlqu9G+mAdmFClBoG0TuJLazl4VgLG+M0Yfk Wxhxd1hg+1Q== X-Google-Smtp-Source: AGHT+IEHVqmqrs5fNX0G2Rm+19MY544u/GPqOHKCJXOP123n1O4Le3p4ZuHF3jDVgujwWTc0zwNSeaeRWk5Crg== X-Received: from yjq3.c.googlers.com ([fda3:e722:ac3:cc00:24:72f4:c0a8:272f]) (user=jiaqiyan job=sendgmr) by 2002:a05:6902:1248:b0:df4:a393:8769 with SMTP id 3f1490d57ef6-dfaf65ba959mr1328238276.9.1718142951291; Tue, 11 Jun 2024 14:55:51 -0700 (PDT) Date: Tue, 11 Jun 2024 21:55:43 +0000 In-Reply-To: <20240611215544.2105970-1-jiaqiyan@google.com> Mime-Version: 1.0 References: <20240611215544.2105970-1-jiaqiyan@google.com> X-Mailer: git-send-email 2.45.2.505.gda0bf45e8d-goog Message-ID: <20240611215544.2105970-3-jiaqiyan@google.com> Subject: [PATCH v2 2/3] selftest/mm: test enable_soft_offline behaviors From: Jiaqi Yan To: nao.horiguchi@gmail.com, linmiaohe@huawei.com, jane.chu@oracle.com Cc: muchun.song@linux.dev, akpm@linux-foundation.org, shuah@kernel.org, corbet@lwn.net, osalvador@suse.de, rientjes@google.com, duenwen@google.com, fvdl@google.com, linux-mm@kvack.org, linux-kselftest@vger.kernel.org, linux-doc@vger.kernel.org, Jiaqi Yan X-Stat-Signature: oeygqyjcnc4ibzfhacu1uecncbm8g7ni X-Rspamd-Queue-Id: 516338000C X-Rspam-User: X-Rspamd-Server: rspam05 X-HE-Tag: 1718142952-76231 X-HE-Meta: U2FsdGVkX1+Matd8mvM0VunTzrknszFGvu+LxbRL94dLHDU1bSB1CXK2oq+ueYAxV4WUqWUnc85Y3fOMaO4fVGTXZ3sJqYe+zz9d9xVKRYbb9rCE/6l2MV4489nn3/7QCpSbos1apf5HQOnFCGKf8yOpmf7AOig6TdfFPCJYE0z5DGwvtiyVqzPdabn4rXe3U8H+xbiZLT/v2KWGtRLC/fNwl7hguWGhradPM9GhegVdhq4nQdogDXke4SBofZSAsb3Hs91kRhmISWRAxbLgNooKDMorD2b5QG1xuHQ2ZgpIjHZRlWSt9p/c/c6ELIhUMsuVGCCSj7b/S1TpwtvV6HEt/i8xrLZkWig9l02xpbkidOXwsIcneefjeDQARPhvnpDjeYoxUdEZwqfUPmXMPvt90LolmJ8C02P9DKJPN9aC7u/AleG9S2xapZxICAv06uUlEft9Xp531y2mpobI4V2f5DQDBu336mS5ZIU/+B5F/m7YZfUQPefnj95mSa1VQKR6IeBUt+9T+maNng8P6O5tim6F/0i6aY2m4vBwC40LN2QEzaKD3r5NglbtbHhLOvxgVjBj/jGhnB81fa/VGQEZxQVRAiRJOhVGXt9uXsk3KRpuAze+lRaXgugWKLGymrXcZ+RIkF8DicnWtFLXHuGGOtbjAfA1yycfXt9OeSl+fSZLSbPc8BGHg+duz8hnA8GpSXFn0YPndI6kKCa2Hag3o7Aq3BOE8uqIVdrgXN4fGMzi3892OGoiKvtX1bjOO1QgOSaW83VqTsBLPzN6HGj0KxZotBo+4fFcB5PszKjlqSCfA5gnpO6Zy92hCy1AthHpYxr05C80etMgOx/rlv4+9ASDkN7Mh2/Wz7jaOR14AKWTtJtMNtKtNhNrAbVmbo+h9FPeZS7Gs77v6ZXDmLahtUPTDflwvsIrMg47jexMI7E5gm9OISy1GvQm1Fd6YuscTsMR4Mr9CbKtGCJ 3vo7EqIL loamhRw/TP8zdJ40DyMz2rX3F2w/xUKGFTQS4f2deD/ZWAdeoqz5UGxcvXpscNxAgmjy2+PorKOSq2iy1jBMyJfHjLhTP0CiutBgiuqTL6qaB2VU9Y4++rWj4KIFwJYsoB4veqHo21dbZq7kdYB1197eMz/eyMDCsEye4sPXGLj99IPzo14cLfZt+HSa42TqJQkHjFd1wIPxUXmsO3wVDakNOJOaGNjmWiZf/4fCOKUJC2dc4jnuRDPq/s6LZW6S2dLbU4+tGEzGdCq0Lcn8vxfBxHPsZOjg/gBcAfBzlqbgPfOck3Hrsz4gkAVn7tJH0Fg4/QrMjyR8LG2/ZeepFNXiNabzFDdH+xnNm6avvqr2b1Gr5f3cTgu7i+Xikks0LS8XZ4d8uCYEbuJLlRPMCBiuapkaZoi9rAa+2+qv+H6UKc6OKbsWTU9dhISfi4xNvnQC6eJYOh2sr8yqG7LJPUMCI1ltcafxb8Uko7XYIl99gcrftgLYGfh0U/fIByMi6LQAV8QlZ+ufNc9z/LI3b2DngxRNNOgT5Cz9RN4pqhStT5PSEes+95Nf5lP2EwOYDuvVSmhSC5OIr5Tp2pYZc5XIPlVyf7iYAM9Qiu2hatT6nuQqxA9jhE/ocGAApBDVB6AFB9DlufHvJKFLOkTAjobapHA== X-Bogosity: Ham, tests=bogofilter, spamicity=0.000000, version=1.2.4 Sender: owner-linux-mm@kvack.org Precedence: bulk X-Loop: owner-majordomo@kvack.org List-ID: List-Subscribe: List-Unsubscribe: Add regression and new tests when hugepage has correctable memory errors, and how userspace wants to deal with it: * if enable_soft_offline=0, mapped hugepage is soft offlined * if enable_soft_offline=1, mapped hugepage is intact Free hugepages case is not explicitly covered by the tests. Hugepage having corrected memory errors is emulated with MADV_SOFT_OFFLINE. Signed-off-by: Jiaqi Yan --- tools/testing/selftests/mm/.gitignore | 1 + tools/testing/selftests/mm/Makefile | 1 + .../selftests/mm/hugetlb-soft-offline.c | 258 ++++++++++++++++++ tools/testing/selftests/mm/run_vmtests.sh | 4 + 4 files changed, 264 insertions(+) create mode 100644 tools/testing/selftests/mm/hugetlb-soft-offline.c diff --git a/tools/testing/selftests/mm/.gitignore b/tools/testing/selftests/mm/.gitignore index 0b9ab987601c..064e7b125643 100644 --- a/tools/testing/selftests/mm/.gitignore +++ b/tools/testing/selftests/mm/.gitignore @@ -6,6 +6,7 @@ hugepage-shm hugepage-vmemmap hugetlb-madvise hugetlb-read-hwpoison +hugetlb-soft-offline khugepaged map_hugetlb map_populate diff --git a/tools/testing/selftests/mm/Makefile b/tools/testing/selftests/mm/Makefile index 3b49bc3d0a3b..d166067d75ef 100644 --- a/tools/testing/selftests/mm/Makefile +++ b/tools/testing/selftests/mm/Makefile @@ -42,6 +42,7 @@ TEST_GEN_FILES += gup_test TEST_GEN_FILES += hmm-tests TEST_GEN_FILES += hugetlb-madvise TEST_GEN_FILES += hugetlb-read-hwpoison +TEST_GEN_FILES += hugetlb-soft-offline TEST_GEN_FILES += hugepage-mmap TEST_GEN_FILES += hugepage-mremap TEST_GEN_FILES += hugepage-shm diff --git a/tools/testing/selftests/mm/hugetlb-soft-offline.c b/tools/testing/selftests/mm/hugetlb-soft-offline.c new file mode 100644 index 000000000000..d37d68a433e7 --- /dev/null +++ b/tools/testing/selftests/mm/hugetlb-soft-offline.c @@ -0,0 +1,258 @@ +// SPDX-License-Identifier: GPL-2.0 +/* + * Test soft offline behavior for HugeTLB pages: + * - if enable_soft_offline = 0, hugepages should stay intact and soft + * offlining failed with EINVAL. + * - if enable_soft_offline = 1, a hugepage should be dissolved and + * nr_hugepages/free_hugepages should be reduced by 1. + * + * Before running, make sure more than 2 hugepages of default_hugepagesz + * are allocated. For example, if /proc/meminfo/Hugepagesize is 2048kB: + * echo 8 > /sys/kernel/mm/hugepages/hugepages-2048kB/nr_hugepages + */ + +#define _GNU_SOURCE +#include +#include +#include +#include +#include + +#include +#include +#include +#include +#include + +#ifndef MADV_SOFT_OFFLINE +#define MADV_SOFT_OFFLINE 101 +#endif + +#define PREFIX " ... " +#define EPREFIX " !!! " + +enum test_status { + TEST_PASS = 0, + TEST_FAILED = 1, + // From ${ksft_skip} in run_vmtests.sh. + TEST_SKIPPED = 4, +}; + +static enum test_status do_soft_offline(int fd, size_t len, int expect_ret) +{ + char *filemap = NULL; + char *hwp_addr = NULL; + const unsigned long pagesize = getpagesize(); + int ret = 0; + enum test_status status = TEST_SKIPPED; + + if (ftruncate(fd, len) < 0) { + perror(EPREFIX "ftruncate to len failed"); + return status; + } + + filemap = mmap(NULL, len, PROT_READ | PROT_WRITE, + MAP_SHARED | MAP_POPULATE, fd, 0); + if (filemap == MAP_FAILED) { + perror(EPREFIX "mmap failed"); + goto untruncate; + } + + memset(filemap, 0xab, len); + printf(PREFIX "Allocated %#lx bytes of hugetlb pages\n", len); + + hwp_addr = filemap + len / 2; + ret = madvise(hwp_addr, pagesize, MADV_SOFT_OFFLINE); + printf(PREFIX "MADV_SOFT_OFFLINE %p ret=%d, errno=%d\n", + hwp_addr, ret, errno); + if (ret != 0) + perror(EPREFIX "madvise failed"); + + if (errno == expect_ret) + status = TEST_PASS; + else { + printf(EPREFIX "MADV_SOFT_OFFLINE should ret %d\n", expect_ret); + status = TEST_FAILED; + } + + munmap(filemap, len); +untruncate: + if (ftruncate(fd, 0) < 0) + perror(EPREFIX "ftruncate back to 0 failed"); + + return status; +} + +static int set_enable_soft_offline(int value) +{ + char cmd[256] = {0}; + FILE *cmdfile = NULL; + + if (value != 0 && value != 1) + return -EINVAL; + + sprintf(cmd, "echo %d > /proc/sys/vm/enable_soft_offline", value); + cmdfile = popen(cmd, "r"); + + if (cmdfile == NULL) + perror(EPREFIX "failed to set enable_soft_offline"); + else + printf(PREFIX "enable_soft_offline => %d\n", value); + + pclose(cmdfile); + return 0; +} + +static int read_nr_hugepages(unsigned long hugepage_size, + unsigned long *nr_hugepages) +{ + char buffer[256] = {0}; + char cmd[256] = {0}; + + sprintf(cmd, "cat /sys/kernel/mm/hugepages/hugepages-%ldkB/nr_hugepages", + hugepage_size); + FILE *cmdfile = popen(cmd, "r"); + + if (!fgets(buffer, sizeof(buffer), cmdfile)) { + perror(EPREFIX "failed to read nr_hugepages"); + pclose(cmdfile); + return -1; + } + + *nr_hugepages = atoll(buffer); + pclose(cmdfile); + return 0; +} + +static int create_hugetlbfs_file(struct statfs *file_stat) +{ + int fd; + + fd = memfd_create("hugetlb_tmp", MFD_HUGETLB); + if (fd < 0) { + perror(EPREFIX "could not open hugetlbfs file"); + return -1; + } + + memset(file_stat, 0, sizeof(*file_stat)); + if (fstatfs(fd, file_stat)) { + perror(EPREFIX "fstatfs failed"); + goto close; + } + if (file_stat->f_type != HUGETLBFS_MAGIC) { + printf(EPREFIX "not hugetlbfs file\n"); + goto close; + } + + return fd; +close: + close(fd); + return -1; +} + +static enum test_status test_soft_offline(void) +{ + int fd; + struct statfs file_stat; + unsigned long hugepagesize_kb = 0; + unsigned long nr_hugepages_before = 0; + unsigned long nr_hugepages_after = 0; + enum test_status status = TEST_SKIPPED; + + printf("Test Soft Offline When softoffline_corrected_errors=1\n"); + + fd = create_hugetlbfs_file(&file_stat); + if (fd < 0) { + printf(EPREFIX "Failed to create hugetlbfs file\n"); + return status; + } + + hugepagesize_kb = file_stat.f_bsize / 1024; + printf(PREFIX "Hugepagesize is %ldkB\n", hugepagesize_kb); + + if (set_enable_soft_offline(1)) + return TEST_FAILED; + + if (read_nr_hugepages(hugepagesize_kb, &nr_hugepages_before) != 0) + return TEST_FAILED; + + printf(PREFIX "Before MADV_SOFT_OFFLINE nr_hugepages=%ld\n", + nr_hugepages_before); + + status = do_soft_offline(fd, 2 * file_stat.f_bsize, /*expect_ret=*/0); + + if (read_nr_hugepages(hugepagesize_kb, &nr_hugepages_after) != 0) + return TEST_FAILED; + + printf(PREFIX "After MADV_SOFT_OFFLINE nr_hugepages=%ld\n", + nr_hugepages_after); + + if (nr_hugepages_before != nr_hugepages_after + 1) { + printf(EPREFIX "MADV_SOFT_OFFLINE should reduced 1 hugepage\n"); + return TEST_FAILED; + } + + return status; +} + +static enum test_status test_disable_soft_offline(void) +{ + int fd; + struct statfs file_stat; + unsigned long hugepagesize_kb = 0; + unsigned long nr_hugepages_before = 0; + unsigned long nr_hugepages_after = 0; + enum test_status status = TEST_SKIPPED; + + printf("Test Soft Offline When softoffline_corrected_errors=0\n"); + + fd = create_hugetlbfs_file(&file_stat); + if (fd < 0) { + printf(EPREFIX "Failed to create hugetlbfs file\n"); + return status; + } + + hugepagesize_kb = file_stat.f_bsize / 1024; + printf(PREFIX "Hugepagesize is %ldkB\n", hugepagesize_kb); + + if (set_enable_soft_offline(0)) + return TEST_FAILED; + + if (read_nr_hugepages(hugepagesize_kb, &nr_hugepages_before) != 0) + return TEST_FAILED; + + printf(PREFIX "Before MADV_SOFT_OFFLINE nr_hugepages=%ld\n", + nr_hugepages_before); + + status = do_soft_offline(fd, 2 * file_stat.f_bsize, /*expect_ret=*/EINVAL); + + if (read_nr_hugepages(hugepagesize_kb, &nr_hugepages_after) != 0) + return TEST_FAILED; + + printf(PREFIX "After MADV_SOFT_OFFLINE nr_hugepages=%ld\n", + nr_hugepages_after); + + if (nr_hugepages_before != nr_hugepages_after) { + printf(EPREFIX "MADV_SOFT_OFFLINE reduced %lu hugepages\n", + nr_hugepages_before - nr_hugepages_after); + return TEST_FAILED; + } + + return status; +} + +int main(void) +{ + enum test_status status; + + status = test_soft_offline(); + if (status != TEST_PASS) + return status; + + status = test_disable_soft_offline(); + if (status != TEST_PASS) + return status; + + printf("Test Soft Offline All Good!\n"); + return TEST_PASS; +} diff --git a/tools/testing/selftests/mm/run_vmtests.sh b/tools/testing/selftests/mm/run_vmtests.sh index 3157204b9047..781117fac1ba 100755 --- a/tools/testing/selftests/mm/run_vmtests.sh +++ b/tools/testing/selftests/mm/run_vmtests.sh @@ -331,6 +331,10 @@ CATEGORY="hugetlb" run_test ./thuge-gen CATEGORY="hugetlb" run_test ./charge_reserved_hugetlb.sh -cgroup-v2 CATEGORY="hugetlb" run_test ./hugetlb_reparenting_test.sh -cgroup-v2 if $RUN_DESTRUCTIVE; then +nr_hugepages_tmp=$(cat /proc/sys/vm/nr_hugepages) +echo 8 > /proc/sys/vm/nr_hugepages +CATEGORY="hugetlb" run_test ./hugetlb-soft-offline +echo "$nr_hugepages_tmp" > /proc/sys/vm/nr_hugepages CATEGORY="hugetlb" run_test ./hugetlb-read-hwpoison fi