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 22E52C433EF for ; Mon, 18 Apr 2022 17:11:07 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id 7870C6B008C; Mon, 18 Apr 2022 13:11:07 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id 736A06B0092; Mon, 18 Apr 2022 13:11:07 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 5D7248D001A; Mon, 18 Apr 2022 13:11:07 -0400 (EDT) X-Delivered-To: linux-mm@kvack.org Received: from forelay.hostedemail.com (smtprelay0204.hostedemail.com [216.40.44.204]) by kanga.kvack.org (Postfix) with ESMTP id 478296B008C for ; Mon, 18 Apr 2022 13:11:07 -0400 (EDT) Received: from smtpin26.hostedemail.com (10.5.19.251.rfc1918.com [10.5.19.251]) by forelay05.hostedemail.com (Postfix) with ESMTP id AFF55183182D8 for ; Mon, 18 Apr 2022 17:11:06 +0000 (UTC) X-FDA: 79370640132.26.F13762F Received: from mail-lj1-f175.google.com (mail-lj1-f175.google.com [209.85.208.175]) by imf11.hostedemail.com (Postfix) with ESMTP id 189E840013 for ; Mon, 18 Apr 2022 17:11:05 +0000 (UTC) Received: by mail-lj1-f175.google.com with SMTP id i14so1971812ljn.5 for ; Mon, 18 Apr 2022 10:11:05 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linux-foundation.org; s=google; h=mime-version:references:in-reply-to:from:date:message-id:subject:to :cc; bh=JnfBKZjgF0QAT2+ZNkrVkIt3p+ZK2qll9C8ReRWwK94=; b=N/kozEv3htHzVB9QEynfrlQU/Mv+YKRQ+Usc9cumiP5Mmpjh7RTikZqiiUaqpeWnlX cPoGWW1kY4AhKXsnK+qQTcNnOhTGfJIve2qIABJfHTK8YQyvK1KPMYZxO+iuDVgjUoj9 Idk6AkYvv0WfNah3F8jeBIGSzSMzsddOwZ3UA= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:mime-version:references:in-reply-to:from:date :message-id:subject:to:cc; bh=JnfBKZjgF0QAT2+ZNkrVkIt3p+ZK2qll9C8ReRWwK94=; b=5wYY65gUYfApmDO8NANdupUJ/V8ZS3JkWd5qLYmifGvdj3YPWnY6/9zqGcQYHsynjB vAatGWtvvWe/aJ4Omw2/9Px/MsrKh++JI/6QLtqjpRFXqMjs2WyGdm9HHDH/knBbQyGc /vtWTIYSKp3u6DALENDsqNF2xENIW98QAW+u3y1UDwVWppzwCzw17WlGntU0BV5PdJAf PN96B2jbAbsaqS94nTpblVCiMMLdnIcarI5tukgcYvpK1JF0JZX7Esr4LJ+ODeye4OFv 0ZSqSFrIR9935OLBP0NNUKPtmL1OxqjRSGQcTVv/fBL750vhBttQKVt8Epr+d5YW2GGO j5+Q== X-Gm-Message-State: AOAM5321h4RsgBtNxA0tzMv9WxuLXS4XJr1P3IqNDGnHFbmDg/W+wocI znMC3OjUOQCGhnuzlbtilEgw8vP4KqckrWvaK1M= X-Google-Smtp-Source: ABdhPJzQ63+TmFT9OVz1/lWBXYCrw8EywjfDSuVbDJLexQPbxAEZqsK4UI4mlCum6VZPSIeEsXOlpg== X-Received: by 2002:a05:651c:90a:b0:249:5d82:fe9c with SMTP id e10-20020a05651c090a00b002495d82fe9cmr7843263ljq.300.1650301863949; Mon, 18 Apr 2022 10:11:03 -0700 (PDT) Received: from mail-lf1-f48.google.com (mail-lf1-f48.google.com. [209.85.167.48]) by smtp.gmail.com with ESMTPSA id x22-20020a2e9c96000000b0024da6072587sm1119367lji.80.2022.04.18.10.10.59 for (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Mon, 18 Apr 2022 10:11:00 -0700 (PDT) Received: by mail-lf1-f48.google.com with SMTP id bq30so25141468lfb.3 for ; Mon, 18 Apr 2022 10:10:59 -0700 (PDT) X-Received: by 2002:a05:6512:2291:b0:46b:b72b:c947 with SMTP id f17-20020a056512229100b0046bb72bc947mr8563401lfu.531.1650301859252; Mon, 18 Apr 2022 10:10:59 -0700 (PDT) MIME-Version: 1.0 References: <20220414191240.9f86d15a3e3afd848a9839a6@linux-foundation.org> <20220415021328.7D31EC385A1@smtp.kernel.org> <29b9ef95-1226-73b4-b4d1-6e8d164fb17d@gmail.com> In-Reply-To: From: Linus Torvalds Date: Mon, 18 Apr 2022 10:10:42 -0700 X-Gmail-Original-Message-ID: Message-ID: Subject: Re: [patch 02/14] tmpfs: fix regressions from wider use of ZERO_PAGE To: Borislav Petkov Cc: Mark Hemment , Andrew Morton , "the arch/x86 maintainers" , Peter Zijlstra , patrice.chotard@foss.st.com, Mikulas Patocka , Lukas Czerner , Christoph Hellwig , "Darrick J. Wong" , Chuck Lever , Hugh Dickins , patches@lists.linux.dev, Linux-MM , mm-commits@vger.kernel.org Content-Type: text/plain; charset="UTF-8" Authentication-Results: imf11.hostedemail.com; dkim=pass header.d=linux-foundation.org header.s=google header.b="N/kozEv3"; spf=pass (imf11.hostedemail.com: domain of torvalds@linuxfoundation.org designates 209.85.208.175 as permitted sender) smtp.mailfrom=torvalds@linuxfoundation.org; dmarc=none X-Stat-Signature: nr9wfk8m1bdt6fan564gypsisatd4rzs X-Rspamd-Queue-Id: 189E840013 X-Rspamd-Server: rspam04 X-Rspam-User: X-HE-Tag: 1650301865-417750 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, Apr 18, 2022 at 3:15 AM Borislav Petkov wrote: > > Yah, wanted to singlestep that whole asm anyway to make sure it is good. > And just started going through it - I think it can be even optimized a > bit to use %rax for the rest bytes and decrement it into 0 eventually. Ugh. If you do this, you need to have a big comment about how that %rcx value gets fixed up with EX_TYPE_UCOPY_LEN (which basically ends up doing "%rcx = %rcx*8+%rax" in ex_handler_ucopy_len() for the exception case). Plus you need to explain the xorl here: > 3: > xorl %eax,%eax > RET because with your re-written function it *looks* like %eax is already zero, so - once again - this is about how the exception cases work and get here magically. So that needs some big comment about "if an exception happens, we jump to label '3', and the exception handler will fix up %rcx, but we'll need to clear %rax". Or something like that. But yes, that does look like it will work, it's just really subtle how %rcx is zero for the 'rest bytes', and %rax is the byte count remaining in addition. Linus