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 mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 56186C433F5 for ; Tue, 26 Oct 2021 23:22:09 +0000 (UTC) Received: from kanga.kvack.org (kanga.kvack.org [205.233.56.17]) by mail.kernel.org (Postfix) with ESMTP id AED986008E for ; Tue, 26 Oct 2021 23:22:08 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.4.1 mail.kernel.org AED986008E Authentication-Results: mail.kernel.org; dmarc=none (p=none dis=none) header.from=posk.io Authentication-Results: mail.kernel.org; spf=pass smtp.mailfrom=kvack.org Received: by kanga.kvack.org (Postfix) id 2657B6B0071; Tue, 26 Oct 2021 19:22:08 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id 1EDD76B0072; Tue, 26 Oct 2021 19:22:08 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 08EBF940007; Tue, 26 Oct 2021 19:22:08 -0400 (EDT) X-Delivered-To: linux-mm@kvack.org Received: from forelay.hostedemail.com (smtprelay0221.hostedemail.com [216.40.44.221]) by kanga.kvack.org (Postfix) with ESMTP id E9B3F6B0071 for ; Tue, 26 Oct 2021 19:22:07 -0400 (EDT) Received: from smtpin05.hostedemail.com (10.5.19.251.rfc1918.com [10.5.19.251]) by forelay05.hostedemail.com (Postfix) with ESMTP id 9C7B318446BCC for ; Tue, 26 Oct 2021 23:22:07 +0000 (UTC) X-FDA: 78740163894.05.E13F818 Received: from mail-ua1-f52.google.com (mail-ua1-f52.google.com [209.85.222.52]) by imf25.hostedemail.com (Postfix) with ESMTP id 0C512B000195 for ; Tue, 26 Oct 2021 23:22:00 +0000 (UTC) Received: by mail-ua1-f52.google.com with SMTP id f24so1402629uav.12 for ; Tue, 26 Oct 2021 16:22:07 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=posk.io; s=google; h=mime-version:references:in-reply-to:from:date:message-id:subject:to :cc; bh=J18QttHAkFDS7yxz+1rjMOa4CC6r6s8T6z90wWDtKnM=; b=UUgvFrR+HKKFK8Xbmv5tdHLBTz2c3Jxe83/yQSjGWL6ZMTBERVPLz7HGzOIDZXMIiL oU8t/tK18coPzNBChNmQzno0N8loKXyMzVuRFnKRhwgM9QFIyGXbDmlDLaeTeh8J4nGL 8WDCBTmwIV66qqkK86dTyaPoQ3AVkvOzdsjsHvtMZUSWtDm0S13xq+amg2QnNYZm5iOE PRa4JObjkF5GrYCEDpzhtOZ0CRS2e9Lb73wscC2FvigHJvezGsaypJTHUOf0tmFb1P1K AW2uVYzq302wtU2mpagTftZpxA3IbcUul8PUgDWiNDkymaNMll/Dc7acJm7mdb9JYP0b V+Vw== 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=J18QttHAkFDS7yxz+1rjMOa4CC6r6s8T6z90wWDtKnM=; b=yzUx5XbtuG04Mm+SRS7MdETxcNrMtOil3C+c35OlfpodxUiXv9YcVBXJk2DphzGHm7 P14XxPlIIlZZhy7WBL5QY5WqDylL/2Q+pWoEtKUlLCoezVD8dL3Av6Xq4GF440rY1wum 5Xpg0Cd4JXhR9XcRHwyswWejsafPRn5wqHx8XcocR3GXmkCnCv5OliRU01CblWFPovxR wcE775nPzbQQ0BkBWyceMlQENLDfZyADE1O8Rpn9n+Pe3EP2m0xel25sjkdDSAfnIsx2 DcDCoumdaaRrfYomiR4KS9mVcwGX7V9LOSTJivhc3eHjzvdkYMWrVR81KxGbOOKyKYIM hpEQ== X-Gm-Message-State: AOAM533icEtk9zVAskzGDV+ucIs12XzyKYZma6CO6Q6DoJ7XiZok8WGR R/HOgfC9mFWMUdGeee9BkCIcfENFUh1T3EHUbSwmNQ== X-Google-Smtp-Source: ABdhPJx4lFsGHDL8KFwKlcXqK7O+w6Mif7FDdqlZ4s4k6X+hEkLS2rBkYwW9nhpkzDj/TM6EYqIvqhMo6ezpRoK8x5g= X-Received: by 2002:a05:6102:11f0:: with SMTP id e16mr17418235vsg.21.1635290526524; Tue, 26 Oct 2021 16:22:06 -0700 (PDT) MIME-Version: 1.0 References: <20211012232522.714898-1-posk@google.com> <20211012232522.714898-3-posk@google.com> In-Reply-To: <20211012232522.714898-3-posk@google.com> From: Peter Oskolkov Date: Tue, 26 Oct 2021 16:21:55 -0700 Message-ID: Subject: Re: [PATCH v0.7 2/5] mm, x86/uaccess: add userspace atomic helpers To: Peter Zijlstra , Ingo Molnar , Thomas Gleixner , Andrew Morton , Dave Hansen , Andy Lutomirski , linux-mm@kvack.org, Linux Kernel Mailing List , linux-api@vger.kernel.org Cc: Paul Turner , Ben Segall , Peter Oskolkov , Andrei Vagin , Jann Horn , Thierry Delisle Content-Type: text/plain; charset="UTF-8" X-Stat-Signature: 331qtjofczeednt3d3iscw53m9aeaw71 Authentication-Results: imf25.hostedemail.com; dkim=pass header.d=posk.io header.s=google header.b=UUgvFrR+; spf=pass (imf25.hostedemail.com: domain of posk@posk.io designates 209.85.222.52 as permitted sender) smtp.mailfrom=posk@posk.io; dmarc=none X-Rspamd-Server: rspam04 X-Rspamd-Queue-Id: 0C512B000195 X-HE-Tag: 1635290520-799060 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 Tue, Oct 12, 2021 at 4:25 PM Peter Oskolkov wrote: [...] > +static inline int __try_xchg_user_32(u32 *oval, u32 __user *uaddr, u32 newval) > +{ > + u32 oldval = 0; > + int ret = 0; > + > + asm volatile("\n" > + "1:\txchgl %0, %2\n" > + "2:\n" > + "\t.section .fixup, \"ax\"\n" > + "3:\tmov %3, %0\n" I believe the line above should be "mov %3, %1", not "mov %3, %0". I'll fix this in the next patchset mailing. > + "\tjmp 2b\n" > + "\t.previous\n" > + _ASM_EXTABLE_UA(1b, 3b) > + : "=r" (oldval), "=r" (ret), "+m" (*uaddr) > + : "i" (-EFAULT), "0" (newval), "1" (0) > + ); > + > + if (ret) > + return ret; > + > + *oval = oldval; > + return 0; > +} > + > +static inline int __try_xchg_user_64(u64 *oval, u64 __user *uaddr, u64 newval) > +{> +> + > + u64 oldval = 0; > + int ret = 0; > + > + asm volatile("\n" > + "1:\txchgq %0, %2\n" > + "2:\n" > + "\t.section .fixup, \"ax\"\n" > + "3:\tmov %3, %0\n" Same here. [...]