Received: by 2002:a05:6358:9144:b0:117:f937:c515 with SMTP id r4csp8450604rwr; Thu, 11 May 2023 01:08:58 -0700 (PDT) X-Google-Smtp-Source: ACHHUZ5KEaB+FulMHOGNfU8CXGDLLZNqLr45iqzokdz3zqSBeNbc5n2mFgsxPBigmtNoVBskfA/m X-Received: by 2002:a05:6a21:6da4:b0:100:8258:169e with SMTP id wl36-20020a056a216da400b001008258169emr17806422pzb.24.1683792538032; Thu, 11 May 2023 01:08:58 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1683792538; cv=none; d=google.com; s=arc-20160816; b=rirSlQ5Qj3ru2A8ShMThg8SGWwAiuK+7AO8Qkwh75fbpJboxOmPdFjiViAEzTdwq+I yX8RNz79lhnnXyBkyUjB54WORx6AjMP/nInXsXMZdC4xqbujX1GqvlLYLUt/VffJSjC4 pfZ8V1LJ2N97E31xljdP3ena+kVU5MEx/4vWYQSes061HxuhtNz6bCf4YZG0U+0RJDb8 tyvwuyYNpnwq3Q+LbYEq1EiFJ2sWy8W2pwbRvzH88PufAGJHR3qLrEMFrR3C1+/GTw1/ PYotmPnvqBUjItfs320SZr8QovtUOUbCi04zaYtuD3An43nIyLDteanhAnH98hf2gWym oERQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:in-reply-to:content-disposition:mime-version :references:message-id:subject:cc:to:from:date:dkim-signature; bh=wBXjskPx8hEOJnHSctqAejGh2IMM+muzSI0KeP2yQrM=; b=t92AC3xEWd0mNR/WYKsVM7wkawWpCU8RyOJO5T4F2lNkuCIBGkxl3O7YFnpW+iL87A cHakEkmZrg2ZuoPTVLRZLq4t4NzWqdY2V5St5w/YToyt7bjKnxDfhgs3LB6L7LFqp0lq 14UXW8TPeesKOnvVgb9QAE1X1/xHfWUu0V7LSIKeab9VlkGpr6VlBZZmIPpIFQ6Gwf5o twg9mOYAnwoI9lQiYZpkr+u8+OxFSZUmc34610P988TvATmLR5D+wEe50x2v4YCJwAvg fQOfXqrXv+KR2JbZlcW2+BF+Ky2WBcflLaf5/2igeK2dwvyI56HJB3e+BbaI7Ak6Va6O 04aQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@infradead.org header.s=casper.20170209 header.b="d8uE/iRF"; 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 Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id j5-20020a637a45000000b005133c334fe0si6169869pgn.192.2023.05.11.01.08.44; Thu, 11 May 2023 01:08:58 -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=@infradead.org header.s=casper.20170209 header.b="d8uE/iRF"; 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 Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S237581AbjEKHoa (ORCPT + 99 others); Thu, 11 May 2023 03:44:30 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:49646 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S237012AbjEKHo2 (ORCPT ); Thu, 11 May 2023 03:44:28 -0400 Received: from casper.infradead.org (casper.infradead.org [IPv6:2001:8b0:10b:1236::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 73C171738; Thu, 11 May 2023 00:44:27 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=infradead.org; s=casper.20170209; h=In-Reply-To:Content-Type:MIME-Version: References:Message-ID:Subject:Cc:To:From:Date:Sender:Reply-To: Content-Transfer-Encoding:Content-ID:Content-Description; bh=wBXjskPx8hEOJnHSctqAejGh2IMM+muzSI0KeP2yQrM=; b=d8uE/iRFbR5cJozqHolXlIngkK s0M5XV/l16K3V6IVU0ohjHELX2UkMEi4nK7mL1Ogg2+ijJHpEYlfSi5+X/QGbcZwITYSpHbz3Z/0B coPuHx5STz6DGPjbz0cXjF/Q9mNKYpvCppPC+ynR3diGsU6p3WjZ++v4MPebwAQtpFzDRUjBsyoZd Kr2V9hl24aO3AnzsXw37Jl1GuYkaE8bKlEbI+9LpD2U6Hn5GPGqzqFy9KAULyPmR9rd5oq4q5Qe4d uDZ8N/J/C9KVURxhLeAGwexNjjIcwHahp1HUcODg3tgg5CsPX0RVZ4rpiKZHcQya9XT7sVUIsVpqr /266kvVA==; Received: from j130084.upc-j.chello.nl ([24.132.130.84] helo=noisy.programming.kicks-ass.net) by casper.infradead.org with esmtpsa (Exim 4.94.2 #2 (Red Hat Linux)) id 1px0y1-00Gzr6-DC; Thu, 11 May 2023 07:44:02 +0000 Received: from hirez.programming.kicks-ass.net (hirez.programming.kicks-ass.net [192.168.1.225]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits)) (Client did not present a certificate) by noisy.programming.kicks-ass.net (Postfix) with ESMTPS id 78562300786; Thu, 11 May 2023 09:43:59 +0200 (CEST) Received: by hirez.programming.kicks-ass.net (Postfix, from userid 1000) id 55A0C235CC445; Thu, 11 May 2023 09:43:59 +0200 (CEST) Date: Thu, 11 May 2023 09:43:59 +0200 From: Peter Zijlstra To: Youling Tang Cc: WANG Xuerui , Huacai Chen , Jonathan Corbet , Josh Poimboeuf , Jason Baron , Zhangjin Wu , linux-doc@vger.kernel.org, linux-kernel@vger.kernel.org, loongarch@lists.linux.dev Subject: Re: [PATCH v2] LoongArch: Add jump-label implementation Message-ID: <20230511074359.GQ4253@hirez.programming.kicks-ass.net> References: <1683710206-23905-1-git-send-email-tangyouling@loongson.cn> <3b360532-6ad5-b22c-b02a-103be491be4c@xen0n.name> <72b6c81a-d4ee-575a-ff48-6be7e034ac96@loongson.cn> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <72b6c81a-d4ee-575a-ff48-6be7e034ac96@loongson.cn> X-Spam-Status: No, score=-4.4 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_MED,SPF_HELO_NONE, SPF_NONE,T_SCC_BODY_TEXT_LINE 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 Thu, May 11, 2023 at 09:33:37AM +0800, Youling Tang wrote: > > > +void arch_jump_label_transform(struct jump_entry *entry, > > > + enum jump_label_type type) > > > +{ > > > + void *addr = (void *)jump_entry_code(entry); > > > + u32 insn; > > > + > > > + if (type == JUMP_LABEL_JMP) > > > > Please use a switch for dealing with enum-typed values. > > Because the current type only has JUMP_LABEL_NOP and JUMP_LABEL_JMP, > using if may be simpler than switch. IIRC we used an enum with descriptive names instead of a boolean because true/false just doesn't tell you much. The whole thing fundamentally is a boolean descision though, either you write a JMP or a NOP, jump-labels don't have more options.