Received: by 2002:a05:6358:1087:b0:cb:c9d3:cd90 with SMTP id j7csp5742320rwi; Tue, 18 Oct 2022 03:37:08 -0700 (PDT) X-Google-Smtp-Source: AMsMyM66jVKUt9d83+ZBB/YJwKi7C0FBm1Y9TLdNQKCraQ7xl6PDPU4pfql7kPrfjUvz+4e3LHJd X-Received: by 2002:a50:ff13:0:b0:43e:76d3:63e1 with SMTP id a19-20020a50ff13000000b0043e76d363e1mr1948180edu.271.1666089428088; Tue, 18 Oct 2022 03:37:08 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1666089428; cv=none; d=google.com; s=arc-20160816; b=dCsh+vMydnAl2/7SuB+o/8XKY8oJYutqXS4q2K57OMijlV2uo96WGneYMt/Q6Ow6Ur oiwFZheh8+NB5/jVz/kWwzOeeEhC5JfuHAuNYxH5by1oMRGmybk0Qi+fU9BR6jwSE4EJ S7jvJtef8wYQ76PvZyiSFiALID8kIOP57J5gh0FAqGJiiHaWJUzGGd1STLcYlTqRF3XL 3Tllr6M94DRXHxlL8iQk2G5y2ytdCx3VuUR5RHZqGHYlqzmYmsJJH2OqBlHeUm8VZfQH UUlWoH7kP1/A84sowMsCkTC8IyIg1ax0oIGXigdOqquNCUPDG2Al2EvE5uslRQ5BLNhf Hu3Q== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:cc:to:subject:message-id:date:from:in-reply-to :references:mime-version:dkim-signature; bh=4c61JaknudCElY9nyXfjanGAMcZQ1qzxCNqJScpUads=; b=kA9bQDQ9fOeWNGoDAciN0emI4z8RfD/firmRyU4wLPBMllOARDN6vH/dyknSpAgqNu Afz1sH1Z16Q4N6h85D9ZR5s1+XSkm3BVRTbuG5Bh+I9j7BRWVIwQ9zIy972QdVH6cL4/ NHU7pe1PZpOQSOmUUlAZSAOZfRgsN0xDMWhhwtjW9ndR2kXKA6cBaHsQacbyf6XTjNkH PgWzgjnywbnHmbWHgrHHHuKZuFou5cmWtKxVPr7q/7c5TGZkAdTyjnGNVyAwH5Vc0bRA QmIU3iA90PPw/FmexcWqAVPTtn7Sqhm7Mc+qP4XemyQc1R9zBdFx+F73lpJge/IVgArm OKHQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=tngriZcH; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id cb25-20020a170906a45900b0078e1d213812si9013693ejb.184.2022.10.18.03.36.41; Tue, 18 Oct 2022 03:37:08 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=tngriZcH; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S229648AbiJRJhH (ORCPT + 99 others); Tue, 18 Oct 2022 05:37:07 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:35676 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229950AbiJRJhD (ORCPT ); Tue, 18 Oct 2022 05:37:03 -0400 Received: from ams.source.kernel.org (ams.source.kernel.org [145.40.68.75]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id EAF3A4B9AB for ; Tue, 18 Oct 2022 02:37:02 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ams.source.kernel.org (Postfix) with ESMTPS id 984ABB81E07 for ; Tue, 18 Oct 2022 09:37:01 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 61B0EC433B5 for ; Tue, 18 Oct 2022 09:37:00 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1666085820; bh=0xSwj7DpRo1DNNUjXNdGquoqk2dkhuGaKfTJl/tLKY0=; h=References:In-Reply-To:From:Date:Subject:To:Cc:From; b=tngriZcHLqfhFlJP3nAWgOo49jqGCeWF3zzPJXM2b9B/MzwM2rZjdUeoanxSHeS+W H1edRO76AD0S2zgxwbeMFQm0JrM4q66FvAjg6m6hsTRe/BW0pwL7wiGvOVQSmzcyWI xmnyPqTGeBUgsbFj/YbmZTSMse4fAikPcK91jgaQczHuPQoVkUSVHgVktsLjLLehGi Yz2ETZ94xqWHG3WjIrd/8hRx5n8s/YKxSeukqFNUF2T17PwBSp6+aAACSsVCoiee95 lDn2TstEiiTUuvJMbb0cL49kjTl8WeITwBugAGmwBSQzjKWm0CXd9q5/BSNfrzRqLf 9Sm6D6LNOH3nw== Received: by mail-ed1-f47.google.com with SMTP id m16so19629106edc.4 for ; Tue, 18 Oct 2022 02:37:00 -0700 (PDT) X-Gm-Message-State: ACrzQf0ByBcCAKR0FSvTlrx5dGke9liP+AuLGocEmbgOPrFWPBRwYSE1 TKUvfR8QADMEoTZrUDKxyT+0Vk5RmTjccKKoLl0= X-Received: by 2002:a05:6402:550e:b0:456:f79f:2bed with SMTP id fi14-20020a056402550e00b00456f79f2bedmr1810384edb.106.1666085818499; Tue, 18 Oct 2022 02:36:58 -0700 (PDT) MIME-Version: 1.0 References: <20221017022330.2383060-1-chenhuacai@loongson.cn> In-Reply-To: From: Huacai Chen Date: Tue, 18 Oct 2022 17:36:45 +0800 X-Gmail-Original-Message-ID: Message-ID: Subject: Re: [PATCH V2] LoongArch: Add unaligned access support To: David Laight Cc: WANG Xuerui , Huacai Chen , "loongarch@lists.linux.dev" , Xuefeng Li , Tiezhu Yang , Guo Ren , Jiaxun Yang , "linux-kernel@vger.kernel.org" Content-Type: text/plain; charset="UTF-8" X-Spam-Status: No, score=-7.4 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_HI, SPF_HELO_NONE,SPF_PASS autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Tue, Oct 18, 2022 at 3:48 PM David Laight wrote: > > From: Huacai Chen > > Sent: 18 October 2022 08:33 > ... > > > What about my more structured approach in another reply that avoids the > > > huge else-if conditions? Both the terrible line wraps and codegen could > > > be avoided. > ... > > OK, let me try. > > I suspect you can mask out some 'operand size' bits from the > instructions - instead of checking each opcode. > > I'm also pretty sure you can't assume the FP register are live. > If a read from userspace faults then there can be a full > process switch - so by the time you try to write to the > FP registers they no longer belong to the current process. > > It might be safer and simpler to just enforce the FP > registers be saved and then act on the save area. > I'd guess they get restored in the 'return to userspace' > code. Good catch, will be fixed in V4. Huacai > > David > > - > Registered Address Lakeside, Bramley Road, Mount Farm, Milton Keynes, MK1 1PT, UK > Registration No: 1397386 (Wales)