Received: by 2002:a05:6a10:9848:0:0:0:0 with SMTP id x8csp4224221pxf; Tue, 6 Apr 2021 10:48:13 -0700 (PDT) X-Google-Smtp-Source: ABdhPJyV3yZEzYfatP3OBk9ZVZo+Oe+XNvXKCajfRSWhi0nweTd44sSqrJTkTn6ATzNrWSc3bkKQ X-Received: by 2002:a05:6402:2744:: with SMTP id z4mr39678612edd.347.1617731293093; Tue, 06 Apr 2021 10:48:13 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1617731293; cv=none; d=google.com; s=arc-20160816; b=a/cdA/OemFPLrwtGr5PzKf7meRO0NrW9mTfBpaOJkb9GgkajgWWUpK+PVmMYhOKM/N ib1A4yV1IJ9Qx24k96DgQMCqImGJucEQxbyVXUEfkyT8S3FsQhG5LqfBUagQPhadQe3T f17+lUoGQeSpsUP4IgePMAWA7QNQBIl4sCcMoofg2l3WjJpd5dLJbQUIgqF4R2kkvM7p qD4ITA8mr4Il7cGiLfTAq+zTsfbYdQM/6LGK/lf4l07glK/LL2d4g5cxy46e/RPfa6qG XmR70J77uDdnNydksP5VmxU2r7g1CPzl6+9M6PzwXXXfYiKDPTXV/JxD/tuRjR6gU1hV Ce0A== 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=3s3OaRvgpy/TZIHwX6L6iy09Z97u8+dAODkZWJWz5kI=; b=tFAW45GK7IO2R99b9SejFajJu8PptlNcQowp7NaE+KSe7FVnysdF+gdk5dRduODBJ0 R9Zz+ier8BMBcvHG2IVr9NorRhV+xJqOKkjdUVHe8hucal9ylL3kF+cQOfyxv21l9+g/ zIeTRxNhOI2eOH8DI/K7frbl5AZpsqQ1ld1QeLw5ZLV/A7MHzJB+PKacYypFEckY4rU3 XdgdtEnTCt0Etw9drZo4I2D5THGoRwOCs9vvOmtCfFU5KeqO2pM/7inHSUxG0WZYkrwg ZwwHW4e1MqyDGHFfFh4X8As7VM7mzBYPeHoiBMKZnbklK5JK4pR9ZjIO88m2gG0GdrqY 1a7Q== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@gmail.com header.s=20161025 header.b=drOm0AhB; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id n23si16091418ejs.705.2021.04.06.10.47.49; Tue, 06 Apr 2021 10:48:13 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; dkim=pass header.i=@gmail.com header.s=20161025 header.b=drOm0AhB; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S244602AbhDFIvV (ORCPT + 99 others); Tue, 6 Apr 2021 04:51:21 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:53480 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S232593AbhDFIvV (ORCPT ); Tue, 6 Apr 2021 04:51:21 -0400 Received: from mail-pf1-x433.google.com (mail-pf1-x433.google.com [IPv6:2607:f8b0:4864:20::433]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id E83A3C06174A; Tue, 6 Apr 2021 01:51:13 -0700 (PDT) Received: by mail-pf1-x433.google.com with SMTP id c204so6175920pfc.4; Tue, 06 Apr 2021 01:51:13 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=date:from:to:cc:subject:message-id:references:mime-version :content-disposition:in-reply-to; bh=3s3OaRvgpy/TZIHwX6L6iy09Z97u8+dAODkZWJWz5kI=; b=drOm0AhBZgUdpIqEdIBofvJMXa1uF5tw8a7cBmW1ztc+qdtPP9uPQeSvZ8Jzu3k50f kANNA7ftms9q+521RHPDkK1GMgurSEHEBmirCZYsBQ38gTh+KNbDBKz4NJZIpSWm6Tcl yOW6/RymAKvlT2UNXJDV/HDi53FweuR6y+fKKezBaDMRtsd6KUQ/W+Af41wME5kNpmbc wbxiFJPEy939djZlx2R6YLI0qADTjIyjrd6ekd5HDVYkkBtuqefZIrEthOQ0pVNrSE1i pMAs6nbOipZ8vDoeX0cWQZRXM5bgVKRo5sZTgtMgimOOOytP0Q9VROUvUfK3Us1lRb4r 0EKA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:date:from:to:cc:subject:message-id:references :mime-version:content-disposition:in-reply-to; bh=3s3OaRvgpy/TZIHwX6L6iy09Z97u8+dAODkZWJWz5kI=; b=cnHZDaNQNm/2sUjgcUm4baTEKyl8NZ6KCUI7kSTucnHOrow2uqP9EnSrro14/mJEoU MmrVzKdsHAgmSs+G1qqoiqDny+MugwkFCUyTseLpQuiliTGjpBU6GYxGa1r3j/87VmGr bL0b92V/+xzDoZ+Xkw7BaJ2UpMtRqfF4mIU1JBk5qgDrouKI1fgyarMJJapuaFkFj45c 5vAMW2A+vH1bqqQb+7immFmmhnbRThk+pmFPgP0uEP52K/DnvlfqiKRkQj4kFXNrNsrM ybTRIWJRJOb6824P/pt7siv8ODR/nkmlUOIF4jFKHAUpTKQELqvyopyBxPNkFblRga/g Zv/w== X-Gm-Message-State: AOAM531YmJOKqE4c9ECPVJAw+7Lz9cUAaXtAq8TpivUxPCFvlnFdyokz zycaDQr2VW8pQHKmqn3u4ho= X-Received: by 2002:a63:f950:: with SMTP id q16mr2968746pgk.138.1617699073451; Tue, 06 Apr 2021 01:51:13 -0700 (PDT) Received: from localhost (g139.124-45-193.ppp.wakwak.ne.jp. [124.45.193.139]) by smtp.gmail.com with ESMTPSA id l10sm17133549pfc.125.2021.04.06.01.51.12 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 06 Apr 2021 01:51:12 -0700 (PDT) Date: Tue, 6 Apr 2021 17:51:10 +0900 From: Stafford Horne To: Guo Ren Cc: Arnd Bergmann , Peter Zijlstra , linux-riscv , Linux Kernel Mailing List , linux-csky@vger.kernel.org, linux-arch , Guo Ren , Will Deacon , Ingo Molnar , Waiman Long , Anup Patel Subject: Re: [PATCH v4 3/4] locking/qspinlock: Add ARCH_USE_QUEUED_SPINLOCKS_XCHG32 Message-ID: <20210406085110.GD3288043@lianli.shorne-pla.net> References: <20210330223514.GE1171117@lianli.shorne-pla.net> <20210331123107.GF1171117@lianli.shorne-pla.net> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Wed, Mar 31, 2021 at 11:10:53PM +0800, Guo Ren wrote: > Hi Stafford, > > How do think add ARCH_USE_QUEUED_SPINLOCKS_XCHG32 in openrisc? > > https://lore.kernel.org/linux-riscv/1617201040-83905-7-git-send-email-guoren@kernel.org/T/#u Sorry I missed your mail here. It is true that OpenRISC doesn't have xchg16, so using the xchg32 code is better. Acked-by: Stafford Horne > On Wed, Mar 31, 2021 at 8:31 PM Stafford Horne wrote: > > > > On Wed, Mar 31, 2021 at 09:23:27AM +0200, Arnd Bergmann wrote: > > > On Wed, Mar 31, 2021 at 12:35 AM Stafford Horne wrote: > > > > > > > > I just want to chime in here, there may be a better spot in the thread to > > > > mention this but, for OpenRISC I did implement some generic 8/16-bit xchg code > > > > which I have on my todo list somwhere to replace the other generic > > > > implementations like that in mips. > > > > > > > > arch/openrisc/include/asm/cmpxchg.h > > > > > > > > The idea would be that architectures just implement these methods: > > > > > > > > long cmpxchg_u32(*ptr,old,new) > > > > long xchg_u32(*ptr,val) > > > > > > > > Then the rest of the generic header would implement cmpxchg. > > > > > > I like the idea of generalizing it a little further. I'd suggest staying a > > > little closer to the existing naming here though, as we already have > > > cmpxchg() for the type-agnostic version, and cmpxchg64() for the > > > fixed-length 64-bit version. > > > > OK. > > > > > I think a nice interface between architecture-specific and architecture > > > independent code would be to have architectures provide > > > arch_cmpxchg32()/arch_xchg32() as the most basic version, as well > > > as arch_cmpxchg8()/arch_cmpxchg16()/arch_xchg8()/arch_xchg16() > > > if they have instructions for those. > > > > Thanks for the name suggestions, it makes it easier for me. > > > > > The common code can then build cmpxchg16()/xchg16() on top of > > > either the 16-bit or the 32-bit primitives, and build the cmpxchg()/xchg() > > > wrapper around those (or alternatively we can decide to have them > > > only deal with fixed-32-bit and long/pointer sized atomics). > > > > Yeah, that was the idea. > > > > -Stafford > > > > -- > Best Regards > Guo Ren > > ML: https://lore.kernel.org/linux-csky/