Received: by 2002:a05:6358:e9c4:b0:b2:91dc:71ab with SMTP id hc4csp6412604rwb; Tue, 9 Aug 2022 15:04:28 -0700 (PDT) X-Google-Smtp-Source: AA6agR4bKJPcS7ME2M3V7LwXiWT0B7BcZhZ2R0LrfkOP0j5Wdj8SgJkNrkXTKvekZPqvMvatXyOC X-Received: by 2002:a17:902:a586:b0:170:f3ae:bd06 with SMTP id az6-20020a170902a58600b00170f3aebd06mr5197086plb.104.1660082668082; Tue, 09 Aug 2022 15:04:28 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1660082668; cv=none; d=google.com; s=arc-20160816; b=kNgM2lJ4cy45Bi/rDuSKiXGNxQ5+gQqmn4x26TX6CF0qNKyy3KsW23lqcl+HTDGmNh hfa1dbMFq9P2nAOQLHEf4WWZDWUd/gbomyAVeWi7fDjhDYRHJyr8xT6qLLNuteYXHNHV GClsiF8AVRRiKjT4/CJyWPNq42TFtFiRLWzFvz1Re6MH/T5eGxWKNK0Tm2ydySDINH2s HGJDmKz5zm2kySRWCYpyEvmAE6pX9Bkvs2Xj0OX3EvvboRby2axVH4XqXogfsFWIR17G z+DY5pACFXPnrbmw7MY61XdUKCigcsr1N038F1FB5nf7/RBJvRy8RjAo5drnyIYXpWMl Yu4Q== 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=o8zzCiEtSfxFlAxZzKI7HqSYHHhfKIfxoT6ysA2mwRQ=; b=MZYylFctrEMAVOjdfLLUDYhXz7qy46slGdxUETSJj6vUXM2D7yoq5IFP8CzUgSLN/g bQpDYFLPt6wNpP3Gz5r/eqH/A0JObDeg7rGcYOWSV6iYTesbJ5vo4eDWLsLLGxZAs2pI Y7GtnPbDKJkSVcKG0Ozbegwm2QbF1z1VLCXRHxq3GjMo/j0oikg2ZPwe0PyBAMckpvVF X0gcxhbjji9Kk0+kPSi4coupu+8Cxz81jxCmjWEzSDgqbED/JdSUAEnCDcufgD9IGO6V 8+8tRH8pqdGqRUOOUZQZI3GveKIbzx48uEELf+PcHQHVwGkeXWWjccm/nUQM5FXra0pS QaZA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@google.com header.s=20210112 header.b=mz0Fjqu9; 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=REJECT sp=REJECT dis=NONE) header.from=google.com Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id bc22-20020a656d96000000b0041b770487a7si8136939pgb.337.2022.08.09.15.04.14; Tue, 09 Aug 2022 15:04:28 -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=@google.com header.s=20210112 header.b=mz0Fjqu9; 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=REJECT sp=REJECT dis=NONE) header.from=google.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S229777AbiHIViq (ORCPT + 99 others); Tue, 9 Aug 2022 17:38:46 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:46668 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229511AbiHIVif (ORCPT ); Tue, 9 Aug 2022 17:38:35 -0400 Received: from mail-pj1-x102d.google.com (mail-pj1-x102d.google.com [IPv6:2607:f8b0:4864:20::102d]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id E213967CB8 for ; Tue, 9 Aug 2022 14:38:34 -0700 (PDT) Received: by mail-pj1-x102d.google.com with SMTP id t2-20020a17090a4e4200b001f21572f3a4so240274pjl.0 for ; Tue, 09 Aug 2022 14:38:34 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20210112; h=in-reply-to:content-disposition:mime-version:references:message-id :subject:cc:to:from:date:from:to:cc; bh=o8zzCiEtSfxFlAxZzKI7HqSYHHhfKIfxoT6ysA2mwRQ=; b=mz0Fjqu9dzg7nU0PCSUBlYeJVZ9gb/NvoAjp4klMVPqMWGBhoN7T4Z0A+Z5dI9GQUf nxY8R3gRW2W8Mae+vrr6Ov/btiZ6+vE6BrY4Kb0G+XnUcpHcplU/LqFC9QnvoIdHE0Bu /g+230V6KN4RaDF9l6q2AfbJ23OtFDrDFA/ZMoH1TKvz1vpKNLrWVhnVtBHLzuUnvgWh pTqM3Ksr4fhJ+B6dQYaaJwgY5DL1KZxkL90D8RAM62drfSjOX14jlDF7PTkcKwENBXt2 MtUmXKj5VBSQVKk2fMfgtzxlsBv5KLSPjbe0t1StTlu3+6htVnbMD0KVSeQgELY8ybIb afPw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=in-reply-to:content-disposition:mime-version:references:message-id :subject:cc:to:from:date:x-gm-message-state:from:to:cc; bh=o8zzCiEtSfxFlAxZzKI7HqSYHHhfKIfxoT6ysA2mwRQ=; b=dOXVhsklG6qmPa+0TuAzzxK4eLb/AZgjWugr/PhdTdOYSNWtSjZSubIneZPaZk7rlW /dswidLnHMjcNlni2H05T357aDLELNMEuh0sAQeniDB+mfhtFskz2akfwqAE8l8rxb1u oXae2b7xkdjqfgZEO3GFcKT4cNYepHXLgMCHige5zt4GNfgMkaG0Md4HgL0NfXTlw9og sL9E77L0aqgzbgcvj/MpT5HMaxtUl/1+aIST86hwcSSqSr0G7P52SR9Ydk9yMsfHiQx+ fWi1H5Mly7MWZ9u72JwMhumUynxJyxm+pXO4J8USbuixZaPxrzEKkfD5zxXS90YstZU5 BtLA== X-Gm-Message-State: ACgBeo3FXCykwVS/+lShJB1oiaib6O15ApJTcyVTBeFjm0Zr3xPJ9Vfh Y9KAGGNmoV0PN+ILpwr1VRMT9w== X-Received: by 2002:a17:902:8b87:b0:16f:1bb7:984a with SMTP id ay7-20020a1709028b8700b0016f1bb7984amr24756042plb.113.1660081114308; Tue, 09 Aug 2022 14:38:34 -0700 (PDT) Received: from google.com (7.104.168.34.bc.googleusercontent.com. [34.168.104.7]) by smtp.gmail.com with ESMTPSA id u8-20020a1709026e0800b0016f1204cde8sm11219119plk.301.2022.08.09.14.38.33 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 09 Aug 2022 14:38:33 -0700 (PDT) Date: Tue, 9 Aug 2022 21:38:29 +0000 From: Sean Christopherson To: Mathieu Desnoyers Cc: Gavin Shan , shuah , Florian Weimer , kvmarm@lists.cs.columbia.edu, KVM list , linux-kselftest , linux-kernel , Paolo Bonzini , maz , oliver upton , andrew jones , yihyu@redhat.com, shan gavin Subject: Re: [PATCH 1/2] KVM: selftests: Make rseq compatible with glibc-2.35 Message-ID: References: <20220809060627.115847-1-gshan@redhat.com> <20220809060627.115847-2-gshan@redhat.com> <8735e6ncxw.fsf@oldenburg.str.redhat.com> <7844e3fa-e49e-de75-e424-e82d3a023dd6@redhat.com> <87o7wtnay6.fsf@oldenburg.str.redhat.com> <616d4de6-81f6-9d14-4e57-4a79fec45690@redhat.com> <797306043.114963.1660047714774.JavaMail.zimbra@efficios.com> <1014177394.115022.1660052656961.JavaMail.zimbra@efficios.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <1014177394.115022.1660052656961.JavaMail.zimbra@efficios.com> X-Spam-Status: No, score=-14.5 required=5.0 tests=BAYES_00,DKIMWL_WL_MED, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF, ENV_AND_HDR_SPF_MATCH,FSL_HELO_FAKE,RCVD_IN_DNSWL_NONE,SPF_HELO_NONE, SPF_PASS,T_SCC_BODY_TEXT_LINE,USER_IN_DEF_DKIM_WL,USER_IN_DEF_SPF_WL autolearn=no 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, Aug 09, 2022, Mathieu Desnoyers wrote: > ----- On Aug 9, 2022, at 8:21 AM, Mathieu Desnoyers mathieu.desnoyers@efficios.com wrote: > > > ----- Gavin Shan wrote: > >> Hi Florian, > >> > >> On 8/9/22 5:16 PM, Florian Weimer wrote: > >> >>> __builtin_thread_pointer doesn't work on all architectures/GCC > >> >>> versions. > >> >>> Is this a problem for selftests? > >> >>> > >> >> > >> >> It's a problem as the test case is running on all architectures. I think I > >> >> need introduce our own __builtin_thread_pointer() for where it's not > >> >> supported: (1) PowerPC (2) x86 without GCC 11 > >> >> > >> >> Please let me know if I still have missed cases where > >> >> __buitin_thread_pointer() isn't supported? > >> > > >> > As far as I know, these are the two outliers that also have rseq > >> > support. The list is a bit longer if we also consider non-rseq > >> > architectures (csky, hppa, ia64, m68k, microblaze, sparc, don't know > >> > about the Linux architectures without glibc support). > >> > > >> > >> For kvm/selftests, there are 3 architectures involved actually. So we > >> just need consider 4 cases: aarch64, x86, s390 and other. For other > >> case, we just use __builtin_thread_pointer() to maintain code's > >> integrity, but it's not called at all. > >> > >> I think kvm/selftest is always relying on glibc if I'm correct. > > > > All those are handled in the rseq selftests and in librseq. Why duplicate all > > that logic again? > > More to the point, considering that we have all the relevant rseq registration > code in tools/testing/selftests/rseq/rseq.c already, and the relevant thread > pointer getter code in tools/testing/selftests/rseq/rseq-*thread-pointer.h, > is there an easy way to get test applications in tools/testing/selftests/kvm > and in tools/testing/selftests/rseq to share that common code ? > > Keeping duplicated compatibility code is bad for long-term maintainability. Any reason not to simply add tools/lib/rseq.c and then expose a helper to get the registered rseq struct?