From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from mail-pl1-f176.google.com (mail-pl1-f176.google.com [209.85.214.176]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 98E041DC9BC for ; Fri, 24 Jan 2025 22:23:46 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.214.176 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1737757429; cv=none; b=mMr2q2GfqexBJBuByiEWm38z+LgXh8QOWzjBsHl1YnAwOfSCPwdsLas/B/M7vC4mCkg43bWa57cBaN14/+FFPjmcRAAvW/CQE0McZrfKDXrpkcwjn3h/mm6gHVaMa5FwK4P7tegzsdUkNMpBcpiRQ27q0IAmvdirJOMWPNNB7/E= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1737757429; c=relaxed/simple; bh=f5l5Gcfji1kBekt/GS3Rw8oXMmaDJe2PbxrZjSTQhRk=; h=Date:From:To:Cc:Subject:Message-ID:References:MIME-Version: Content-Type:Content-Disposition:In-Reply-To; b=P7QPqcrHDwTCQ2cQTD5AXG78TEBdZB2dUNG9TOJ7r/VHy/djx/pL2Vi+pytEfpw7FIn6RBWmAMkPu/ovZaiN9es46o9062F863Mol73Ovg1KYRh83plm1IjvfSUmTEpArjxCzev7iJ9XfI3vuwmHZuuVniYSg23BJ/iALwEnMCs= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=none (p=none dis=none) header.from=rivosinc.com; spf=pass smtp.mailfrom=rivosinc.com; dkim=pass (2048-bit key) header.d=rivosinc-com.20230601.gappssmtp.com header.i=@rivosinc-com.20230601.gappssmtp.com header.b=cHvsj5cQ; arc=none smtp.client-ip=209.85.214.176 Authentication-Results: smtp.subspace.kernel.org; dmarc=none (p=none dis=none) header.from=rivosinc.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=rivosinc.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=rivosinc-com.20230601.gappssmtp.com header.i=@rivosinc-com.20230601.gappssmtp.com header.b="cHvsj5cQ" Received: by mail-pl1-f176.google.com with SMTP id d9443c01a7336-2165cb60719so46838265ad.0 for ; Fri, 24 Jan 2025 14:23:46 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=rivosinc-com.20230601.gappssmtp.com; s=20230601; t=1737757426; x=1738362226; darn=vger.kernel.org; h=in-reply-to:content-transfer-encoding:content-disposition :mime-version:references:message-id:subject:cc:to:from:date:from:to :cc:subject:date:message-id:reply-to; bh=yUv+RaNlBSnMfG9KxmG6AfxJdG5ylIteL5qAdF6dzeg=; b=cHvsj5cQxR4/o5AMokaiIvmAYZhvwGOIn3D/NNMkhO5brWmMW878H6nVJN90mW0XcG lZYN5he/ANhWwn129BDMksrZ8Wwinn0oQyBe5zbNX1QeWIbCb30fLv6x/tWPF3ZYvLNh 0mBIxYmD6Td0eq8ndDOC1/2VWSTmneJlCmXrGAmdEhQ2MocT6y7+70dDgeXZyeiZzkPQ nKr9vReLprh5W6B63kVgmk6tiaEvOP40tw6gW23XXognqz6FdgcRWEiyJRGEaM1XqQjK wHUH9zHRrAU7Uc2eYu9PA/AWlqxZc5dyL+EAKibtPcNCDEfl+/1NN0kSkXbWrge4mwCB Lh1g== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1737757426; x=1738362226; h=in-reply-to:content-transfer-encoding:content-disposition :mime-version:references:message-id:subject:cc:to:from:date :x-gm-message-state:from:to:cc:subject:date:message-id:reply-to; bh=yUv+RaNlBSnMfG9KxmG6AfxJdG5ylIteL5qAdF6dzeg=; b=sIji0IRx0VLc6ie4J591EOAh4QWWDNnGra98yqwNgXtLjWFgr9/X4xWU7Q4fkZPA0D 790cbd6n10FsmD9yIeNXlce+1v80aQvb+xgXOyBv5922vJ2uXxvN1GuqHc8La3Digwqh uZnz6+3PgW79CEnm2OaVVRkMvr8DqRKo7cdf1pxF9af2+5H5fV7b6DttXBkL4KOKNq// UVwXo1mOb4KP539aCYF0X+35ZN60HVH6Lajin0eHcB0K9Vlgze/qCS/aIIZdqjQXCEmW 7vteg6mr7oVUqOHD8kC8rN6JApMWMsp+le2kHurROXpNt7sVzfUXoLqhp/blKaBxMpko fQng== X-Forwarded-Encrypted: i=1; AJvYcCVQR996hOsiAEgq3VPygPtNQwMSb8zcJxPZEyEnePWq2OxWWzTyK8CgGkRkejk0BrZVW9hmJt3kwL+Zb3o=@vger.kernel.org X-Gm-Message-State: AOJu0Ywm6C2lWIIsm8hS0PvUbExemJBUe9BmpxJdDbOqx+ug79HE86s8 +juZws129qN6vwo5+isJ7A12tad3R+BQVkHNiuBbF7SbiF1h8pVfUlRF0Gwaiv8= X-Gm-Gg: ASbGnct9wxAgOfb87kZuPfmYRT+7VHum6lydLJ2HmmJi2AwDA5SH6x5QuWfTBDwSZzb n/txX9aQYMEq9WSuCa0sUKVk8kOq/M1UXTQBIO78H+dmi9Tf1ep0qHissJ171E8qpkuKx3+aG2R /VQC9A1Isjhfx0/CFuTz0Nw1QrQ9tq3d0TLs9SyFV+TE+tZrcN4XVOl70ToGImHmEasTNGNDIj3 3hA47uieYvu4jh41iWSRoUEdcBWIkGWeLjQtkjCBEpmCwjZvqzAdAC/1P/ovSH5BaLPpn4= X-Google-Smtp-Source: AGHT+IGSiDeyaor3Xyykrpa+3fW1EiHgGhOjTWTXaUtdnDW0jN1fxxyzeFLtuFtvlggZGKCMyzKnSQ== X-Received: by 2002:a05:6a00:92a0:b0:729:9f1:69bc with SMTP id d2e1a72fcca58-72dafa410aemr45756556b3a.12.1737757425781; Fri, 24 Jan 2025 14:23:45 -0800 (PST) Received: from ghost ([50.145.13.30]) by smtp.gmail.com with ESMTPSA id d2e1a72fcca58-72f8a77c560sm2492231b3a.142.2025.01.24.14.23.44 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 24 Jan 2025 14:23:45 -0800 (PST) Date: Fri, 24 Jan 2025 14:23:42 -0800 From: Charlie Jenkins To: Huacai Chen Cc: Paul Walmsley , Palmer Dabbelt , WANG Xuerui , Thomas Gleixner , Peter Zijlstra , Andy Lutomirski , Alexandre Ghiti , linux-riscv@lists.infradead.org, linux-kernel@vger.kernel.org, loongarch@lists.linux.dev Subject: Re: [PATCH v2 3/4] loongarch: entry: Migrate ret_from_fork() to C Message-ID: References: <20250123-riscv_optimize_entry-v2-0-7c259492d508@rivosinc.com> <20250123-riscv_optimize_entry-v2-3-7c259492d508@rivosinc.com> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Disposition: inline Content-Transfer-Encoding: 8bit In-Reply-To: On Fri, Jan 24, 2025 at 10:28:50AM -0800, Charlie Jenkins wrote: > On Fri, Jan 24, 2025 at 05:05:21PM +0800, Huacai Chen wrote: > > Hi, Charlie, > > > > On Fri, Jan 24, 2025 at 3:15 AM Charlie Jenkins wrote: > > > > > > Loongarch is the only architecture that calls > > We usually use "LoongArch" instead of "loongarch" or "Loongarch". > > > > > syscall_exit_to_user_mode() from asm. Move the call into C so that this > > > function can be inlined across all architectures. > > > > > > Signed-off-by: Charlie Jenkins > > > --- > > > arch/loongarch/include/asm/asm-prototypes.h | 5 +++++ > > > arch/loongarch/include/asm/switch_to.h | 8 +++++++ > > > arch/loongarch/kernel/entry.S | 22 +++++++++---------- > > > arch/loongarch/kernel/process.c | 34 ++++++++++++++++++++++++----- > > > 4 files changed, 51 insertions(+), 18 deletions(-) > > > > > > diff --git a/arch/loongarch/include/asm/asm-prototypes.h b/arch/loongarch/include/asm/asm-prototypes.h > > > index 51f224bcfc654228ae423e9a066b25b35102a5b9..0195d4309fd29f94664d5f34247198c769033b1b 100644 > > > --- a/arch/loongarch/include/asm/asm-prototypes.h > > > +++ b/arch/loongarch/include/asm/asm-prototypes.h > > > @@ -12,3 +12,8 @@ __int128_t __ashlti3(__int128_t a, int b); > > > __int128_t __ashrti3(__int128_t a, int b); > > > __int128_t __lshrti3(__int128_t a, int b); > > > #endif > > > + > > > +asmlinkage void noinstr __no_stack_protector ret_from_kernel_thread(struct task_struct *prev, > > > + struct pt_regs *regs, > > > + int (*fn)(void *), > > > + void *fn_arg); > > It is a little strange that we only need to declare > > ret_from_kernel_thread() but not ret_from_fork(). > > Just an oversight by me, thank you for pointing that out. Oh I see what I did, I meant to put these functions in asm-prototypes and not in switch_to but I ended up putting them in both. - Charlie