From mboxrd@z Thu Jan 1 00:00:00 1970 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 D7072ECAAD4 for ; Mon, 29 Aug 2022 06:11:50 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id 538F3940008; Mon, 29 Aug 2022 02:11:50 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id 4E8B0940007; Mon, 29 Aug 2022 02:11:50 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 3B445940008; Mon, 29 Aug 2022 02:11:50 -0400 (EDT) X-Delivered-To: linux-mm@kvack.org Received: from relay.hostedemail.com (smtprelay0014.hostedemail.com [216.40.44.14]) by kanga.kvack.org (Postfix) with ESMTP id 29BF3940007 for ; Mon, 29 Aug 2022 02:11:50 -0400 (EDT) Received: from smtpin13.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay06.hostedemail.com (Postfix) with ESMTP id EBE5FAB3A2 for ; Mon, 29 Aug 2022 06:11:49 +0000 (UTC) X-FDA: 79851609138.13.1E9AC38 Received: from mail-yw1-f179.google.com (mail-yw1-f179.google.com [209.85.128.179]) by imf03.hostedemail.com (Postfix) with ESMTP id 7D4452001A for ; Mon, 29 Aug 2022 06:11:49 +0000 (UTC) Received: by mail-yw1-f179.google.com with SMTP id 00721157ae682-3413ad0640dso15509137b3.13 for ; Sun, 28 Aug 2022 23:11:49 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=konsulko.com; s=google; h=cc:to:subject:message-id:date:from:in-reply-to:references :mime-version:from:to:cc; bh=h7nxaPp4EymNSPdz9fsqgzvba1sW8RJbQspRIcUC7AE=; b=B39MLZF9M4pPGy8EjTEtJ8naAv+y7mGWMbS68Yl3Qmr9XD0wlAyPSCZ5WAbOBWPZ8T 6G2Nz2eScFEUGq/5sIyNjY/BkWns0v9TZ9Bt1j+ktPLW2cpz/yxX3FiFqpNmLjFl7Xxq v0qxMPrC3hipiGNZeEyJr0JlotlNv4cIvoJoU= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=cc:to:subject:message-id:date:from:in-reply-to:references :mime-version:x-gm-message-state:from:to:cc; bh=h7nxaPp4EymNSPdz9fsqgzvba1sW8RJbQspRIcUC7AE=; b=IL0XK2Chn4RZDdcD/cGDOHjob27M760JGVSIA9Jhz8beu2GghUZ36TvdHJanxrphRj B7WHyNQHczWzXRqGJHJLkAf+GWZoMWy6jiuDWyPPQ6BaFhob43B0mQvieuQY92WKRkKv XcDeVxDu+tWTnihZ0qVHSYjSdprj0vY9qDwgvRgVYxNcWsnBrhRVIqbKe/EJOMBtGknc GbknflSqu6xEYgIgdrgncRGn/V5sb608+Na6ECEpD3nsqSHB9UtcLlsOT1MfGiZDxWg9 c32sPBxVGT3EJ7HpPj8fEOKohfX0/DqlHHVrmhxmLuvQSGT5natq989ZamW00fbOef8f wdLw== X-Gm-Message-State: ACgBeo2+0KRjREe+JcGfreFgufScIgwM9+QAFwy3GP98ho2bkukP/v/8 xCxPjvJlkoGfVH7NXDNS9n5Ti/dCH2iW2mpLpdMNpg== X-Google-Smtp-Source: AA6agR6Z/9vlwL8/8A/y8URYljcs+o2eUxUQSGGcBINQGpgic/px3m3qyfXAUIPkLNz81T3h+IvRS0jKrkNNr8d9Ijs= X-Received: by 2002:a0d:cb55:0:b0:340:b1ef:6dae with SMTP id n82-20020a0dcb55000000b00340b1ef6daemr7247395ywd.287.1661753508761; Sun, 28 Aug 2022 23:11:48 -0700 (PDT) MIME-Version: 1.0 References: <20220827104600.1813214-1-liushixin2@huawei.com> <20220827104600.1813214-2-liushixin2@huawei.com> <06a79a47-727f-fae2-4620-dcf6703efacb@huawei.com> In-Reply-To: <06a79a47-727f-fae2-4620-dcf6703efacb@huawei.com> From: Vitaly Wool Date: Mon, 29 Aug 2022 08:11:37 +0200 Message-ID: Subject: Re: [PATCH -next v3 1/5] frontswap: skip frontswap_ops init if zswap init failed. To: Liu Shixin Cc: Seth Jennings , Dan Streetman , Andrew Morton , Nathan Chancellor , Christoph Hellwig , linux-mm@kvack.org, linux-kernel@vger.kernel.org, Kefeng Wang Content-Type: text/plain; charset="UTF-8" ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=hostedemail.com; s=arc-20220608; t=1661753509; 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=h7nxaPp4EymNSPdz9fsqgzvba1sW8RJbQspRIcUC7AE=; b=UkA/Ae3DfB9CXAIFGwjqyYonV/x4BGGmp93jBS4p5kOYXqSsiCdxVLm+gMYaDiMT00jfxG AbFLn1vE+EDoaYJ+NdKeldE92427ycYvCffze4oZLkXrcinYiv5qOCKmQjLI0vsilfWBV1 v9xqSjk55c2cJK4PGmPiZciO/UfoOcY= ARC-Authentication-Results: i=1; imf03.hostedemail.com; dkim=pass header.d=konsulko.com header.s=google header.b=B39MLZF9; dmarc=pass (policy=none) header.from=konsulko.com; spf=pass (imf03.hostedemail.com: domain of vitaly.wool@konsulko.com designates 209.85.128.179 as permitted sender) smtp.mailfrom=vitaly.wool@konsulko.com ARC-Seal: i=1; s=arc-20220608; d=hostedemail.com; t=1661753509; a=rsa-sha256; cv=none; b=qMg/bxGjgJ91Xw+4ohdCeMdl3EUhKXyqIcvgFkPlLrM5Fj2TgvRwaABuV5nf/xZ921s2SA eGliiNpAoIcW+MspcWb1FUx9LqAUPXJ76LgD4tI2IX4bEzMBtLb8qPqYZTlW3l24wya8pY RbP8yM7H92rkz8pLyf94v67ymDu8reU= X-Stat-Signature: a56szxd3wppzsppkbqow9untr5dnkycy X-Rspamd-Queue-Id: 7D4452001A Authentication-Results: imf03.hostedemail.com; dkim=pass header.d=konsulko.com header.s=google header.b=B39MLZF9; dmarc=pass (policy=none) header.from=konsulko.com; spf=pass (imf03.hostedemail.com: domain of vitaly.wool@konsulko.com designates 209.85.128.179 as permitted sender) smtp.mailfrom=vitaly.wool@konsulko.com X-Rspamd-Server: rspam03 X-Rspam-User: X-HE-Tag: 1661753509-731734 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: On Mon, Aug 29, 2022 at 4:11 AM Liu Shixin wrote: > > On 2022/8/29 4:44, Vitaly Wool wrote: > > On Sat, Aug 27, 2022 at 12:12 PM Liu Shixin wrote: > >> If zswap initial failed or has not been initial, frontswap_ops will be > >> NULL. In such situation, swap device would enable failed with following > >> stack trace: > >> > >> Unable to handle kernel access to user memory outside uaccess routines at virtual address 0000000000000000 > >> Mem abort info: > >> ESR = 0x0000000096000004 > >> EC = 0x25: DABT (current EL), IL = 32 bits > >> SET = 0, FnV = 0 > >> EA = 0, S1PTW = 0 > >> FSC = 0x04: level 0 translation fault > >> Data abort info: > >> ISV = 0, ISS = 0x00000004 > >> CM = 0, WnR = 0 > >> user pgtable: 4k pages, 48-bit VAs, pgdp=00000020a4fab000 > >> [0000000000000000] pgd=0000000000000000, p4d=0000000000000000 > >> Internal error: Oops: 96000004 [#1] SMP > >> Modules linked in: zram fsl_dpaa2_eth pcs_lynx phylink ahci_qoriq crct10dif_ce ghash_ce sbsa_gwdt fsl_mc_dpio nvme lm90 nvme_core at803x xhci_plat_hcd rtc_fsl_ftm_alarm xgmac_mdio ahci_platform i2c_imx ip6_tables ip_tables fuse > >> Unloaded tainted modules: cppc_cpufreq():1 > >> CPU: 10 PID: 761 Comm: swapon Not tainted 6.0.0-rc2-00454-g22100432cf14 #1 > >> Hardware name: SolidRun Ltd. SolidRun CEX7 Platform, BIOS EDK II Jun 21 2022 > >> pstate: 00400005 (nzcv daif +PAN -UAO -TCO -DIT -SSBS BTYPE=--) > >> pc : frontswap_init+0x38/0x60 > >> lr : __do_sys_swapon+0x8a8/0x9f4 > >> sp : ffff80000969bcf0 > >> x29: ffff80000969bcf0 x28: ffff37bee0d8fc00 x27: ffff80000a7f5000 > >> x26: fffffcdefb971e80 x25: ffffaba797453b90 x24: 0000000000000064 > >> x23: ffff37c1f209d1a8 x22: ffff37bee880e000 x21: ffffaba797748560 > >> x20: ffff37bee0d8fce4 x19: ffffaba797748488 x18: 0000000000000014 > >> x17: 0000000030ec029a x16: ffffaba795a479b0 x15: 0000000000000000 > >> x14: 0000000000000000 x13: 0000000000000030 x12: 0000000000000001 > >> x11: ffff37c63c0aba18 x10: 0000000000000000 x9 : ffffaba7956b8c88 > >> x8 : ffff80000969bcd0 x7 : 0000000000000000 x6 : 0000000000000000 > >> x5 : 0000000000000001 x4 : 0000000000000000 x3 : ffffaba79730f000 > >> x2 : ffff37bee0d8fc00 x1 : 0000000000000000 x0 : 0000000000000000 > >> Call trace: > >> frontswap_init+0x38/0x60 > >> __do_sys_swapon+0x8a8/0x9f4 > >> __arm64_sys_swapon+0x28/0x3c > >> invoke_syscall+0x78/0x100 > >> el0_svc_common.constprop.0+0xd4/0xf4 > >> do_el0_svc+0x38/0x4c > >> el0_svc+0x34/0x10c > >> el0t_64_sync_handler+0x11c/0x150 > >> el0t_64_sync+0x190/0x194 > >> Code: d000e283 910003fd f9006c41 f946d461 (f9400021) > >> ---[ end trace 0000000000000000 ]--- > >> > > Well, this issue you are seeing is in fact introduced by the following patch: > > > > author Christoph Hellwig 2022-01-21 22:15:10 -0800 > > frontswap: remove support for multiple ops > > > > So I would rather see that one reverted and fixed. > > > > Thanks, > > Vitaly > It is surely introduced by the previous patch ,but is it need to revert that patch? Do we have > any plans to add new backend in the future? I believe we do. Besides, this patch introduces the bug you have hit, before this patch frontswap just wouldn't go doing anything on an empty list. It's my bad I didn't NAK that patch then, but we have an opportunity to do it the right way now. Thanks, Vitaly > Thanks, > > > >> Reported-by: Nathan Chancellor > >> Signed-off-by: Liu Shixin > >> --- > >> mm/frontswap.c | 3 ++- > >> 1 file changed, 2 insertions(+), 1 deletion(-) > >> > >> diff --git a/mm/frontswap.c b/mm/frontswap.c > >> index 1a97610308cb..620f95af81dd 100644 > >> --- a/mm/frontswap.c > >> +++ b/mm/frontswap.c > >> @@ -125,7 +125,8 @@ void frontswap_init(unsigned type, unsigned long *map) > >> * p->frontswap set to something valid to work properly. > >> */ > >> frontswap_map_set(sis, map); > >> - frontswap_ops->init(type); > >> + if (frontswap_ops) > >> + frontswap_ops->init(type); > >> } > >> > >> static bool __frontswap_test(struct swap_info_struct *sis, > >> -- > >> 2.25.1 > >> > > . > > >